use of io.fabric8.kubernetes.api.model.EnvVar in project che by eclipse.
the class KubernetesEnvVar method getEnvFrom.
/**
* Retrieves list of {@link EnvVar} based on environment variables specified
* in {@link ContainerConfig}
*
* @param envVariables
* @return list of {@link EnvVar}
*/
public static List<EnvVar> getEnvFrom(String[] envVariables) {
LOG.info("Container environment variables:");
List<EnvVar> env = new ArrayList<>();
for (String envVariable : envVariables) {
String[] nameAndValue = envVariable.split("=", 2);
String varName = nameAndValue[0];
String varValue = nameAndValue[1];
EnvVar envVar = new EnvVarBuilder().withName(varName).withValue(varValue).build();
env.add(envVar);
LOG.info("- {}={}", varName, varValue);
}
return env;
}
use of io.fabric8.kubernetes.api.model.EnvVar in project vertx-openshift-it by cescoffier.
the class PhantomJSDeployment method createPhantomPod.
private void createPhantomPod() {
if (!retrievePod()) {
Container c = new ContainerBuilder().withName(PHANTOMJS).withImage("maschmid/phantomjs").withImagePullPolicy("Always").withEnv(new EnvVar("IGNORE_SSL_ERRORS", "true", null)).withPorts(new ContainerPortBuilder().withContainerPort(4444).withName("webdriver").build()).build();
Pod pb = new PodBuilder().withNewMetadata().withName(PHANTOMJS).addToLabels("name", PHANTOMJS).endMetadata().withNewSpec().withTerminationGracePeriodSeconds(0L).withDnsPolicy("ClusterFirst").withRestartPolicy("Always").withContainers(c).endSpec().build();
client.pods().create(pb);
}
}
use of io.fabric8.kubernetes.api.model.EnvVar in project strimzi by strimzi.
the class KafkaSetOperatorTest method testNeedsRollingUpdateEnvZkConnect.
@Test
public void testNeedsRollingUpdateEnvZkConnect() {
String envVar = KEY_KAFKA_ZOOKEEPER_CONNECT;
a.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv().add(new EnvVar(envVar, containerEnvVars(a.getSpec().getTemplate().getSpec().getContainers().get(0)).get(envVar) + "-foo", null));
assertTrue(KafkaSetOperator.needsRollingUpdate(diff()));
}
use of io.fabric8.kubernetes.api.model.EnvVar in project strimzi by strimzi.
the class KafkaSetOperatorTest method testNeedsRollingUpdateEnvDefaultRepFactor.
@Test
public void testNeedsRollingUpdateEnvDefaultRepFactor() {
String envVar = KEY_KAFKA_DEFAULT_REPLICATION_FACTOR;
a.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv().add(new EnvVar(envVar, containerEnvVars(a.getSpec().getTemplate().getSpec().getContainers().get(0)).get(envVar) + "-foo", null));
assertTrue(KafkaSetOperator.needsRollingUpdate(diff()));
}
use of io.fabric8.kubernetes.api.model.EnvVar in project strimzi by strimzi.
the class ZookeeperSetOperatiorTest method testNeedsRollingUpdateEnvZkMetricsEnabled.
@Test
public void testNeedsRollingUpdateEnvZkMetricsEnabled() {
String envVar = KEY_ZOOKEEPER_METRICS_ENABLED;
a.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv().add(new EnvVar(envVar, containerEnvVars(a.getSpec().getTemplate().getSpec().getContainers().get(0)).get(envVar) + "-foo", null));
assertTrue(ZookeeperSetOperator.needsRollingUpdate(diff()));
}
Aggregations