{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "kind": {
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "properties": {
        "allowCrossNamespaceImport": {
          "default": false,
          "type": "boolean"
        },
        "instanceSelector": {
          "properties": {
            "matchExpressions": {
              "items": {
                "properties": {
                  "key": {
                    "type": "string"
                  },
                  "operator": {
                    "type": "string"
                  },
                  "values": {
                    "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"
              },
              "type": "object"
            }
          },
          "type": "object",
          "x-kubernetes-map-type": "atomic",
          "x-kubernetes-validations": [
            {
              "message": "spec.instanceSelector is immutable",
              "rule": "self == oldSelf"
            }
          ]
        },
        "patch": {
          "properties": {
            "env": {
              "items": {
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "valueFrom": {
                    "properties": {
                      "configMapKeyRef": {
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "default": "",
                            "type": "string"
                          },
                          "optional": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object",
                        "x-kubernetes-map-type": "atomic"
                      },
                      "grafanaRef": {
                        "properties": {
                          "apiVersion": {
                            "type": "string"
                          },
                          "fieldPath": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "fieldPath"
                        ],
                        "type": "object",
                        "x-kubernetes-map-type": "atomic"
                      },
                      "secretKeyRef": {
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "default": "",
                            "type": "string"
                          },
                          "optional": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "key"
                        ],
                        "type": "object",
                        "x-kubernetes-map-type": "atomic"
                      }
                    },
                    "type": "object"
                  }
                },
                "required": [
                  "name",
                  "valueFrom"
                ],
                "type": "object"
              },
              "type": "array"
            },
            "scripts": {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "scripts"
          ],
          "type": "object"
        },
        "resyncPeriod": {
          "pattern": "^([0-9]+(\\.[0-9]+)?(ns|us|\u00b5s|ms|s|m|h))+$",
          "type": "string"
        },
        "suspend": {
          "type": "boolean"
        },
        "template": {
          "properties": {
            "apiVersion": {
              "type": "string"
            },
            "kind": {
              "type": "string",
              "x-kubernetes-validations": [
                {
                  "message": "Value is immutable",
                  "rule": "self == oldSelf"
                }
              ]
            },
            "metadata": {
              "properties": {
                "annotations": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object"
                },
                "labels": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object"
                },
                "name": {
                  "type": "string",
                  "x-kubernetes-validations": [
                    {
                      "message": "Value is immutable",
                      "rule": "self == oldSelf"
                    }
                  ]
                },
                "namespace": {
                  "type": "string",
                  "x-kubernetes-validations": [
                    {
                      "message": "Value is immutable",
                      "rule": "self == oldSelf"
                    }
                  ]
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "x-kubernetes-validations": [
                {
                  "message": "namespace is immutable",
                  "rule": "((!has(oldSelf.__namespace__) && !has(self.__namespace__)) || (has(oldSelf.__namespace__) && has(self.__namespace__)))"
                }
              ]
            },
            "spec": {
              "x-kubernetes-preserve-unknown-fields": true
            }
          },
          "required": [
            "apiVersion",
            "kind",
            "metadata"
          ],
          "type": "object"
        }
      },
      "required": [
        "instanceSelector",
        "template"
      ],
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "disabling spec.allowCrossNamespaceImport requires a recreate to ensure desired state",
          "rule": "!oldSelf.allowCrossNamespaceImport || (oldSelf.allowCrossNamespaceImport && self.allowCrossNamespaceImport)"
        }
      ]
    },
    "status": {
      "properties": {
        "conditions": {
          "items": {
            "properties": {
              "lastTransitionTime": {
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "maxLength": 32768,
                "type": "string"
              },
              "observedGeneration": {
                "format": "int64",
                "minimum": 0,
                "type": "integer"
              },
              "reason": {
                "maxLength": 1024,
                "minLength": 1,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
                "type": "string"
              },
              "status": {
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ],
                "type": "string"
              },
              "type": {
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "lastResync": {
          "format": "date-time",
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}
