Skip to content

Commit

Permalink
Merge pull request #145 from mnovak1/add-secrets-to-bootable-jar
Browse files Browse the repository at this point in the history
[issue 143] - Mount secrets into bootable jar container in BootableJarImageOpenShiftProvisioner
  • Loading branch information
fabiobrz authored Feb 9, 2024
2 parents 0507664 + e32f134 commit 95fa9d4
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import cz.xtf.core.waiting.failfast.FailFastCheck;
import io.fabric8.kubernetes.api.model.EnvVar;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.Secret;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -173,10 +174,19 @@ private ApplicationBuilder getAppBuilder() {

ManagedBuildReference reference = BuildManagers.get().deploy(bootableJarBuild);
BuildManagers.get().hasBuildCompleted(bootableJarBuild).waitFor();
return ApplicationBuilder.fromManagedBuild(

ApplicationBuilder appBuilder = ApplicationBuilder.fromManagedBuild(
bootableApplication.getName(),
reference,
Collections.singletonMap(APP_LABEL_KEY, bootableApplication.getName()));
// Add any configured secrets
for (Secret secret : bootableApplication.getSecrets()) {
appBuilder.deploymentConfig().podTemplate()
.addSecretVolume(secret.getMetadata().getName(), secret.getMetadata().getName())
.container()
.addVolumeMount(secret.getMetadata().getName(), "/etc/secrets", false);
}
return appBuilder;
} else {
throw new RuntimeException("Application artifact path or git reference has to be specified");
}
Expand Down

0 comments on commit 95fa9d4

Please sign in to comment.