Integer noVncPortInt = Integer.decode(noVncPort.get().getValue());
public EnvVarBuilder(EnvVar instance,Boolean validationEnabled){ this.fluent = this; this.withName(instance.getName()); this.withValue(instance.getValue()); this.withValueFrom(instance.getValueFrom()); this.validationEnabled = validationEnabled; }
public EnvVarBuilder(EnvVarFluent<?> fluent,EnvVar instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withName(instance.getName()); fluent.withValue(instance.getValue()); fluent.withValueFrom(instance.getValueFrom()); this.validationEnabled = validationEnabled; } public EnvVarBuilder(EnvVar instance){
private String getEnvValue(List<EnvVar> envVars, String name) { for (EnvVar var : envVars) { if (var.getName().equals(name)) { return var.getValue(); } } return "(not found)"; }
public EnvVarFluentImpl(EnvVar instance){ this.withName(instance.getName()); this.withValue(instance.getValue()); this.withValueFrom(instance.getValueFrom()); }
public static String getEnvVar(List<EnvVar> envVarList, String name, String defaultValue) { String answer = defaultValue; if (envVarList != null) { for (EnvVar envVar : envVarList) { String envVarName = envVar.getName(); if (Objects.equals(name, envVarName)) { String value = envVar.getValue(); if (StringUtils.isNotBlank(value)) { return value; } } } } return answer; }
public EnvVarBuilder( EnvVarFluent<?> fluent , EnvVar instance ){ this.fluent = fluent; fluent.withName(instance.getName()); fluent.withValue(instance.getValue()); fluent.withValueFrom(instance.getValueFrom()); } public EnvVarBuilder( EnvVar instance ){
/** * Converts a possibly null list of Env objects into a Map of environment variables */ public static Map<String, String> createEnvironmentVariableMap(List<EnvVar> envList) { Map<String, String> answer = new HashMap<>(); if (envList != null) { for (EnvVar env : envList) { String name = env.getName(); String value = env.getValue(); if (Strings.isNotBlank(name)) { answer.put(name, value); } } } return answer; }
public EnvVarBuilder( EnvVarFluent<?> fluent , EnvVar instance ){ this.fluent = fluent; fluent.withName(instance.getName()); fluent.withValue(instance.getValue()); fluent.withValueFrom(instance.getValueFrom()); } public EnvVarBuilder( EnvVar instance ){
private boolean podHasEnvVarValue(Pod pod, String envVarName, String envVarValue) { PodSpec spec = pod.getSpec(); if (spec != null) { List<Container> containers = spec.getContainers(); if (containers != null && !containers.isEmpty()) { Container container = containers.get(0); List<EnvVar> env = container.getEnv(); if (env != null) { for (EnvVar envVar : env) { if (Objects.equal(envVar.getName(), envVarName) && Objects.equal(envVar.getValue(), envVarValue)) { return true; } } } } } return false; }
public EnvVarBuilder( EnvVar instance ){ this.fluent = this; this.withName(instance.getName()); this.withValue(instance.getValue()); this.withValueFrom(instance.getValueFrom()); }
private void mergeEnvVariables(Container container) { List<EnvVar> env = container.getEnv(); if (env == null) { env = new LinkedList<>(); container.setEnv(env); } ResourceConfig resource = getContext().getResources(); Map<String, String> userEnv = resource != null ? resource.getEnv() : null; if (userEnv != null) { for(Map.Entry<String, String> entry : userEnv.entrySet()) { EnvVar existingVariable = KubernetesResourceUtil.setEnvVarNoOverride(env, entry.getKey(), entry.getValue()); if (existingVariable != null) { String actualValue = existingVariable.getValue(); if (actualValue == null) { actualValue = "retrieved using the downward API"; } log.warn("Environment variable %s will not be overridden: trying to set the value %s, but its actual value will be %s", entry.getKey(), entry.getValue(), actualValue); } } } } }
public EnvVarBuilder( EnvVar instance ){ this.fluent = this; this.withName(instance.getName()); this.withValue(instance.getValue()); this.withValueFrom(instance.getValueFrom()); }
public static boolean setEnvVar(List<EnvVar> envVarList, String name, String value) { for (EnvVar envVar : envVarList) { String envVarName = envVar.getName(); if (Objects.equals(name, envVarName)) { String oldValue = envVar.getValue(); if (Objects.equals(value, oldValue)) { return false; } else { envVar.setValue(value); return true; } } } EnvVar env = new EnvVarBuilder().withName(name).withValue(value).build(); envVarList.add(env); return true; }
public static Map<String, String> getKafkaContainerEnv(StatefulSet ss) { for (Container container : ss.getSpec().getTemplate().getSpec().getContainers()) { if ("kafka".equals(container.getName())) { LinkedHashMap<String, String> map = new LinkedHashMap<>(container.getEnv() == null ? 2 : container.getEnv().size()); if (container.getEnv() != null) { for (EnvVar envVar : container.getEnv()) { map.put(envVar.getName(), envVar.getValue()); } } return map; } } throw new KafkaUpgradeException("Could not find 'kafka' container in StatefulSet " + ss.getMetadata().getName()); }
private void mergeEnvVariables(Container container) { getConfiguration().getResource().flatMap(ResourceConfig::getEnv).ifPresent(resourceEnv -> { List<EnvVar> containerEnvVars = container.getEnv(); if (containerEnvVars == null) { containerEnvVars = new LinkedList<>(); container.setEnv(containerEnvVars); } for (Map.Entry<String, String> resourceEnvEntry : resourceEnv.entrySet()) { EnvVar newEnvVar = new EnvVarBuilder() .withName(resourceEnvEntry.getKey()) .withValue(resourceEnvEntry.getValue()) .build(); if (!hasEnvWithName(containerEnvVars, newEnvVar.getName())) { containerEnvVars.add(newEnvVar); } else { log.warn( "Environment variable %s will not be overridden: trying to set the value %s, but its actual value is %s", newEnvVar.getName(), newEnvVar.getValue(), getEnvValue(containerEnvVars, newEnvVar.getName())); } } }); }
cspec.put("env_" + env.getName(), env.getValue()); }); getNeoRxClient().execCypher(