apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: managedclusters.cluster.open-cluster-management.io
spec:
  group: cluster.open-cluster-management.io
  names:
    kind: ManagedCluster
    listKind: ManagedClusterList
    plural: managedclusters
    singular: managedcluster
  scope: "Cluster"
  subresources:
    status: {}
  preserveUnknownFields: false
  validation:
    openAPIV3Schema:
      description: "ManagedCluster represents the desired state and current status
        of managed cluster. ManagedCluster is a cluster scoped resource. The name
        is the cluster UID. \n The cluster join process follows a double opt-in process:
        \n 1. agent on managed cluster creates CSR on hub with cluster UID and agent
        name. 2. agent on managed cluster creates ManagedCluster on hub. 3. cluster
        admin on hub approves the CSR for the ManagedCluster's UID and agent name.
        4. cluster admin sets spec.acceptClient of ManagedCluster to true. 5. cluster
        admin on managed cluster creates credential of kubeconfig to hub. \n Once
        the hub creates the cluster namespace, the Klusterlet agent on the Managed
        Cluster pushes the credential to the hub to use against the managed cluster's
        kube-apiserver."
      type: object
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More 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. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        spec:
          description: Spec represents a desired configuration for the agent on the
            managed cluster.
          type: object
          properties:
            hubAcceptsClient:
              description: hubAcceptsClient represents that hub accepts the join of
                Klusterlet agent on the managed cluster to the hub. The default value
                is false, and can only be set true when the user on hub has an RBAC
                rule to UPDATE on the virtual subresource of managedclusters/accept.
                When the value is set true, a namespace whose name is same as the
                name of ManagedCluster is created on hub representing the managed
                cluster, also role/rolebinding is created on the namespace to grant
                the permision of access from agent on managed cluster. When the value
                is set false, the namespace representing the managed cluster is deleted.
              type: boolean
            leaseDurationSeconds:
              description: LeaseDurationSeconds is used to coordinate the lease update
                time of Klusterlet agents on the managed cluster. If its value is
                zero, the Klusterlet agent will update its lease every 60s by default
              type: integer
              format: int32
            managedClusterClientConfigs:
              description: ManagedClusterClientConfigs represents a list of the apiserver
                address of the managed cluster. If it is empty, managed cluster has
                no accessible address to be visited from hub.
              type: array
              items:
                description: ClientConfig represents the apiserver address of the
                  managed cluster. TODO include credential to connect to managed cluster
                  kube-apiserver
                type: object
                properties:
                  caBundle:
                    description: CABundle is the ca bundle to connect to apiserver
                      of the managed cluster. System certs are used if it is not set.
                    type: string
                    format: byte
                  url:
                    description: URL is the url of apiserver endpoint of the managed
                      cluster.
                    type: string
        status:
          description: Status represents the current status of joined managed cluster
          type: object
          properties:
            allocatable:
              description: Allocatable represents the total allocatable resources
                on the managed cluster.
              type: object
              additionalProperties:
                type: string
            capacity:
              description: Capacity represents the total resource capacity from all
                nodeStatuses on the managed cluster.
              type: object
              additionalProperties:
                type: string
            conditions:
              description: Conditions contains the different condition statuses for
                this managed cluster.
              type: array
              items:
                description: StatusCondition contains condition information for a
                  managed cluster.
                type: object
                properties:
                  lastTransitionTime:
                    description: LastTransitionTime is the last time the condition
                      changed from one status to another.
                    type: string
                    format: date-time
                  message:
                    description: Message is a human-readable message indicating details
                      about the last status change.
                    type: string
                  reason:
                    description: Reason is a (brief) reason for the condition's last
                      status change.
                    type: string
                  status:
                    description: Status is the status of the condition. One of True,
                      False, Unknown.
                    type: string
                  type:
                    description: Type is the type of the cluster condition.
                    type: string
            version:
              description: Version represents the kubernetes version of the managed
                cluster.
              type: object
              properties:
                kubernetes:
                  description: Kubernetes is the kubernetes version of managed cluster.
                  type: string
  version: v1
  versions:
  - name: v1
    served: true
    storage: true
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []
