Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix secret generation for mutual ssl config #768

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerina"
name = "cloud"
version = "2.11.2"
version = "2.11.3"
repository = "https://github.com/ballerina-platform/module-ballerina-c2c"
license = ["Apache-2.0"]
keywords = ["cloud", "kubernetes", "docker", "k8s", "c2c"]
Expand Down
2 changes: 1 addition & 1 deletion ballerina/CompilerPlugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ id = "code2cloud"
class = "io.ballerina.c2c.C2CCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/cloud-compiler-plugin-2.11.2.jar"
path = "../compiler-plugin/build/libs/cloud-compiler-plugin-2.11.3-SNAPSHOT.jar"
2 changes: 1 addition & 1 deletion ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distribution-version = "2201.8.0"
[[package]]
org = "ballerina"
name = "cloud"
version = "2.11.2"
version = "2.11.3"
modules = [
{org = "ballerina", packageName = "cloud", moduleName = "cloud"}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
final Optional<MutualSSLConfig> mutualSSLConfig = clientInfo.getHttpsConfig().getMutualSSLConfig();
if (mutualSSLConfig.isPresent()) {
String sslCertPath = mutualSSLConfig.get().getPath();
if (KubernetesUtils.isBlank(sslCertPath)) {
continue;

Check warning on line 128 in compiler-plugin/src/main/java/io/ballerina/c2c/tasks/C2CAnalysisTask.java

View check run for this annotation

Codecov / codecov/patch

compiler-plugin/src/main/java/io/ballerina/c2c/tasks/C2CAnalysisTask.java#L128

Added line #L128 was not covered by tests
}
String sslCertPathContent = readSecretFile(sslCertPath);
SecretModel secretModel;
Optional<SecretModel> existing = getSecretByMountPathExists(getMountPath(sslCertPath));
Expand Down Expand Up @@ -216,7 +219,7 @@
if (secureSocketConfig.isPresent()) {
String path = secureSocketConfig.get().getPath();
final String validName = getValidName(listenerInfo.getName());
if (path != null && !"".equals(path)) {
if (!KubernetesUtils.isBlank(path)) {
String keyStoreContent = readSecretFile(path);
secretModel.setName(validName + "-secure-socket");
secretModel.setMountPath(getMountPath(path));
Expand Down Expand Up @@ -258,6 +261,9 @@
}
if (mutualSSLConfig.isPresent()) {
String sslCertPath = mutualSSLConfig.get().getPath();
if (KubernetesUtils.isBlank(sslCertPath)) {
return secrets;

Check warning on line 265 in compiler-plugin/src/main/java/io/ballerina/c2c/tasks/C2CAnalysisTask.java

View check run for this annotation

Codecov / codecov/patch

compiler-plugin/src/main/java/io/ballerina/c2c/tasks/C2CAnalysisTask.java#L265

Added line #L265 was not covered by tests
}
String sslCertPathContent = readSecretFile(sslCertPath);
if (getMountPath(sslCertPath).equals(secretModel.getMountPath())) {
// Same mount path as key config add data to existing secret.
Expand Down
Loading