{
  "description": "ResourceGraphDefinition is the core API for defining reusable groups of Kubernetes resources.\nIt allows you to create custom resources that manage multiple underlying resources as a cohesive unit.\nWhen you create a ResourceGraphDefinition, kro automatically generates a CRD and deploys a controller\nto manage instances of your custom resource. Resources can reference each other using CEL expressions,\nand kro ensures they are created in the correct dependency order.",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "ResourceGraphDefinitionSpec defines the desired state of ResourceGraphDefinition.\nIt contains the schema for instances (defining the CRD structure) and the list of\nKubernetes resources that make up the graph.",
      "properties": {
        "resources": {
          "description": "Resources is the list of Kubernetes resources that will be created and managed\nfor each instance. Resources can reference each other using CEL expressions,\ncreating a dependency graph that determines creation order.",
          "items": {
            "description": "Resource represents a Kubernetes resource that is part of the ResourceGraphDefinition.\nEach resource can either be created using a template or reference an existing resource.\nResources can depend on each other through CEL expressions, creating a dependency graph.",
            "properties": {
              "externalRef": {
                "description": "ExternalRef references an existing resource in the cluster instead of creating one.\nThis is useful for reading existing resources and using their values in other resources.\nExactly one of template or externalRef must be provided.",
                "properties": {
                  "apiVersion": {
                    "description": "APIVersion is the API version of the external resource.\nExample: \"v1\" for core resources, \"apps/v1\" for Deployments.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "Kind is the kind of the external resource.\nExample: \"Service\", \"ConfigMap\", \"Deployment\".",
                    "type": "string"
                  },
                  "metadata": {
                    "description": "Metadata contains the name and optional namespace of the external resource.",
                    "properties": {
                      "name": {
                        "description": "Name is the name of the external resource to reference.\nThis field is required.",
                        "type": "string"
                      },
                      "namespace": {
                        "description": "Namespace is the namespace of the external resource.\nIf empty, the instance's namespace will be used.",
                        "type": "string"
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "type": "object",
                    "additionalProperties": false
                  }
                },
                "required": [
                  "apiVersion",
                  "kind",
                  "metadata"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "forEach": {
                "description": "ForEach expands this resource into a collection of resources.\nEach entry binds a variable name to a CEL expression that evaluates to an array.\nkro creates one resource instance for each element in the array.\nWith multiple entries, kro creates the cartesian product of all combinations.\nUse the variable directly in template expressions (e.g., ${region}).\nExample: [{\"region\": \"${schema.spec.regions}\"}, {\"tier\": \"${schema.spec.tiers}\"}]",
                "items": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "description": "ForEachDimension defines a single expansion axis in a forEach block.\nEach dimension is a map with exactly one entry where the key is the variable name\nand the value is the CEL expression. Example: {\"region\": \"${schema.spec.regions}\"}\nMultiple dimensions create a cartesian product of expansions.",
                  "maxProperties": 1,
                  "minProperties": 1,
                  "type": "object"
                },
                "type": "array"
              },
              "id": {
                "description": "ID is a unique identifier for this resource within the ResourceGraphDefinition.\nIt is used to reference this resource in CEL expressions from other resources.\nExample: \"deployment\", \"service\", \"configmap\".",
                "type": "string"
              },
              "includeWhen": {
                "description": "IncludeWhen is a list of CEL expressions that determine whether this resource should be created.\nAll expressions must evaluate to true for the resource to be included.\nIf not specified, the resource is always included.\nExample: [\"schema.spec.enableMonitoring == true\"]",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "readyWhen": {
                "description": "ReadyWhen is a list of CEL expressions that determine when this resource is considered ready.\nAll expressions must evaluate to true for the resource to be ready.\nIf not specified, the resource is considered ready when it exists.\nExample: [\"self.status.phase == 'Running'\", \"self.status.readyReplicas > 0\"]",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "template": {
                "description": "Template is the Kubernetes resource manifest to create.\nIt can contain CEL expressions (using ${...} syntax) that reference other resources.\nExactly one of template or externalRef must be provided.",
                "type": "object",
                "x-kubernetes-preserve-unknown-fields": true
              }
            },
            "required": [
              "id"
            ],
            "type": "object",
            "x-kubernetes-validations": [
              {
                "message": "exactly one of template or externalRef must be provided",
                "rule": "(has(self.template) && !has(self.externalRef)) || (!has(self.template) && has(self.externalRef))"
              }
            ],
            "additionalProperties": false
          },
          "type": "array"
        },
        "schema": {
          "description": "Schema defines the structure of instances created from this ResourceGraphDefinition.\nIt specifies the API version, kind, and fields (spec/status) for the generated CRD.\nUse SimpleSchema syntax to define the instance schema concisely.",
          "properties": {
            "additionalPrinterColumns": {
              "description": "AdditionalPrinterColumns defines additional printer columns\nthat will be passed down to the created CRD. If set, no\ndefault printer columns will be added to the created CRD,\nand if default printer columns need to be retained, they\nneed to be added explicitly.",
              "items": {
                "description": "CustomResourceColumnDefinition specifies a column for server side printing.",
                "properties": {
                  "description": {
                    "description": "description is a human readable description of this column.",
                    "type": "string"
                  },
                  "format": {
                    "description": "format is an optional OpenAPI type definition for this column. The 'name' format is applied\nto the primary identifier column to assist in clients identifying column is the resource name.\nSee https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details.",
                    "type": "string"
                  },
                  "jsonPath": {
                    "description": "jsonPath is a simple JSON path (i.e. with array notation) which is evaluated against\neach custom resource to produce the value for this column.",
                    "type": "string"
                  },
                  "name": {
                    "description": "name is a human readable name for the column.",
                    "type": "string"
                  },
                  "priority": {
                    "description": "priority is an integer defining the relative importance of this column compared to others. Lower\nnumbers are considered higher priority. Columns that may be omitted in limited space scenarios\nshould be given a priority greater than 0.",
                    "format": "int32",
                    "type": "integer"
                  },
                  "type": {
                    "description": "type is an OpenAPI type definition for this column.\nSee https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details.",
                    "type": "string"
                  }
                },
                "required": [
                  "jsonPath",
                  "name",
                  "type"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "apiVersion": {
              "description": "APIVersion is the version identifier for the generated CRD.\nMust follow Kubernetes versioning conventions (v1, v1alpha1, v1beta1, etc.).\nThis field is immutable after creation.\nExample: \"v1alpha1\", \"v1\", \"v2beta1\"",
              "pattern": "^v[0-9]+(alpha[0-9]+|beta[0-9]+)?$",
              "type": "string",
              "x-kubernetes-validations": [
                {
                  "message": "apiVersion is immutable",
                  "rule": "self == oldSelf"
                }
              ]
            },
            "group": {
              "default": "kro.run",
              "description": "Group is the API group for the generated CRD. Together with APIVersion and Kind,\nit forms the complete GVK (Group-Version-Kind) identifier.\nIf omitted, defaults to \"kro.run\". This field is immutable after creation.\nExample: \"mycompany.io\", \"databases.example.com\"",
              "type": "string",
              "x-kubernetes-validations": [
                {
                  "message": "group is immutable",
                  "rule": "self == oldSelf"
                }
              ]
            },
            "kind": {
              "description": "Kind is the name of the custom resource type that will be created.\nThis becomes the kind field of the generated CRD and must be a valid Kubernetes kind name\n(PascalCase, starting with a capital letter). This field is immutable after creation.\nExample: \"WebApplication\", \"Database\", \"MicroService\"",
              "pattern": "^[A-Z][a-zA-Z0-9]{0,62}$",
              "type": "string",
              "x-kubernetes-validations": [
                {
                  "message": "kind is immutable",
                  "rule": "self == oldSelf"
                }
              ]
            },
            "metadata": {
              "description": "Metadata to apply to the generated CRD",
              "properties": {
                "annotations": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "description": "Annotations to apply to the generated CRD",
                  "type": "object"
                },
                "labels": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "description": "Labels to apply to the generated CRD",
                  "type": "object"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "spec": {
              "description": "Spec defines the schema for the instance's spec section using SimpleSchema syntax.\nThis becomes the OpenAPI schema for instances of the generated CRD.\nUse SimpleSchema's concise syntax to define fields, types, defaults, and validations.\nExample: {\"replicas\": \"integer | default=1 | min=1 | max=10\"}",
              "type": "object",
              "x-kubernetes-preserve-unknown-fields": true
            },
            "status": {
              "description": "Status defines the schema for the instance's status section using SimpleSchema syntax.\nUnlike spec, status fields use CEL expressions to project values from underlying resources.\nThis allows you to surface important information from managed resources at the instance level.\nExample: {\"connectionName\": \"${database.status.connectionName}\", \"endpoint\": \"${service.status.loadBalancer.ingress[0].hostname}\"}",
              "type": "object",
              "x-kubernetes-preserve-unknown-fields": true
            },
            "types": {
              "description": "Types is a map of custom type definitions that can be referenced in the Spec.\nThis allows you to define reusable complex types using SimpleSchema syntax.\nReference custom types in Spec using the type name.\nExample: {\"Server\": {\"host\": \"string\", \"port\": \"integer\"}}",
              "type": "object",
              "x-kubernetes-preserve-unknown-fields": true
            }
          },
          "required": [
            "apiVersion",
            "kind"
          ],
          "type": "object",
          "additionalProperties": false
        }
      },
      "required": [
        "schema"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "ResourceGraphDefinitionStatus defines the observed state of ResourceGraphDefinition.\nIt provides information about the deployment state, resource ordering, and conditions.",
      "properties": {
        "conditions": {
          "description": "Conditions represent the latest available observations of the ResourceGraphDefinition's state.\nCommon condition types include \"Ready\", \"Validated\", and \"ReconcilerDeployed\".",
          "items": {
            "description": "Condition is the common struct used by all CRDs managed by ACK service\ncontrollers to indicate terminal states  of the CR and its backend AWS\nservice API resource",
            "properties": {
              "lastTransitionTime": {
                "description": "Last time the condition transitioned from one status to another.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "A human-readable message indicating details about the transition.",
                "type": "string"
              },
              "observedGeneration": {
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "minimum": 0,
                "type": "integer"
              },
              "reason": {
                "description": "The reason for the condition's last transition.",
                "type": "string"
              },
              "status": {
                "description": "Status of the condition, one of True, False, Unknown.",
                "type": "string"
              },
              "type": {
                "description": "Type is the type of the Condition",
                "type": "string"
              }
            },
            "required": [
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "resources": {
          "description": "Resources provides detailed information about each resource in the graph,\nincluding their dependencies.",
          "items": {
            "description": "ResourceInformation provides detailed information about a specific resource\nin the ResourceGraphDefinition, particularly its dependencies on other resources.",
            "properties": {
              "dependencies": {
                "description": "Dependencies lists all resources that this resource depends on.\nA resource depends on another if it references it in a CEL expression.\nThese dependencies determine the order of resource creation.",
                "items": {
                  "description": "Dependency represents a dependency relationship between resources.\nWhen a resource uses CEL expressions to reference another resource,\na dependency is created to ensure proper ordering.",
                  "properties": {
                    "id": {
                      "description": "ID is the unique identifier of the resource that this resource depends on.",
                      "type": "string"
                    }
                  },
                  "type": "object",
                  "additionalProperties": false
                },
                "type": "array"
              },
              "id": {
                "description": "ID is the unique identifier of the resource as defined in the resources list.",
                "type": "string"
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "state": {
          "description": "State indicates whether the ResourceGraphDefinition is Active or Inactive.\nActive means the CRD has been created and the controller is running.\nInactive means the ResourceGraphDefinition has been disabled or encountered an error.",
          "type": "string"
        },
        "topologicalOrder": {
          "description": "TopologicalOrder is the ordered list of resource IDs based on their dependencies.\nResources are created in this order to ensure dependencies are satisfied.\nExample: [\"configmap\", \"deployment\", \"service\"]",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
