apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: masteruserrecords.toolchain.dev.openshift.com
spec:
  group: toolchain.dev.openshift.com
  names:
    kind: MasterUserRecord
    listKind: MasterUserRecordList
    plural: masteruserrecords
    shortNames:
    - mur
    singular: masteruserrecord
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .status.conditions[?(@.type=="Ready")].status
      name: Ready
      type: string
    - jsonPath: .status.conditions[?(@.type=="Ready")].reason
      name: Reason
      type: string
    - jsonPath: .spec.userAccounts[].targetCluster
      name: Cluster
      type: string
    - jsonPath: .spec.userAccounts[].spec.nsTemplateSet.tierName
      name: Tier
      type: string
    - jsonPath: .spec.banned
      name: Banned
      priority: 1
      type: string
    - jsonPath: .spec.disabled
      name: Disabled
      priority: 1
      type: string
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: MasterUserRecord keeps all information about user, user accounts
          and namespaces provisioned in CodeReady Toolchain
        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: MasterUserRecordSpec defines the desired state of MasterUserRecord
            properties:
              banned:
                description: If set to true then the corresponding user has been banned
                  from logging in and accessing their resources
                type: boolean
              deprovisioned:
                description: If set to true then the corresponding UserAccount should
                  be deleted "false" is assumed by default
                type: boolean
              disabled:
                description: If set to true then the corresponding user should not
                  be able to login (but the underlying UserAccounts still exists)
                  "false" is assumed by default
                type: boolean
              userAccounts:
                description: The list of user accounts in the member clusters which
                  belong to this MasterUserRecord
                items:
                  properties:
                    spec:
                      description: The spec of the corresponding UserAccount
                      properties:
                        nsLimit:
                          description: The namespace limit name
                          type: string
                        nsTemplateSet:
                          description: Namespace template set
                          properties:
                            clusterResources:
                              description: the cluster resources template (for cluster-wide
                                quotas, etc.)
                              properties:
                                template:
                                  description: Template contains an OpenShift Template
                                    to be used for provisioning of cluster-scoped
                                    resources
                                  type: string
                                templateRef:
                                  description: TemplateRef The name of the TierTemplate
                                    resource which exists in the host cluster and
                                    which contains the template to use
                                  type: string
                              required:
                              - templateRef
                              type: object
                            namespaces:
                              description: The namespace templates
                              items:
                                description: NSTemplateSetNamespace the namespace
                                  definition in an NSTemplateSet resource
                                properties:
                                  template:
                                    description: Optional field. Used to specify a
                                      custom template
                                    type: string
                                  templateRef:
                                    description: TemplateRef The name of the TierTemplate
                                      resource which exists in the host cluster and
                                      which contains the template to use
                                    type: string
                                required:
                                - templateRef
                                type: object
                              type: array
                              x-kubernetes-list-type: atomic
                            tierName:
                              description: The name of the tier represented by this
                                template set
                              type: string
                          required:
                          - namespaces
                          - tierName
                          type: object
                      required:
                      - nsLimit
                      - nsTemplateSet
                      type: object
                    syncIndex:
                      description: SyncIndex is to be updated by UserAccount Controller
                        when the member needs to trigger MasterUserRecord <-> UserAccount
                        synchronization
                      type: string
                    targetCluster:
                      description: The cluster in which the user exists
                      type: string
                  required:
                  - spec
                  - syncIndex
                  - targetCluster
                  type: object
                type: array
                x-kubernetes-list-map-keys:
                - targetCluster
                x-kubernetes-list-type: map
              userID:
                description: UserID is the user ID from RHD Identity Provider token
                  (“sub” claim)
                type: string
            required:
            - userID
            type: object
          status:
            description: MasterUserRecordStatus defines the observed state of MasterUserRecord
            properties:
              conditions:
                description: 'Conditions is an array of current Master User Record
                  conditions Supported condition types: Provisioning, UserAccountNotReady
                  and Ready'
                items:
                  properties:
                    lastTransitionTime:
                      description: Last time the condition transit from one status
                        to another.
                      format: date-time
                      type: string
                    lastUpdatedTime:
                      description: Last time the condition was updated
                      format: date-time
                      type: string
                    message:
                      description: Human readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: (brief) 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 of condition
                      type: string
                  required:
                  - status
                  - type
                  type: object
                type: array
                x-kubernetes-list-map-keys:
                - type
                x-kubernetes-list-type: map
              provisionedTime:
                description: The timestamp when the user was provisioned
                format: date-time
                type: string
              userAccounts:
                description: The status of user accounts in the member clusters which
                  belong to this MasterUserRecord
                items:
                  properties:
                    cluster:
                      description: Cluster is the cluster in which the user exists
                      properties:
                        apiEndpoint:
                          description: APIEndpoint is the API Endpoint of the cluster
                          type: string
                        cheDashboardURL:
                          description: CheDashboardURL is the Che Dashboard URL of
                            the cluster if Che is installed
                          type: string
                        consoleURL:
                          description: ConsoleURL is the web console URL of the cluster
                          type: string
                        name:
                          description: Name is the name of the corresponding ToolchainCluster
                            resource
                          type: string
                      required:
                      - apiEndpoint
                      - consoleURL
                      - name
                      type: object
                    conditions:
                      description: 'Conditions is an array of current User Account
                        conditions Supported condition types: ConditionReady'
                      items:
                        properties:
                          lastTransitionTime:
                            description: Last time the condition transit from one
                              status to another.
                            format: date-time
                            type: string
                          lastUpdatedTime:
                            description: Last time the condition was updated
                            format: date-time
                            type: string
                          message:
                            description: Human readable message indicating details
                              about last transition.
                            type: string
                          reason:
                            description: (brief) 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 of condition
                            type: string
                        required:
                        - status
                        - type
                        type: object
                      type: array
                      x-kubernetes-list-map-keys:
                      - type
                      x-kubernetes-list-type: map
                    syncIndex:
                      description: SyncIndex is used for checking if there is needed
                        some MasterUserRecord <-> UserAccount synchronization for
                        this specific UserAccount in the specific member cluster
                      type: string
                  required:
                  - cluster
                  - syncIndex
                  type: object
                type: array
                x-kubernetes-list-type: atomic
            type: object
        type: object
        x-kubernetes-preserve-unknown-fields: true
    served: true
    storage: true
    subresources:
      status: {}
