apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
    helm.sh/resource-policy: keep
  name: cephfilesystemsubvolumegroups.ceph.rook.io
spec:
  group: ceph.rook.io
  names:
    kind: CephFilesystemSubVolumeGroup
    listKind: CephFilesystemSubVolumeGroupList
    plural: cephfilesystemsubvolumegroups
    shortNames:
      - cephfssvg
      - cephsvg
    singular: cephfilesystemsubvolumegroup
  scope: Namespaced
  versions:
    - additionalPrinterColumns:
        - jsonPath: .status.phase
          name: Phase
          type: string
        - description: Name of the CephFileSystem
          jsonPath: .spec.filesystemName
          name: Filesystem
          type: string
        - jsonPath: .spec.quota
          name: Quota
          type: string
        - jsonPath: .status.info.pinning
          name: Pinning
          priority: 1
          type: string
        - jsonPath: .metadata.creationTimestamp
          name: Age
          type: date
      name: v1
      schema:
        openAPIV3Schema:
          description: CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
          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 the specification of a Ceph Filesystem SubVolumeGroup
              properties:
                clusterID:
                  description: |-
                    ClusterID to be used for this subvolume group in the CSI configuration.
                    It must be unique among all Ceph clusters managed by Rook.
                    If not specified, the clusterID will be generated and can be found in the CR status.
                  maxLength: 36
                  minLength: 1
                  pattern: ^[a-zA-Z0-9_-]+$
                  type: string
                  x-kubernetes-validations:
                    - message: ClusterID is immutable
                      rule: self == oldSelf
                csiMetadataRadosNamespace:
                  description: |-
                    The RADOS namespace ceph-csi uses for additional metadata it stores in the metadata pool of the CephFS.
                    If not specified the default of the ceph-csi driver is used.
                  maxLength: 1024
                  minLength: 1
                  type: string
                  x-kubernetes-validations:
                    - message: CSIMetadataRadosNamespace is immutable
                      rule: self == oldSelf
                dataPoolName:
                  description: The data pool name for the Ceph Filesystem subvolume group layout, if the default CephFS pool is not desired.
                  type: string
                filesystemName:
                  description: |-
                    FilesystemName is the name of Ceph Filesystem SubVolumeGroup volume name. Typically it's the name of
                    the CephFilesystem CR. If not coming from the CephFilesystem CR, it can be retrieved from the
                    list of Ceph Filesystem volumes with `ceph fs volume ls`. To learn more about Ceph Filesystem
                    abstractions see https://docs.ceph.com/en/latest/cephfs/fs-volumes/#fs-volumes-and-subvolumes
                  type: string
                  x-kubernetes-validations:
                    - message: filesystemName is immutable
                      rule: self == oldSelf
                name:
                  description: The name of the subvolume group. If not set, the default is the name of the subvolumeGroup CR.
                  type: string
                  x-kubernetes-validations:
                    - message: name is immutable
                      rule: self == oldSelf
                pinning:
                  description: |-
                    Pinning configuration of CephFilesystemSubVolumeGroup,
                    reference https://docs.ceph.com/en/latest/cephfs/fs-volumes/#pinning-subvolumes-and-subvolume-groups
                    only one out of (export, distributed, random) can be set at a time
                  properties:
                    distributed:
                      maximum: 1
                      minimum: 0
                      nullable: true
                      type: integer
                    export:
                      maximum: 256
                      minimum: -1
                      nullable: true
                      type: integer
                    random:
                      maximum: 1
                      minimum: 0
                      nullable: true
                      type: number
                  type: object
                  x-kubernetes-validations:
                    - message: only one pinning type should be set
                      rule: (has(self.export) && !has(self.distributed) && !has(self.random)) || (!has(self.export) && has(self.distributed) && !has(self.random)) || (!has(self.export) && !has(self.distributed) && has(self.random)) || (!has(self.export) && !has(self.distributed) && !has(self.random))
                quota:
                  anyOf:
                    - type: integer
                    - type: string
                  description: Quota size of the Ceph Filesystem subvolume group.
                  pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                  x-kubernetes-int-or-string: true
              required:
                - filesystemName
              type: object
            status:
              description: Status represents the status of a CephFilesystem SubvolumeGroup
              properties:
                info:
                  additionalProperties:
                    type: string
                  nullable: true
                  type: object
                observedGeneration:
                  description: ObservedGeneration is the latest generation observed by the controller.
                  format: int64
                  type: integer
                phase:
                  description: ConditionType represent a resource's status
                  type: string
              type: object
              x-kubernetes-preserve-unknown-fields: true
          required:
            - metadata
            - spec
          type: object
      served: true
      storage: true
      subresources:
        status: {}
