{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "kind": {
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "properties": {
        "options": {
          "additionalProperties": {
            "maxLength": 4096,
            "minLength": 0,
            "type": "string"
          },
          "maxProperties": 16,
          "type": "object"
        },
        "targetRefs": {
          "items": {
            "properties": {
              "group": {
                "maxLength": 253,
                "pattern": "^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                "type": "string"
              },
              "kind": {
                "maxLength": 63,
                "minLength": 1,
                "pattern": "^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$",
                "type": "string"
              },
              "name": {
                "maxLength": 253,
                "minLength": 1,
                "type": "string"
              },
              "sectionName": {
                "maxLength": 253,
                "minLength": 1,
                "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                "type": "string"
              }
            },
            "required": [
              "group",
              "kind",
              "name"
            ],
            "type": "object"
          },
          "maxItems": 16,
          "minItems": 1,
          "type": "array",
          "x-kubernetes-list-type": "atomic",
          "x-kubernetes-validations": [
            {
              "message": "sectionName must be specified when targetRefs includes 2 or more references to the same target",
              "rule": "self.all(p1, self.all(p2, p1.group == p2.group && p1.kind == p2.kind && p1.name == p2.name ? ((!has(p1.sectionName) || p1.sectionName == '') == (!has(p2.sectionName) || p2.sectionName == '')) : true))"
            },
            {
              "message": "sectionName must be unique when targetRefs includes 2 or more references to the same target",
              "rule": "self.all(p1, self.exists_one(p2, p1.group == p2.group && p1.kind == p2.kind && p1.name == p2.name && (((!has(p1.sectionName) || p1.sectionName == '') && (!has(p2.sectionName) || p2.sectionName == '')) || (has(p1.sectionName) && has(p2.sectionName) && p1.sectionName == p2.sectionName))))"
            }
          ]
        },
        "validation": {
          "properties": {
            "caCertificateRefs": {
              "items": {
                "properties": {
                  "group": {
                    "maxLength": 253,
                    "pattern": "^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                    "type": "string"
                  },
                  "kind": {
                    "maxLength": 63,
                    "minLength": 1,
                    "pattern": "^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$",
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 253,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "group",
                  "kind",
                  "name"
                ],
                "type": "object"
              },
              "maxItems": 8,
              "type": "array",
              "x-kubernetes-list-type": "atomic"
            },
            "hostname": {
              "maxLength": 253,
              "minLength": 1,
              "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
              "type": "string"
            },
            "subjectAltNames": {
              "items": {
                "properties": {
                  "hostname": {
                    "maxLength": 253,
                    "minLength": 1,
                    "pattern": "^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "Hostname",
                      "URI"
                    ],
                    "type": "string"
                  },
                  "uri": {
                    "maxLength": 253,
                    "minLength": 1,
                    "pattern": "^(([^:/?#]+):)(//([^/?#]*))([^?#]*)(\\?([^#]*))?(#(.*))?",
                    "type": "string"
                  }
                },
                "required": [
                  "type"
                ],
                "type": "object",
                "x-kubernetes-validations": [
                  {
                    "message": "SubjectAltName element must contain Hostname, if Type is set to Hostname",
                    "rule": "!(self.type == \"Hostname\" && (!has(self.hostname) || self.hostname == \"\"))"
                  },
                  {
                    "message": "SubjectAltName element must not contain Hostname, if Type is not set to Hostname",
                    "rule": "!(self.type != \"Hostname\" && has(self.hostname) && self.hostname != \"\")"
                  },
                  {
                    "message": "SubjectAltName element must contain URI, if Type is set to URI",
                    "rule": "!(self.type == \"URI\" && (!has(self.uri) || self.uri == \"\"))"
                  },
                  {
                    "message": "SubjectAltName element must not contain URI, if Type is not set to URI",
                    "rule": "!(self.type != \"URI\" && has(self.uri) && self.uri != \"\")"
                  }
                ]
              },
              "maxItems": 5,
              "type": "array",
              "x-kubernetes-list-type": "atomic"
            },
            "wellKnownCACertificates": {
              "maxLength": 253,
              "minLength": 1,
              "pattern": "^(System|([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_.]{0,61})?[A-Za-z0-9]))$",
              "type": "string"
            }
          },
          "required": [
            "hostname"
          ],
          "type": "object",
          "x-kubernetes-validations": [
            {
              "message": "must not contain both CACertificateRefs and WellKnownCACertificates",
              "rule": "!(has(self.caCertificateRefs) && size(self.caCertificateRefs) > 0 && has(self.wellKnownCACertificates) && self.wellKnownCACertificates != \"\")"
            },
            {
              "message": "must specify either CACertificateRefs or WellKnownCACertificates",
              "rule": "(has(self.caCertificateRefs) && size(self.caCertificateRefs) > 0 || has(self.wellKnownCACertificates) && self.wellKnownCACertificates != \"\")"
            }
          ]
        }
      },
      "required": [
        "targetRefs",
        "validation"
      ],
      "type": "object"
    },
    "status": {
      "properties": {
        "ancestors": {
          "items": {
            "properties": {
              "ancestorRef": {
                "properties": {
                  "group": {
                    "default": "gateway.networking.k8s.io",
                    "maxLength": 253,
                    "pattern": "^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                    "type": "string"
                  },
                  "kind": {
                    "default": "Gateway",
                    "maxLength": 63,
                    "minLength": 1,
                    "pattern": "^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$",
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 253,
                    "minLength": 1,
                    "type": "string"
                  },
                  "namespace": {
                    "maxLength": 63,
                    "minLength": 1,
                    "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
                    "type": "string"
                  },
                  "port": {
                    "format": "int32",
                    "maximum": 65535,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "sectionName": {
                    "maxLength": 253,
                    "minLength": 1,
                    "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              },
              "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"
                },
                "maxItems": 8,
                "minItems": 1,
                "type": "array",
                "x-kubernetes-list-map-keys": [
                  "type"
                ],
                "x-kubernetes-list-type": "map"
              },
              "controllerName": {
                "maxLength": 253,
                "minLength": 1,
                "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\\/[A-Za-z0-9\\/\\-._~%!$&'()*+,;=:]+$",
                "type": "string"
              }
            },
            "required": [
              "ancestorRef",
              "conditions",
              "controllerName"
            ],
            "type": "object"
          },
          "maxItems": 16,
          "type": "array",
          "x-kubernetes-list-type": "atomic"
        }
      },
      "required": [
        "ancestors"
      ],
      "type": "object"
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}
