private boolean isVariablesListValid() {
   List<KeyValue> variables = view.getEnvironmentVariables();
   if (variables.isEmpty()) {
     view.hideVariablesError();
     return true;
   }
   for (KeyValue keyValue : variables) {
     if (!OpenshiftValidator.isEnvironmentVariableNameValid(keyValue.getKey())) {
       view.showVariablesError(locale.invalidVariablesError());
       return false;
     }
   }
   view.hideVariablesError();
   return true;
 }
  private DeploymentConfig generateDeploymentConfig(String namespace, Map<String, String> labels) {
    Object exposedPorts =
        osActiveStreamTag
            .getImage()
            .getDockerImageMetadata()
            .getContainerConfig()
            .getExposedPorts();
    List<ContainerPort> ports = parsePorts(exposedPorts);

    Map<String, String> templateLabels = new HashMap<>(labels);
    templateLabels.put("deploymentconfig", osAppName);

    List<EnvVar> env = newArrayList();

    for (KeyValue variable : view.getEnvironmentVariables()) {
      env.add(newDto(EnvVar.class).withName(variable.getKey()).withValue(variable.getValue()));
    }

    final String steamTagName = osAppName + ":latest";
    PodSpec podSpec =
        newDto(PodSpec.class)
            .withContainers(
                newArrayList(
                    newDto(Container.class)
                        .withImage(steamTagName)
                        .withName(osAppName)
                        .withPorts(ports)
                        .withEnv(env)));

    PodTemplateSpec template =
        newDto(PodTemplateSpec.class)
            .withMetadata(newDto(ObjectMeta.class).withLabels(templateLabels))
            .withSpec(podSpec);

    DeploymentTriggerPolicy imageChange =
        newDto(DeploymentTriggerPolicy.class)
            .withType("ImageChange")
            .withImageChangeParams(
                newDto(DeploymentTriggerImageChangeParams.class)
                    .withAutomatic(true)
                    .withContainerNames(newArrayList(osAppName))
                    .withFrom(
                        newDto(ObjectReference.class)
                            .withKind("ImageStreamTag")
                            .withName(steamTagName)));

    DeploymentTriggerPolicy configChange =
        newDto(DeploymentTriggerPolicy.class).withType("ConfigChange");

    return newDto(DeploymentConfig.class)
        .withApiVersion(API_VERSION)
        .withKind("DeploymentConfig")
        .withMetadata(
            newDto(ObjectMeta.class)
                .withName(osAppName)
                .withLabels(labels)
                .withNamespace(namespace))
        .withSpec(
            newDto(DeploymentConfigSpec.class)
                .withReplicas(1)
                .withSelector(Collections.singletonMap("deploymentconfig", osAppName))
                .withTemplate(template)
                .withTriggers(newArrayList(imageChange, configChange)));
  }