Skip to content

Commit

Permalink
Added volumes and additional containers to test that both are mapped.
Browse files Browse the repository at this point in the history
  • Loading branch information
corneil committed Aug 7, 2024
1 parent 2c200fe commit f5c1af8
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public void deployWithVolumesAndVolumeMounts() throws Exception {
public void deployWithVolumesAndVolumeMountsOnAdditionalContainer() throws Exception {
AppDefinition definition = new AppDefinition("app-test", null);
Map<String, String> props = new HashMap<>();
props.put("spring.cloud.deployer.kubernetes.volumes", "[{name: 'config', configMap: {name: promtail-config, items: [{key: promtail.yaml, path: promtail.yaml}]}}]");
props.put("spring.cloud.deployer.kubernetes.additional-containers", "[{name: 'promtail',image: image-path-of-promtail, ports:[{protocol: TCP,containerPort: 8080}],args: [\"-config.file=/home/conf/promtail.yaml\"],volumeMounts: [{name: 'config', mountPath: '/home/conf'}]}]");
props.put("spring.cloud.deployer.kubernetes.volumes", "[{name: 'config', configMap: {name: promtail-config, items: [{key: promtail.yaml, path: promtail.yaml}]}},{name: 'config2', configMap: {name: promtail-config, items: [{key: promtail.yaml, path: promtail.yaml}]}}]");
props.put("spring.cloud.deployer.kubernetes.additional-containers", "[{name: 'promtail',image: image-path-of-promtail, ports:[{protocol: TCP,containerPort: 8080}],args: [\"-config.file=/home/conf/promtail.yaml\"],volumeMounts: [{name: 'config', mountPath: '/home/conf'}]},{name: 'promtail2',image: image-path-of-promtail, ports:[{protocol: TCP,containerPort: 8080}],args: [\"-config.file=/home/conf/promtail.yaml\"],volumeMounts: [{name: 'config2', mountPath: '/home/conf'}]}]");
AppDeploymentRequest appDeploymentRequest = new AppDeploymentRequest(definition, getResource(), props);

deployer = k8sAppDeployer();
Expand All @@ -159,7 +159,9 @@ public void deployWithVolumesAndVolumeMountsOnAdditionalContainer() throws Excep
.withItems(new KeyToPath("promtail.yaml", null, "promtail.yaml"))
.build();
Volume volume = new VolumeBuilder().withName("config").withNewConfigMapLike(configMapVolumeSource).endConfigMap().build();
assertThat(podSpec.getVolumes()).containsOnly(volume);
Volume volume2 = new VolumeBuilder().withName("config2").withNewConfigMapLike(configMapVolumeSource).endConfigMap().build();
assertThat(podSpec.getVolumes()).containsExactly(volume, volume2);

}

@Test
Expand Down

0 comments on commit f5c1af8

Please sign in to comment.