{
  "type": "single-step-form-array",
  "label": {
    "text": "labels.environment_variables"
  },
  "addFormLabel": "labels.environment_variable",
  "schema": {
    "$ref": "schema#/"
  },
  "customClass": "mb-20",
  "tableContents": [
    {
      "type": "value",
      "typeOfValue": "string",
      "inTableColumn": true,
      "label": {
        "text": "labels.name"
      },
      "path": "name"
    },
    {
      "type": "value",
      "typeOfValue": "string",
      "inTableColumn": true,
      "label": {
        "text": "Value From"
      },
      "path": "valueFrom/type",
      "computed": "getValueFrom"
    },
    {
      "type": "value",
      "typeOfValue": "string",
      "inTableColumn": true,
      "label": {
        "text": "RefName"
      },
      "path": "refName",
      "computed": "getRefName"
    },
    {
      "type": "value",
      "typeOfValue": "string",
      "inTableColumn": true,
      "label": {
        "text": "Key/Value"
      },
      "path": "keyOrValue",
      "computed": "getKeyOrValue"
    }
  ],
  "element": {
    "elements": [
      {
        "label": {
          "text": "labels.name"
        },
        "type": "input",
        "schema": {
          "$ref": "schema#/items/properties/name"
        }
      },
      {
        "label": {
          "text": "Value From"
        },
        "schema": {
          "$ref": "discriminator#/valueFromType"
        },
        "type": "radio",
        "computed": "setValueFrom",
        "onChange": "onValueFromChange",
        "options": [
          {
            "text": "Input",
            "value": "input"
          },
          {
            "text": "Secret",
            "value": "secret"
          },
          {
            "text": "ConfigMap",
            "value": "configMap"
          }
        ]
      },
      {
        "if": "isEqualToValueFromType|input",
        "label": {
          "text": "labels.value"
        },
        "type": "input",
        "schema": {
          "$ref": "schema#/items/properties/value"
        }
      },
      {
        "type": "single-step-form",
        "schema": {
          "$ref": "schema#/items/properties/valueFrom"
        },
        "elements": [
          {
            "if": "isEqualToValueFromType|configMap",
            "type": "single-step-form",
            "schema": {
              "$ref": "schema#/items/properties/valueFrom/properties/configMapKeyRef"
            },
            "elements": [
              {
                "label": {
                  "text": "labels.config_map_name"
                },
                "type": "select",
                "allowUserDefinedOption": true,
                "fetch": "resourceNames|core|v1|configmaps",
                "schema": {
                  "$ref": "schema#/items/properties/valueFrom/properties/configMapKeyRef/properties/name"
                }
              },
              {
                "label": {
                  "text": "labels.config_map_key"
                },
                "fetch": "getConfigMapKeys",
                "allowUserDefinedOption": true,
                "type": "select",
                "schema": {
                  "$ref": "schema#/items/properties/valueFrom/properties/configMapKeyRef/properties/key"
                }
              }
            ]
          },
          {
            "if": "isEqualToValueFromType|secret",
            "type": "single-step-form",
            "schema": {
              "$ref": "schema#/items/properties/valueFrom/properties/secretKeyRef"
            },
            "elements": [
              {
                "label": {
                  "text": "labels.secret_name"
                },
                "type": "select",
                "allowUserDefinedOption": true,
                "fetch": "getSecrets",
                "schema": {
                  "$ref": "schema#/items/properties/valueFrom/properties/secretKeyRef/properties/name"
                }
              },
              {
                "label": {
                  "text": "labels.secret_key"
                },
                "type": "select",
                "allowUserDefinedOption": true,
                "fetch": "getSecretKeys",
                "schema": {
                  "$ref": "schema#/items/properties/valueFrom/properties/secretKeyRef/properties/key"
                }
              }
            ]
          }
        ]
      }
    ],
    "type": "single-step-form",
    "discriminator": {
      "valueFromType": {
        "type": "string",
        "default": "input"
      }
    }
  }
}