{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "restatedeployments.restate.dev",
  "description": "Generated JSON schema for restate.dev's RestateDeployment CRD",
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string",
      "enum": [
        "restate.dev/v1beta1"
      ],
      "description": "a string that identifies the version of the schema the object should have. For CRDs this is the crdGroup/version"
    },
    "kind": {
      "type": "string",
      "const": "RestateDeployment",
      "description": "a string the identifies the kind of resource that this document represents"
    },
    "metadata": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "a string that uniquely identifies this object within the current namespace"
        },
        "labels": {
          "type": "object",
          "description": "a map of string keys and values that can be used to organize and categorize objects, for more details see https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/"
        },
        "annotations": {
          "type": "object",
          "description": "a map of string keys and values that can be used by external tooling to store and retrieve arbitrary metadata about this object, for more details see https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/"
        }
      },
      "required": [
        "name"
      ]
    },
    "spec": {}
  },
  "required": [
    "apiVersion",
    "kind",
    "metadata",
    "spec"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "apiVersion": {
            "const": "restate.dev/v1beta1"
          }
        }
      },
      "then": {
        "properties": {
          "spec": {
            "description": "RestateDeployment is similar to a Kubernetes Deployment but tailored for Restate services. It maintains ReplicaSets and Services for each version to support Restate's versioning requirements, ensuring old versions remain available until all invocations against them are complete.",
            "properties": {
              "minReadySeconds": {
                "description": "Minimum number of seconds for which a newly created pod should be ready.",
                "format": "int32",
                "minimum": 0,
                "nullable": true,
                "type": "integer"
              },
              "replicas": {
                "default": 1,
                "description": "Number of desired pods. Defaults to 1.",
                "format": "int32",
                "minimum": 0,
                "type": "integer"
              },
              "restate": {
                "description": "Restate specific configuration",
                "properties": {
                  "register": {
                    "description": "The location of the Restate Admin API to register this deployment against",
                    "oneOf": [
                      {
                        "required": [
                          "cluster"
                        ]
                      },
                      {
                        "required": [
                          "service"
                        ]
                      },
                      {
                        "required": [
                          "url"
                        ]
                      }
                    ],
                    "properties": {
                      "cluster": {
                        "description": "The name of a RestateCluster against which to register the deployment. Exactly one of `cluster`, `service` or `url` must be specified",
                        "type": "string"
                      },
                      "service": {
                        "description": "A reference to a Service pointing against which to register the deployment. Exactly one of `cluster`, `service` or `url` must be specified",
                        "properties": {
                          "name": {
                            "description": "`name` is the name of the service. Required",
                            "type": "string"
                          },
                          "namespace": {
                            "description": "`namespace` is the namespace of the service. Required",
                            "type": "string"
                          },
                          "path": {
                            "description": "`path` is an optional URL path which will be prepended before admin api paths. Should not end in a /.",
                            "nullable": true,
                            "type": "string"
                          },
                          "port": {
                            "description": "If specified, the port on the service that hosts the admin api. Defaults to 9070. `port` should be a valid port number (1-65535, inclusive).",
                            "format": "int32",
                            "maximum": 65535,
                            "minimum": 1,
                            "nullable": true,
                            "type": "integer"
                          }
                        },
                        "required": [
                          "name",
                          "namespace"
                        ],
                        "type": "object"
                      },
                      "url": {
                        "description": "A url of the restate admin endpoint against which to register the deployment Exactly one of `cluster`, `service` or `url` must be specified",
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "servicePath": {
                    "description": "Optional path to append to the Service url when registering with Restate. If not provided, the service will be registered at the root path \"/\".",
                    "nullable": true,
                    "type": "string"
                  },
                  "useHttp11": {
                    "description": "Force the use of HTTP/1.1 when registering with Restate",
                    "nullable": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "register"
                ],
                "type": "object"
              },
              "revisionHistoryLimit": {
                "default": 10,
                "description": "The number of old ReplicaSets to retain to allow rollback. Defaults to 10.",
                "format": "int32",
                "minimum": 0,
                "type": "integer"
              },
              "selector": {
                "description": "Label selector for pods. Must match the pod template's labels.",
                "properties": {
                  "matchExpressions": {
                    "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
                    "items": {
                      "description": "A label selector requirement is a selector that contains values, a key, and an operator that\nrelates the key and values.",
                      "properties": {
                        "key": {
                          "description": "key is the label key that the selector applies to.",
                          "type": "string"
                        },
                        "operator": {
                          "description": "operator represents a key's relationship to a set of values.\nValid operators are In, NotIn, Exists and DoesNotExist.",
                          "type": "string"
                        },
                        "values": {
                          "description": "values is an array of string values. If the operator is In or NotIn,\nthe values array must be non-empty. If the operator is Exists or DoesNotExist,\nthe values array must be empty. This array is replaced during a strategic\nmerge patch.",
                          "items": {
                            "type": "string"
                          },
                          "type": "array",
                          "x-kubernetes-list-type": "atomic"
                        }
                      },
                      "required": [
                        "key",
                        "operator"
                      ],
                      "type": "object"
                    },
                    "type": "array",
                    "x-kubernetes-list-type": "atomic"
                  },
                  "matchLabels": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels\nmap is equivalent to an element of matchExpressions, whose key field is \"key\", the\noperator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
                    "type": "object"
                  }
                },
                "type": "object",
                "x-kubernetes-map-type": "atomic"
              },
              "template": {
                "description": "Template describes the pods that will be created.",
                "properties": {
                  "metadata": {
                    "description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
                    "nullable": true,
                    "properties": {
                      "annotations": {
                        "additionalProperties": {
                          "type": "string"
                        },
                        "description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations",
                        "nullable": true,
                        "type": "object"
                      },
                      "labels": {
                        "additionalProperties": {
                          "type": "string"
                        },
                        "description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels",
                        "nullable": true,
                        "type": "object"
                      }
                    },
                    "type": "object"
                  },
                  "spec": {
                    "description": "Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. The contents of this field are passed through directly from the operator to the created ReplicaSet and are not validated.",
                    "x-kubernetes-preserve-unknown-fields": true
                  }
                },
                "required": [
                  "spec"
                ],
                "type": "object"
              }
            },
            "required": [
              "restate",
              "selector",
              "template"
            ],
            "type": "object",
            "x-kubernetes-validations": []
          }
        }
      }
    }
  ]
}
