{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "stafett-worker values",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "global": {
      "type": "object"
    },
    "image": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "repository": {
          "type": "string",
          "minLength": 1,
          "description": "Prefix of both images: <repository>-enqueue and <repository>-deliver."
        },
        "tag": {
          "type": ["string", "number"],
          "description": "Tag of both images. Empty: the chart's appVersion."
        },
        "pullPolicy": {
          "enum": ["Always", "IfNotPresent", "Never"]
        }
      }
    },
    "imagePullSecrets": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name"],
        "properties": {
          "name": {"type": "string", "minLength": 1}
        }
      }
    },
    "secret": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "existingSecret": {
          "type": "string",
          "description": "A Secret with key DATABASE_URL, and STAFETT_SIGNING_SECRET to sign."
        },
        "databaseUrl": {
          "type": "string",
          "description": "Inline alternative to existingSecret. Ends up in the release, base64 only."
        },
        "signingSecret": {
          "type": "string",
          "description": "Inline alternative to existingSecret. Empty: deliveries go out unsigned."
        }
      }
    },
    "enqueue": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "replicas": {"$ref": "#/definitions/replicas"},
        "env": {"$ref": "#/definitions/env"},
        "resources": {"$ref": "#/definitions/resources"},
        "service": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "type": {"enum": ["ClusterIP", "NodePort", "LoadBalancer"]},
            "port": {"type": "integer", "minimum": 1, "maximum": 65535}
          }
        }
      }
    },
    "deliver": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "replicas": {"$ref": "#/definitions/replicas"},
        "env": {"$ref": "#/definitions/env"},
        "resources": {"$ref": "#/definitions/resources"},
        "terminationGracePeriodSeconds": {
          "type": "integer",
          "minimum": 0,
          "description": "Keep it above STAFETT_DELIVERY_TIMEOUT_SECONDS."
        }
      }
    },
    "setup": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "resources": {"$ref": "#/definitions/resources"}
      }
    },
    "nodeSelector": {
      "type": "object",
      "additionalProperties": {"type": "string"}
    },
    "tolerations": {
      "type": "array",
      "items": {"type": "object"}
    }
  },
  "definitions": {
    "replicas": {
      "type": "integer",
      "minimum": 0
    },
    "env": {
      "type": "object",
      "description": "Extra environment variables, NAME: value.",
      "propertyNames": {"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"},
      "additionalProperties": {"type": ["string", "number", "boolean"]}
    },
    "resources": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "requests": {"$ref": "#/definitions/quantities"},
        "limits": {"$ref": "#/definitions/quantities"}
      }
    },
    "quantities": {
      "type": "object",
      "additionalProperties": {"type": ["string", "number"]}
    }
  }
}
