Skip to content

Commit

Permalink
Fix secret generation for mutual ssl config
Browse files Browse the repository at this point in the history
  • Loading branch information
anuruddhal committed Feb 21, 2024
1 parent eb0c465 commit 0cce9a7
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ private void addClientList(List<ClientInfo> clientInfoList) throws KubernetesPlu
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 @@ private Set<SecretModel> processSecureSocketConfig(ListenerInfo listenerInfo) th
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 @@ private Set<SecretModel> processSecureSocketConfig(ListenerInfo listenerInfo) th
}
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

0 comments on commit 0cce9a7

Please sign in to comment.