io.fabric8.kubernetes.api.model.ConfigMapEnvSource Java Examples
The following examples show how to use
io.fabric8.kubernetes.api.model.ConfigMapEnvSource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PodTemplateUtilsTest.java From kubernetes-plugin with Apache License 2.0 | 6 votes |
@Test public void shouldCombineAllEnvFromSourcesWithoutChangingOrder() { EnvFromSource configMap1 = new EnvFromSource(new ConfigMapEnvSource("config-map-1", false), null, null); EnvFromSource secret1 = new EnvFromSource(null, null, new SecretEnvSource("secret-1", false)); EnvFromSource configMap2 = new EnvFromSource(new ConfigMapEnvSource("config-map-2", true), null, null); EnvFromSource secret2 = new EnvFromSource(null, null, new SecretEnvSource("secret-2", true)); Container container1 = new Container(); container1.setEnvFrom(asList(configMap1, secret1)); Container container2 = new Container(); container2.setEnvFrom(asList(configMap2, secret2)); Container result = combine(container1, container2); // Config maps and secrets could potentially overwrite each other's variables. We should preserve their order. assertThat(result.getEnvFrom(), contains(configMap1, secret1, configMap2, secret2)); }
Example #2
Source File: DeploymentPropertiesResolver.java From spring-cloud-deployer-kubernetes with Apache License 2.0 | 5 votes |
private EnvFromSource buildConfigMapRefEnvVar(String configMapRefName) { ConfigMapEnvSource configMapEnvSource = new ConfigMapEnvSource(); configMapEnvSource.setName(configMapRefName); EnvFromSource envFromSource = new EnvFromSource(); envFromSource.setConfigMapRef(configMapEnvSource); return envFromSource; }
Example #3
Source File: PodTemplateUtilsTest.java From kubernetes-plugin with Apache License 2.0 | 5 votes |
@Test public void shouldFilterOutEnvFromSourcesWithNullOrEmptyKey() { EnvFromSource noSource = new EnvFromSource(null, null, null); EnvFromSource noConfigMapKey = new EnvFromSource(new ConfigMapEnvSource(null, false), null, null); EnvFromSource emptyConfigMapKey = new EnvFromSource(new ConfigMapEnvSource("", false), null, null); EnvFromSource noSecretKey = new EnvFromSource(null, null, new SecretEnvSource(null, false)); EnvFromSource emptySecretKey = new EnvFromSource(null, null, new SecretEnvSource("", false)); Container container = new Container(); container.setEnvFrom(asList(noSource, noConfigMapKey, emptyConfigMapKey, noSecretKey, emptySecretKey)); Container result = combine(container, new Container()); assertEquals(0, result.getEnvFrom().size()); }