# ClawManager cluster deployment bundle.
# Includes Longhorn v1.12.0 from:
# https://raw.githubusercontent.com/longhorn/longhorn/v1.12.0/deploy/longhorn.yaml
#
# Apply this file on a clean Kubernetes cluster:
#   kubectl apply -f <this-file>
#
# Notes:
# - Longhorn RWX volumes require NFSv4 client support on all workload nodes.
#   Install nfs-common on Ubuntu/Debian or nfs-utils on RHEL-compatible systems.
# - ClawManager uses StorageClass longhorn for RWO data and longhorn-rwx for workspace RWX data.
---
# Builtin: "helm template" does not respect --create-namespace
apiVersion: v1
kind: Namespace
metadata:
  name: longhorn-system
---
# Source: longhorn/templates/priorityclass.yaml
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: "longhorn-critical"
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
description: "Ensure Longhorn pods have the highest priority to prevent any unexpected eviction by the Kubernetes scheduler under node pressure"
globalDefault: false
preemptionPolicy: PreemptLowerPriority
value: 1000000000
---
# Source: longhorn/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: longhorn-service-account
  namespace: longhorn-system
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
---
# Source: longhorn/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: longhorn-ui-service-account
  namespace: longhorn-system
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
---
# Source: longhorn/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: longhorn-support-bundle
  namespace: longhorn-system
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
---
# Source: longhorn/templates/default-resource.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: longhorn-default-resource
  namespace: longhorn-system
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
data:
  default-resource.yaml: |-
---
# Source: longhorn/templates/default-setting.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: longhorn-default-setting
  namespace: longhorn-system
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
data:
  default-setting.yaml: |-
    priority-class: "longhorn-critical"
    disable-revision-counter: "{\"v1\":\"true\"}"
---
# Source: longhorn/templates/storageclass.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: longhorn-storageclass
  namespace: longhorn-system
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
data:
  storageclass.yaml: |
    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: longhorn
      annotations:
        storageclass.kubernetes.io/is-default-class: "true"
    provisioner: driver.longhorn.io
    allowVolumeExpansion: true
    reclaimPolicy: "Delete"
    volumeBindingMode: Immediate
    parameters:
      numberOfReplicas: "3"
      staleReplicaTimeout: "30"
      fromBackup: ""
      fsType: "ext4"
      dataLocality: "disabled"
      unmapMarkSnapChainRemoved: "ignored"
      disableRevisionCounter: "true"
      dataEngine: "v1"
      backupTargetName: "default"
---
# Source: longhorn/templates/crds.yaml
# Generated crds.yaml from github.com/longhorn/longhorn-manager/k8s/pkg/apis and the crds.yaml will be copied to longhorn/longhorn chart/templates and cannot be directly used by kubectl apply.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: backingimagedatasources.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: BackingImageDataSource
    listKind: BackingImageDataSourceList
    plural: backingimagedatasources
    shortNames:
    - lhbids
    singular: backingimagedatasource
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The system generated UUID of the provisioned backing image file
      jsonPath: .spec.uuid
      name: UUID
      type: string
    - description: The current state of the pod used to provision the backing image
        file from source
      jsonPath: .status.currentState
      name: State
      type: string
    - description: The data source type
      jsonPath: .spec.sourceType
      name: SourceType
      type: string
    - description: The backing image file size
      jsonPath: .status.size
      name: Size
      type: string
    - description: The node the backing image file will be prepared on
      jsonPath: .spec.nodeID
      name: Node
      type: string
    - description: The disk the backing image file will be prepared on
      jsonPath: .spec.diskUUID
      name: DiskUUID
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: BackingImageDataSource is where Longhorn stores backing image
          data source 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: BackingImageDataSourceSpec defines the desired state of the
              Longhorn backing image data source
            properties:
              checksum:
                type: string
              diskPath:
                type: string
              diskUUID:
                type: string
              fileTransferred:
                type: boolean
              nodeID:
                type: string
              parameters:
                additionalProperties:
                  type: string
                type: object
              sourceType:
                enum:
                - download
                - upload
                - export-from-volume
                - restore
                - clone
                type: string
              uuid:
                type: string
            type: object
          status:
            description: BackingImageDataSourceStatus defines the observed state of
              the Longhorn backing image data source
            properties:
              checksum:
                type: string
              currentState:
                type: string
              ip:
                type: string
              message:
                type: string
              ownerID:
                type: string
              progress:
                type: integer
              runningParameters:
                additionalProperties:
                  type: string
                nullable: true
                type: object
              size:
                format: int64
                type: integer
              storageIP:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: backingimagemanagers.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: BackingImageManager
    listKind: BackingImageManagerList
    plural: backingimagemanagers
    shortNames:
    - lhbim
    singular: backingimagemanager
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The current state of the manager
      jsonPath: .status.currentState
      name: State
      type: string
    - description: The image the manager pod will use
      jsonPath: .spec.image
      name: Image
      type: string
    - description: The node the manager is on
      jsonPath: .spec.nodeID
      name: Node
      type: string
    - description: The disk the manager is responsible for
      jsonPath: .spec.diskUUID
      name: DiskUUID
      type: string
    - description: The disk path the manager is using
      jsonPath: .spec.diskPath
      name: DiskPath
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: BackingImageManager is where Longhorn stores backing image manager
          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: BackingImageManagerSpec defines the desired state of the
              Longhorn backing image manager
            properties:
              backingImages:
                additionalProperties:
                  type: string
                type: object
              diskPath:
                type: string
              diskUUID:
                type: string
              image:
                type: string
              nodeID:
                type: string
            type: object
          status:
            description: BackingImageManagerStatus defines the observed state of the
              Longhorn backing image manager
            properties:
              apiMinVersion:
                type: integer
              apiVersion:
                type: integer
              backingImageFileMap:
                additionalProperties:
                  properties:
                    currentChecksum:
                      type: string
                    message:
                      type: string
                    name:
                      type: string
                    progress:
                      type: integer
                    realSize:
                      format: int64
                      type: integer
                    senderManagerAddress:
                      type: string
                    sendingReference:
                      type: integer
                    size:
                      format: int64
                      type: integer
                    state:
                      type: string
                    uuid:
                      type: string
                    virtualSize:
                      format: int64
                      type: integer
                  type: object
                nullable: true
                type: object
              currentState:
                type: string
              ip:
                type: string
              ownerID:
                type: string
              storageIP:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: backingimages.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: BackingImage
    listKind: BackingImageList
    plural: backingimages
    shortNames:
    - lhbi
    singular: backingimage
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The system generated UUID
      jsonPath: .status.uuid
      name: UUID
      type: string
    - description: The source of the backing image file data
      jsonPath: .spec.sourceType
      name: SourceType
      type: string
    - description: The backing image file size in each disk
      jsonPath: .status.size
      name: Size
      type: string
    - description: The virtual size of the image (may be larger than file size)
      jsonPath: .status.virtualSize
      name: VirtualSize
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: BackingImage is where Longhorn stores backing image 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: BackingImageSpec defines the desired state of the Longhorn
              backing image
            properties:
              checksum:
                type: string
              dataEngine:
                default: v1
                enum:
                - v1
                - v2
                type: string
              diskFileSpecMap:
                additionalProperties:
                  properties:
                    dataEngine:
                      enum:
                      - v1
                      - v2
                      type: string
                    evictionRequested:
                      type: boolean
                  type: object
                type: object
              diskSelector:
                items:
                  type: string
                type: array
              disks:
                additionalProperties:
                  type: string
                description: Deprecated. We are now using DiskFileSpecMap to assign
                  different spec to the file on different disks.
                type: object
              minNumberOfCopies:
                type: integer
              nodeSelector:
                items:
                  type: string
                type: array
              secret:
                type: string
              secretNamespace:
                type: string
              sourceParameters:
                additionalProperties:
                  type: string
                type: object
              sourceType:
                enum:
                - download
                - upload
                - export-from-volume
                - restore
                - clone
                type: string
            type: object
          status:
            description: BackingImageStatus defines the observed state of the Longhorn
              backing image status
            properties:
              checksum:
                type: string
              diskFileStatusMap:
                additionalProperties:
                  properties:
                    dataEngine:
                      enum:
                      - v1
                      - v2
                      type: string
                    lastStateTransitionTime:
                      type: string
                    message:
                      type: string
                    progress:
                      type: integer
                    state:
                      type: string
                  type: object
                nullable: true
                type: object
              diskLastRefAtMap:
                additionalProperties:
                  type: string
                nullable: true
                type: object
              ownerID:
                type: string
              realSize:
                description: Real size of image in bytes, which may be smaller than
                  the size when the file is a sparse file. Will be zero until known
                  (e.g. while a backing image is uploading)
                format: int64
                type: integer
              size:
                format: int64
                type: integer
              uuid:
                type: string
              v2FirstCopyDisk:
                type: string
              v2FirstCopyStatus:
                description: It is pending -> in-progress -> ready/failed
                type: string
              virtualSize:
                description: Virtual size of image in bytes, which may be larger than
                  physical size. Will be zero until known (e.g. while a backing image
                  is uploading)
                format: int64
                type: integer
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: backupbackingimages.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: BackupBackingImage
    listKind: BackupBackingImageList
    plural: backupbackingimages
    shortNames:
    - lhbbi
    singular: backupbackingimage
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The backing image name
      jsonPath: .status.backingImage
      name: BackingImage
      type: string
    - description: The backing image size
      jsonPath: .status.size
      name: Size
      type: string
    - description: The backing image backup upload finished time
      jsonPath: .status.backupCreatedAt
      name: BackupCreatedAt
      type: string
    - description: The backing image backup state
      jsonPath: .status.state
      name: State
      type: string
    - description: The last synced time
      jsonPath: .status.lastSyncedAt
      name: LastSyncedAt
      type: string
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: BackupBackingImage is where Longhorn stores backing image backup
          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: BackupBackingImageSpec defines the desired state of the Longhorn
              backing image backup
            properties:
              backingImage:
                description: The backing image name.
                type: string
              backupTargetName:
                description: The backup target name.
                nullable: true
                type: string
              labels:
                additionalProperties:
                  type: string
                description: The labels of backing image backup.
                type: object
              syncRequestedAt:
                description: The time to request run sync the remote backing image
                  backup.
                format: date-time
                nullable: true
                type: string
              userCreated:
                description: Is this CR created by user through API or UI.
                type: boolean
            required:
            - backingImage
            - userCreated
            type: object
          status:
            description: BackupBackingImageStatus defines the observed state of the
              Longhorn backing image backup
            properties:
              backingImage:
                description: The backing image name.
                type: string
              backupCreatedAt:
                description: The backing image backup upload finished time.
                type: string
              checksum:
                description: The checksum of the backing image.
                type: string
              compressionMethod:
                description: Compression method
                type: string
              error:
                description: The error message when taking the backing image backup.
                type: string
              labels:
                additionalProperties:
                  type: string
                description: The labels of backing image backup.
                nullable: true
                type: object
              lastSyncedAt:
                description: The last time that the backing image backup was synced
                  with the remote backup target.
                format: date-time
                nullable: true
                type: string
              managerAddress:
                description: The address of the backing image manager that runs backing
                  image backup.
                type: string
              messages:
                additionalProperties:
                  type: string
                description: The error messages when listing or inspecting backing
                  image backup.
                nullable: true
                type: object
              ownerID:
                description: The node ID on which the controller is responsible to
                  reconcile this CR.
                type: string
              progress:
                description: The backing image backup progress.
                type: integer
              secret:
                description: Record the secret if this backup backing image is encrypted
                type: string
              secretNamespace:
                description: Record the secret namespace if this backup backing image
                  is encrypted
                type: string
              size:
                description: The backing image size.
                format: int64
                type: integer
              state:
                description: |-
                  The backing image backup creation state.
                  Can be "", "InProgress", "Completed", "Error", "Unknown".
                type: string
              url:
                description: The backing image backup URL.
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: backups.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: Backup
    listKind: BackupList
    plural: backups
    shortNames:
    - lhb
    singular: backup
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The snapshot name
      jsonPath: .status.snapshotName
      name: SnapshotName
      type: string
    - description: The snapshot size
      jsonPath: .status.size
      name: SnapshotSize
      type: string
    - description: The snapshot creation time
      jsonPath: .status.snapshotCreatedAt
      name: SnapshotCreatedAt
      type: string
    - description: The backup target name
      jsonPath: .status.backupTargetName
      name: BackupTarget
      type: string
    - description: The backup state
      jsonPath: .status.state
      name: State
      type: string
    - description: The backup last synced time
      jsonPath: .status.lastSyncedAt
      name: LastSyncedAt
      type: string
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: Backup is where Longhorn stores backup 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: BackupSpec defines the desired state of the Longhorn backup
            properties:
              backupBlockSize:
                description: The backup block size. 0 means the legacy default size
                  2MiB, and -1 indicate the block size is invalid.
                enum:
                - "-1"
                - "2097152"
                - "16777216"
                format: int64
                type: string
              backupMode:
                description: |-
                  The backup mode of this backup.
                  Can be "full" or "incremental"
                enum:
                - full
                - incremental
                type: string
              labels:
                additionalProperties:
                  type: string
                description: The labels of snapshot backup.
                type: object
              snapshotName:
                description: The snapshot name.
                type: string
              syncRequestedAt:
                description: The time to request run sync the remote backup.
                format: date-time
                nullable: true
                type: string
            type: object
          status:
            description: BackupStatus defines the observed state of the Longhorn backup
            properties:
              backupCreatedAt:
                description: The snapshot backup upload finished time.
                type: string
              backupTargetName:
                description: The backup target name.
                type: string
              compressionMethod:
                description: Compression method
                type: string
              error:
                description: The error message when taking the snapshot backup.
                type: string
              labels:
                additionalProperties:
                  type: string
                description: The labels of snapshot backup.
                nullable: true
                type: object
              lastSyncedAt:
                description: The last time that the backup was synced with the remote
                  backup target.
                format: date-time
                nullable: true
                type: string
              messages:
                additionalProperties:
                  type: string
                description: The error messages when calling longhorn engine on listing
                  or inspecting backups.
                nullable: true
                type: object
              newlyUploadDataSize:
                description: Size in bytes of newly uploaded data
                type: string
              ownerID:
                description: The node ID on which the controller is responsible to
                  reconcile this backup CR.
                type: string
              progress:
                description: The snapshot backup progress.
                type: integer
              reUploadedDataSize:
                description: Size in bytes of reuploaded data
                type: string
              replicaAddress:
                description: The address of the replica that runs snapshot backup.
                type: string
              size:
                description: The snapshot size.
                type: string
              snapshotCreatedAt:
                description: The snapshot creation time.
                type: string
              snapshotName:
                description: The snapshot name.
                type: string
              state:
                description: |-
                  The backup creation state.
                  Can be "", "InProgress", "Completed", "Error", "Unknown".
                type: string
              url:
                description: The snapshot backup URL.
                type: string
              volumeBackingImageName:
                description: The volume's backing image name.
                type: string
              volumeCreated:
                description: The volume creation time.
                type: string
              volumeName:
                description: The volume name.
                type: string
              volumeSize:
                description: The volume size.
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: backuptargets.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: BackupTarget
    listKind: BackupTargetList
    plural: backuptargets
    shortNames:
    - lhbt
    singular: backuptarget
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The backup target URL
      jsonPath: .spec.backupTargetURL
      name: URL
      type: string
    - description: The backup target credential secret
      jsonPath: .spec.credentialSecret
      name: Credential
      type: string
    - description: The backup target poll interval
      jsonPath: .spec.pollInterval
      name: LastBackupAt
      type: string
    - description: Indicate whether the backup target is available or not
      jsonPath: .status.available
      name: Available
      type: boolean
    - description: The backup target last synced time
      jsonPath: .status.lastSyncedAt
      name: LastSyncedAt
      type: string
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: BackupTarget is where Longhorn stores backup target 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: BackupTargetSpec defines the desired state of the Longhorn
              backup target
            properties:
              backupTargetURL:
                description: The backup target URL.
                type: string
              credentialSecret:
                description: The backup target credential secret.
                type: string
              pollInterval:
                description: The interval that the cluster needs to run sync with
                  the backup target.
                type: string
              syncRequestedAt:
                description: The time to request run sync the remote backup target.
                format: date-time
                nullable: true
                type: string
            type: object
          status:
            description: BackupTargetStatus defines the observed state of the Longhorn
              backup target
            properties:
              available:
                description: Available indicates if the remote backup target is available
                  or not.
                type: boolean
              conditions:
                description: Records the reason on why the backup target is unavailable.
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              lastSyncedAt:
                description: The last time that the controller synced with the remote
                  backup target.
                format: date-time
                nullable: true
                type: string
              ownerID:
                description: The node ID on which the controller is responsible to
                  reconcile this backup target CR.
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: backupvolumes.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: BackupVolume
    listKind: BackupVolumeList
    plural: backupvolumes
    shortNames:
    - lhbv
    singular: backupvolume
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The backup target name
      jsonPath: .spec.backupTargetName
      name: BackupTarget
      type: string
    - description: The backup volume creation time
      jsonPath: .status.createdAt
      name: CreatedAt
      type: string
    - description: The backup volume last backup name
      jsonPath: .status.lastBackupName
      name: LastBackupName
      type: string
    - description: The backup volume last backup time
      jsonPath: .status.lastBackupAt
      name: LastBackupAt
      type: string
    - description: The backup volume last synced time
      jsonPath: .status.lastSyncedAt
      name: LastSyncedAt
      type: string
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: BackupVolume is where Longhorn stores backup volume 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: BackupVolumeSpec defines the desired state of the Longhorn
              backup volume
            properties:
              backupTargetName:
                description: The backup target name that the backup volume was synced.
                nullable: true
                type: string
              syncRequestedAt:
                description: The time to request run sync the remote backup volume.
                format: date-time
                nullable: true
                type: string
              volumeName:
                description: The volume name that the backup volume was used to backup.
                type: string
            type: object
          status:
            description: BackupVolumeStatus defines the observed state of the Longhorn
              backup volume
            properties:
              backingImageChecksum:
                description: the backing image checksum.
                type: string
              backingImageName:
                description: The backing image name.
                type: string
              createdAt:
                description: The backup volume creation time.
                type: string
              dataStored:
                description: The backup volume block count.
                type: string
              labels:
                additionalProperties:
                  type: string
                description: The backup volume labels.
                nullable: true
                type: object
              lastBackupAt:
                description: The latest volume backup time.
                type: string
              lastBackupName:
                description: The latest volume backup name.
                type: string
              lastModificationTime:
                description: The backup volume config last modification time.
                format: date-time
                nullable: true
                type: string
              lastSyncedAt:
                description: The last time that the backup volume was synced into
                  the cluster.
                format: date-time
                nullable: true
                type: string
              messages:
                additionalProperties:
                  type: string
                description: The error messages when call longhorn engine on list
                  or inspect backup volumes.
                nullable: true
                type: object
              ownerID:
                description: The node ID on which the controller is responsible to
                  reconcile this backup volume CR.
                type: string
              size:
                description: The backup volume size.
                type: string
              storageClassName:
                description: the storage class name of pv/pvc binding with the volume.
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: enginefrontends.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: EngineFrontend
    listKind: EngineFrontendList
    plural: enginefrontends
    shortNames:
    - lhef
    singular: enginefrontend
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The data engine of the engine frontend
      jsonPath: .spec.dataEngine
      name: Data Engine
      type: string
    - description: The current state of the engine frontend
      jsonPath: .status.currentState
      name: State
      type: string
    - description: The node that the engine frontend is on
      jsonPath: .spec.nodeID
      name: Node
      type: string
    - description: The instance manager of the engine frontend
      jsonPath: .status.instanceManagerName
      name: InstanceManager
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: EngineFrontend is where Longhorn stores engine frontend object
          for v2 data engine initiator.
        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: EngineFrontendSpec defines the desired state of the Longhorn
              engine frontend (v2 initiator)
            properties:
              active:
                type: boolean
              dataEngine:
                enum:
                - v1
                - v2
                type: string
              desireState:
                type: string
              disableFrontend:
                type: boolean
              engineName:
                description: EngineName is the name of the v2 engine target (required
                  for EngineFrontend instance creation)
                type: string
              frontend:
                enum:
                - blockdev
                - iscsi
                - nvmf
                - ublk
                - ""
                type: string
              image:
                type: string
              logRequested:
                type: boolean
              nodeID:
                type: string
              salvageRequested:
                type: boolean
              size:
                description: |-
                  Size is the desired size of the frontend device in bytes, as requested
                  by the volume owner. The EngineFrontend controller drives the frontend
                  device toward this size independently of the engine's target size.
                format: int64
                type: string
              targetIP:
                description: TargetIP is the IP address of the v2 engine target
                type: string
              targetPort:
                description: TargetPort is the port of the v2 engine target
                type: integer
              ublkNumberOfQueue:
                description: ublkNumberOfQueue controls the number of queues for ublk
                  frontend.
                type: integer
              ublkQueueDepth:
                description: ublkQueueDepth controls the depth of each queue for ublk
                  frontend.
                type: integer
              volumeName:
                type: string
              volumeSize:
                format: int64
                type: string
            type: object
          status:
            description: EngineFrontendStatus defines the observed state of the Longhorn
              engine frontend
            properties:
              activePath:
                description: ActivePath is the currently active frontend path address.
                type: string
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              currentImage:
                type: string
              currentSize:
                description: |-
                  CurrentSize is the current size of the frontend device in bytes, as
                  observed from the data plane. It is 0 while the engine frontend is not
                  running.
                format: int64
                type: string
              currentState:
                type: string
              endpoint:
                description: Endpoint is the initiator endpoint (e.g., /dev/longhorn/vol-name)
                type: string
              instanceManagerName:
                type: string
              ip:
                type: string
              logFetched:
                type: boolean
              ownerID:
                type: string
              paths:
                description: Paths describes the currently known frontend multipath
                  state.
                items:
                  properties:
                    anaState:
                      type: string
                    engineName:
                      type: string
                    nguid:
                      type: string
                    nqn:
                      type: string
                    targetIP:
                      type: string
                    targetPort:
                      type: integer
                  type: object
                type: array
              port:
                type: integer
              preferredPath:
                description: PreferredPath is the preferred frontend path address.
                type: string
              salvageExecuted:
                type: boolean
              started:
                type: boolean
              starting:
                type: boolean
              storageIP:
                type: string
              switchoverPhase:
                description: SwitchoverPhase is the last completed switchover phase
                  reported by the data plane.
                type: string
              targetIP:
                description: TargetIP is the currently connected IP address of the
                  v2 engine target
                type: string
              targetPort:
                description: TargetPort is the currently connected port of the v2
                  engine target
                type: integer
              ublkID:
                format: int32
                type: integer
              uuid:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: engineimages.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: EngineImage
    listKind: EngineImageList
    plural: engineimages
    shortNames:
    - lhei
    singular: engineimage
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: Compatibility of the engine image
      jsonPath: .status.incompatible
      name: Incompatible
      type: boolean
    - description: State of the engine image
      jsonPath: .status.state
      name: State
      type: string
    - description: The Longhorn engine image
      jsonPath: .spec.image
      name: Image
      type: string
    - description: Number of resources using the engine image
      jsonPath: .status.refCount
      name: RefCount
      type: integer
    - description: The build date of the engine image
      jsonPath: .status.buildDate
      name: BuildDate
      type: date
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: EngineImage is where Longhorn stores engine image 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: EngineImageSpec defines the desired state of the Longhorn
              engine image
            properties:
              image:
                minLength: 1
                type: string
            required:
            - image
            type: object
          status:
            description: EngineImageStatus defines the observed state of the Longhorn
              engine image
            properties:
              buildDate:
                type: string
              cliAPIMinVersion:
                type: integer
              cliAPIVersion:
                type: integer
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              controllerAPIMinVersion:
                type: integer
              controllerAPIVersion:
                type: integer
              dataFormatMinVersion:
                type: integer
              dataFormatVersion:
                type: integer
              gitCommit:
                type: string
              incompatible:
                type: boolean
              noRefSince:
                type: string
              nodeDeploymentMap:
                additionalProperties:
                  type: boolean
                nullable: true
                type: object
              ownerID:
                type: string
              refCount:
                type: integer
              state:
                type: string
              version:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: engines.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: Engine
    listKind: EngineList
    plural: engines
    shortNames:
    - lhe
    singular: engine
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The data engine of the engine
      jsonPath: .spec.dataEngine
      name: Data Engine
      type: string
    - description: The current state of the engine
      jsonPath: .status.currentState
      name: State
      type: string
    - description: The node that the engine is on
      jsonPath: .spec.nodeID
      name: Node
      type: string
    - description: The instance manager of the engine
      jsonPath: .status.instanceManagerName
      name: InstanceManager
      type: string
    - description: The current image of the engine
      jsonPath: .status.currentImage
      name: Image
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: Engine is where Longhorn stores engine 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: EngineSpec defines the desired state of the Longhorn engine
            properties:
              active:
                type: boolean
              backupVolume:
                type: string
              dataEngine:
                enum:
                - v1
                - v2
                type: string
              desireState:
                type: string
              disableFrontend:
                type: boolean
              frontend:
                enum:
                - blockdev
                - iscsi
                - nvmf
                - ublk
                - ""
                type: string
              image:
                type: string
              logRequested:
                type: boolean
              nodeID:
                type: string
              rebuildConcurrentSyncLimit:
                description: |-
                  RebuildConcurrentSyncLimit controls the maximum number of file synchronization operations that can run
                  concurrently during a single replica rebuild.
                  It is determined by the global setting or the volume spec field with the same name.
                maximum: 5
                minimum: 0
                type: integer
              replicaAddressMap:
                additionalProperties:
                  type: string
                type: object
              requestedBackupRestore:
                type: string
              requestedDataSource:
                type: string
              revisionCounterDisabled:
                type: boolean
              salvageRequested:
                type: boolean
              snapshotMaxCount:
                type: integer
              snapshotMaxSize:
                format: int64
                type: string
              ublkNumberOfQueue:
                description: ublkNumberOfQueue controls the number of queues for ublk
                  frontend.
                type: integer
              ublkQueueDepth:
                description: ublkQueueDepth controls the depth of each queue for ublk
                  frontend.
                type: integer
              unmapMarkSnapChainRemovedEnabled:
                type: boolean
              upgradedReplicaAddressMap:
                additionalProperties:
                  type: string
                type: object
              volumeName:
                type: string
              volumeSize:
                format: int64
                type: string
            type: object
          status:
            description: EngineStatus defines the observed state of the Longhorn engine
            properties:
              backupStatus:
                additionalProperties:
                  properties:
                    backupURL:
                      type: string
                    error:
                      type: string
                    progress:
                      type: integer
                    replicaAddress:
                      type: string
                    snapshotName:
                      type: string
                    state:
                      type: string
                  type: object
                nullable: true
                type: object
              cloneStatus:
                additionalProperties:
                  properties:
                    error:
                      type: string
                    fromReplicaAddress:
                      type: string
                    isCloning:
                      type: boolean
                    progress:
                      type: integer
                    snapshotName:
                      type: string
                    state:
                      type: string
                  type: object
                nullable: true
                type: object
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              currentImage:
                type: string
              currentReplicaAddressMap:
                additionalProperties:
                  type: string
                nullable: true
                type: object
              currentSize:
                format: int64
                type: string
              currentState:
                type: string
              endpoint:
                type: string
              instanceManagerName:
                type: string
              ip:
                type: string
              isExpanding:
                type: boolean
              lastExpansionError:
                type: string
              lastExpansionFailedAt:
                type: string
              lastRestoredBackup:
                type: string
              logFetched:
                type: boolean
              ownerID:
                type: string
              port:
                type: integer
              purgeStatus:
                additionalProperties:
                  properties:
                    error:
                      type: string
                    isPurging:
                      type: boolean
                    progress:
                      type: integer
                    state:
                      type: string
                  type: object
                nullable: true
                type: object
              rebuildConcurrentSyncLimit:
                description: |-
                  RebuildConcurrentSyncLimit controls the maximum number of file synchronization operations that can run
                  concurrently during a single replica rebuild.
                  It is determined by the global setting or the volume spec field with the same name.
                minimum: 0
                type: integer
              rebuildStatus:
                additionalProperties:
                  properties:
                    appliedRebuildingMBps:
                      format: int64
                      type: integer
                    error:
                      type: string
                    fromReplicaAddress:
                      description: Deprecated. We are now using FromReplicaAddressList
                        to list all source replicas.
                      type: string
                    fromReplicaAddressList:
                      items:
                        type: string
                      type: array
                    isRebuilding:
                      type: boolean
                    progress:
                      type: integer
                    state:
                      type: string
                  type: object
                nullable: true
                type: object
              replicaModeMap:
                additionalProperties:
                  type: string
                nullable: true
                type: object
              replicaTransitionTimeMap:
                additionalProperties:
                  type: string
                description: |-
                  ReplicaTransitionTimeMap records the time a replica in ReplicaModeMap transitions from one mode to another (or
                  from not being in the ReplicaModeMap to being in it). This information is sometimes required by other controllers
                  (e.g. the volume controller uses it to determine the correct value for replica.Spec.lastHealthyAt).
                type: object
              restoreStatus:
                additionalProperties:
                  properties:
                    backupURL:
                      type: string
                    currentRestoringBackup:
                      type: string
                    error:
                      type: string
                    filename:
                      type: string
                    isRestoring:
                      type: boolean
                    lastRestored:
                      type: string
                    progress:
                      type: integer
                    state:
                      type: string
                  type: object
                nullable: true
                type: object
              salvageExecuted:
                type: boolean
              snapshotMaxCount:
                type: integer
              snapshotMaxSize:
                format: int64
                type: string
              snapshots:
                additionalProperties:
                  properties:
                    children:
                      additionalProperties:
                        type: boolean
                      nullable: true
                      type: object
                    created:
                      type: string
                    labels:
                      additionalProperties:
                        type: string
                      nullable: true
                      type: object
                    name:
                      type: string
                    parent:
                      type: string
                    removed:
                      type: boolean
                    size:
                      type: string
                    usercreated:
                      type: boolean
                  type: object
                nullable: true
                type: object
              snapshotsError:
                type: string
              started:
                type: boolean
              starting:
                type: boolean
              storageIP:
                type: string
              ublkID:
                format: int32
                type: integer
              unmapMarkSnapChainRemovedEnabled:
                type: boolean
              uuid:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: instancemanagers.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: InstanceManager
    listKind: InstanceManagerList
    plural: instancemanagers
    shortNames:
    - lhim
    singular: instancemanager
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The data engine of the instance manager
      jsonPath: .spec.dataEngine
      name: Data Engine
      type: string
    - description: The state of the instance manager
      jsonPath: .status.currentState
      name: State
      type: string
    - description: The type of the instance manager (engine or replica)
      jsonPath: .spec.type
      name: Type
      type: string
    - description: The node that the instance manager is running on
      jsonPath: .spec.nodeID
      name: Node
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: InstanceManager is where Longhorn stores instance manager 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: InstanceManagerSpec defines the desired state of the Longhorn
              instance manager
            properties:
              dataEngine:
                type: string
              dataEngineSpec:
                properties:
                  v2:
                    properties:
                      cpuMask:
                        type: string
                    type: object
                type: object
              image:
                type: string
              nodeID:
                type: string
              type:
                enum:
                - aio
                - engine
                - replica
                type: string
            type: object
          status:
            description: InstanceManagerStatus defines the observed state of the Longhorn
              instance manager
            properties:
              apiMinVersion:
                type: integer
              apiVersion:
                type: integer
              backingImages:
                additionalProperties:
                  properties:
                    currentChecksum:
                      type: string
                    diskUUID:
                      type: string
                    message:
                      type: string
                    name:
                      type: string
                    progress:
                      type: integer
                    size:
                      format: int64
                      type: integer
                    state:
                      type: string
                    uuid:
                      type: string
                  type: object
                nullable: true
                type: object
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              currentState:
                type: string
              dataEngineStatus:
                properties:
                  v2:
                    properties:
                      cpuMask:
                        type: string
                      interruptModeEnabled:
                        description: |-
                          InterruptModeEnabled indicates whether the V2 data engine is running in
                          interrupt mode (true) or polling mode (false). Set by Longhorn manager;
                          read-only to users.
                        enum:
                        - ""
                        - "true"
                        - "false"
                        type: string
                    type: object
                type: object
              instanceEngineFrontends:
                additionalProperties:
                  properties:
                    spec:
                      properties:
                        dataEngine:
                          type: string
                        name:
                          type: string
                      type: object
                    status:
                      properties:
                        activePath:
                          type: string
                        conditions:
                          additionalProperties:
                            type: boolean
                          nullable: true
                          type: object
                        endpoint:
                          type: string
                        errorMsg:
                          type: string
                        frontend:
                          type: string
                        listen:
                          type: string
                        paths:
                          items:
                            properties:
                              anaState:
                                type: string
                              engineName:
                                type: string
                              nguid:
                                type: string
                              nqn:
                                type: string
                              targetIP:
                                type: string
                              targetPort:
                                type: integer
                            type: object
                          type: array
                        portEnd:
                          format: int32
                          type: integer
                        portStart:
                          format: int32
                          type: integer
                        preferredPath:
                          type: string
                        resourceVersion:
                          format: int64
                          type: integer
                        state:
                          type: string
                        targetPortEnd:
                          format: int32
                          type: integer
                        targetPortStart:
                          format: int32
                          type: integer
                        type:
                          type: string
                        ublkID:
                          format: int32
                          type: integer
                        uuid:
                          type: string
                      type: object
                  type: object
                nullable: true
                type: object
              instanceEngines:
                additionalProperties:
                  properties:
                    spec:
                      properties:
                        dataEngine:
                          type: string
                        name:
                          type: string
                      type: object
                    status:
                      properties:
                        activePath:
                          type: string
                        conditions:
                          additionalProperties:
                            type: boolean
                          nullable: true
                          type: object
                        endpoint:
                          type: string
                        errorMsg:
                          type: string
                        frontend:
                          type: string
                        listen:
                          type: string
                        paths:
                          items:
                            properties:
                              anaState:
                                type: string
                              engineName:
                                type: string
                              nguid:
                                type: string
                              nqn:
                                type: string
                              targetIP:
                                type: string
                              targetPort:
                                type: integer
                            type: object
                          type: array
                        portEnd:
                          format: int32
                          type: integer
                        portStart:
                          format: int32
                          type: integer
                        preferredPath:
                          type: string
                        resourceVersion:
                          format: int64
                          type: integer
                        state:
                          type: string
                        targetPortEnd:
                          format: int32
                          type: integer
                        targetPortStart:
                          format: int32
                          type: integer
                        type:
                          type: string
                        ublkID:
                          format: int32
                          type: integer
                        uuid:
                          type: string
                      type: object
                  type: object
                nullable: true
                type: object
              instanceReplicas:
                additionalProperties:
                  properties:
                    spec:
                      properties:
                        dataEngine:
                          type: string
                        name:
                          type: string
                      type: object
                    status:
                      properties:
                        activePath:
                          type: string
                        conditions:
                          additionalProperties:
                            type: boolean
                          nullable: true
                          type: object
                        endpoint:
                          type: string
                        errorMsg:
                          type: string
                        frontend:
                          type: string
                        listen:
                          type: string
                        paths:
                          items:
                            properties:
                              anaState:
                                type: string
                              engineName:
                                type: string
                              nguid:
                                type: string
                              nqn:
                                type: string
                              targetIP:
                                type: string
                              targetPort:
                                type: integer
                            type: object
                          type: array
                        portEnd:
                          format: int32
                          type: integer
                        portStart:
                          format: int32
                          type: integer
                        preferredPath:
                          type: string
                        resourceVersion:
                          format: int64
                          type: integer
                        state:
                          type: string
                        targetPortEnd:
                          format: int32
                          type: integer
                        targetPortStart:
                          format: int32
                          type: integer
                        type:
                          type: string
                        ublkID:
                          format: int32
                          type: integer
                        uuid:
                          type: string
                      type: object
                  type: object
                nullable: true
                type: object
              ip:
                type: string
              ownerID:
                type: string
              proxyApiMinVersion:
                type: integer
              proxyApiVersion:
                type: integer
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: nodes.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: Node
    listKind: NodeList
    plural: nodes
    shortNames:
    - lhn
    singular: node
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: Indicate whether the node is ready
      jsonPath: .status.conditions[?(@.type=='Ready')].status
      name: Ready
      type: string
    - description: Indicate whether the user disabled/enabled replica scheduling for
        the node
      jsonPath: .spec.allowScheduling
      name: AllowScheduling
      type: boolean
    - description: Indicate whether Longhorn can schedule replicas on the node
      jsonPath: .status.conditions[?(@.type=='Schedulable')].status
      name: Schedulable
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: Node is where Longhorn stores Longhorn node 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: NodeSpec defines the desired state of the Longhorn node
            properties:
              allowScheduling:
                type: boolean
              disks:
                additionalProperties:
                  properties:
                    allowScheduling:
                      type: boolean
                    diskDriver:
                      enum:
                      - ""
                      - auto
                      - aio
                      - nvme
                      type: string
                    diskType:
                      enum:
                      - filesystem
                      - block
                      type: string
                    evictionRequested:
                      type: boolean
                    path:
                      type: string
                    storageReserved:
                      format: int64
                      type: integer
                    tags:
                      items:
                        type: string
                      type: array
                  type: object
                type: object
              evictionRequested:
                type: boolean
              instanceManagerCPURequest:
                type: integer
              name:
                type: string
              tags:
                items:
                  type: string
                type: array
            type: object
          status:
            description: NodeStatus defines the observed state of the Longhorn node
            properties:
              autoEvicting:
                type: boolean
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              diskStatus:
                additionalProperties:
                  properties:
                    conditions:
                      items:
                        properties:
                          lastProbeTime:
                            description: Last time we probed the condition.
                            type: string
                          lastTransitionTime:
                            description: Last time the condition transitioned from
                              one status to another.
                            type: string
                          message:
                            description: Human-readable message indicating details
                              about last transition.
                            type: string
                          reason:
                            description: Unique, one-word, CamelCase reason for the
                              condition's last transition.
                            type: string
                          status:
                            description: |-
                              Status is the status of the condition.
                              Can be True, False, Unknown.
                            type: string
                          type:
                            description: Type is the type of the condition.
                            type: string
                        type: object
                      nullable: true
                      type: array
                    diskDriver:
                      type: string
                    diskName:
                      type: string
                    diskPath:
                      type: string
                    diskType:
                      type: string
                    diskUUID:
                      type: string
                    filesystemType:
                      type: string
                    healthData:
                      additionalProperties:
                        properties:
                          attributes:
                            items:
                              properties:
                                id:
                                  type: integer
                                name:
                                  type: string
                                rawString:
                                  type: string
                                rawValue:
                                  format: int64
                                  type: integer
                                threshold:
                                  type: integer
                                value:
                                  type: integer
                                whenFailed:
                                  type: string
                                worst:
                                  type: integer
                              type: object
                            type: array
                          capacity:
                            format: int64
                            type: integer
                          diskName:
                            type: string
                          diskType:
                            type: string
                          firmwareVersion:
                            type: string
                          healthStatus:
                            enum:
                            - FAILED
                            - PASSED
                            - UNKNOWN
                            - WARNING
                            type: string
                          modelName:
                            type: string
                          serialNumber:
                            type: string
                          source:
                            enum:
                            - SMART
                            - SPDK
                            type: string
                          temperature:
                            type: integer
                        type: object
                      type: object
                    healthDataLastCollectedAt:
                      format: date-time
                      type: string
                    instanceManagerName:
                      type: string
                    scheduledBackingImage:
                      additionalProperties:
                        format: int64
                        type: integer
                      nullable: true
                      type: object
                    scheduledReplica:
                      additionalProperties:
                        format: int64
                        type: integer
                      nullable: true
                      type: object
                    storageAvailable:
                      format: int64
                      type: integer
                    storageMaximum:
                      format: int64
                      type: integer
                    storageScheduled:
                      format: int64
                      type: integer
                  type: object
                nullable: true
                type: object
              region:
                type: string
              snapshotCheckStatus:
                properties:
                  lastPeriodicCheckedAt:
                    format: date-time
                    type: string
                type: object
              zone:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: orphans.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: Orphan
    listKind: OrphanList
    plural: orphans
    shortNames:
    - lho
    singular: orphan
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The type of the orphan
      jsonPath: .spec.orphanType
      name: Type
      type: string
    - description: The node that the orphan is on
      jsonPath: .spec.nodeID
      name: Node
      type: string
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: Orphan is where Longhorn stores orphan 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: OrphanSpec defines the desired state of the Longhorn orphaned
              data
            properties:
              dataEngine:
                description: |-
                  The type of data engine for instance orphan.
                  Can be "v1", "v2".
                enum:
                - v1
                - v2
                type: string
              nodeID:
                description: The node ID on which the controller is responsible to
                  reconcile this orphan CR.
                type: string
              orphanType:
                description: |-
                  The type of the orphaned data.
                  Can be "replica".
                type: string
              parameters:
                additionalProperties:
                  type: string
                description: The parameters of the orphaned data
                type: object
            type: object
          status:
            description: OrphanStatus defines the observed state of the Longhorn orphaned
              data
            properties:
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              ownerID:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: recurringjobs.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: RecurringJob
    listKind: RecurringJobList
    plural: recurringjobs
    shortNames:
    - lhrj
    singular: recurringjob
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: Sets groupings to the jobs. When set to "default" group will be
        added to the volume label when no other job label exist in volume
      jsonPath: .spec.groups
      name: Groups
      type: string
    - description: Should be one of "snapshot", "snapshot-force-create", "snapshot-cleanup",
        "snapshot-delete", "backup", "backup-force-create", "filesystem-trim" or "system-backup"
      jsonPath: .spec.task
      name: Task
      type: string
    - description: The cron expression represents recurring job scheduling
      jsonPath: .spec.cron
      name: Cron
      type: string
    - description: The number of snapshots/backups to keep for the volume
      jsonPath: .spec.retain
      name: Retain
      type: integer
    - description: The concurrent job to run by each cron job
      jsonPath: .spec.concurrency
      name: Concurrency
      type: integer
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    - description: Specify the labels
      jsonPath: .spec.labels
      name: Labels
      type: string
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: RecurringJob is where Longhorn stores recurring job 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: RecurringJobSpec defines the desired state of the Longhorn
              recurring job
            properties:
              concurrency:
                description: The concurrency of taking the snapshot/backup.
                type: integer
              cron:
                description: The cron setting.
                type: string
              groups:
                description: The recurring job group.
                items:
                  type: string
                type: array
              labels:
                additionalProperties:
                  type: string
                description: The label of the snapshot/backup.
                type: object
              name:
                description: The recurring job name.
                type: string
              parameters:
                additionalProperties:
                  type: string
                description: |-
                  The parameters of the snapshot/backup.
                  Support parameters: "full-backup-interval", "volume-backup-policy".
                type: object
              retain:
                description: The retain count of the snapshot/backup.
                type: integer
              task:
                description: |-
                  The recurring job task.
                  Can be "snapshot", "snapshot-force-create", "snapshot-cleanup", "snapshot-delete", "backup", "backup-force-create", "filesystem-trim" or "system-backup".
                enum:
                - snapshot
                - snapshot-force-create
                - snapshot-cleanup
                - snapshot-delete
                - backup
                - backup-force-create
                - filesystem-trim
                - system-backup
                type: string
            type: object
          status:
            description: RecurringJobStatus defines the observed state of the Longhorn
              recurring job
            properties:
              executionCount:
                description: The number of jobs that have been triggered.
                type: integer
              ownerID:
                description: The owner ID which is responsible to reconcile this recurring
                  job CR.
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: replicas.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: Replica
    listKind: ReplicaList
    plural: replicas
    shortNames:
    - lhr
    singular: replica
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The data engine of the replica
      jsonPath: .spec.dataEngine
      name: Data Engine
      type: string
    - description: The current state of the replica
      jsonPath: .status.currentState
      name: State
      type: string
    - description: The node that the replica is on
      jsonPath: .spec.nodeID
      name: Node
      type: string
    - description: The disk that the replica is on
      jsonPath: .spec.diskID
      name: Disk
      type: string
    - description: The instance manager of the replica
      jsonPath: .status.instanceManagerName
      name: InstanceManager
      type: string
    - description: The current image of the replica
      jsonPath: .status.currentImage
      name: Image
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: Replica is where Longhorn stores replica 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: ReplicaSpec defines the desired state of the Longhorn replica
            properties:
              active:
                type: boolean
              backingImage:
                type: string
              dataDirectoryName:
                type: string
              dataEngine:
                enum:
                - v1
                - v2
                type: string
              desireState:
                type: string
              diskID:
                type: string
              diskPath:
                type: string
              engineName:
                type: string
              evictionRequested:
                type: boolean
              failedAt:
                description: |-
                  FailedAt is set when a running replica fails or when a running engine is unable to use a replica for any reason.
                  FailedAt indicates the time the failure occurred. When FailedAt is set, a replica is likely to have useful
                  (though possibly stale) data. A replica with FailedAt set must be rebuilt from a non-failed replica (or it can
                  be used in a salvage if all replicas are failed). FailedAt is cleared before a rebuild or salvage. FailedAt may
                  be later than the corresponding entry in an engine's replicaTransitionTimeMap because it is set when the volume
                  controller acknowledges the change.
                type: string
              hardNodeAffinity:
                type: string
              healthyAt:
                description: |-
                  HealthyAt is set the first time a replica becomes read/write in an engine after creation or rebuild. HealthyAt
                  indicates the time the last successful rebuild occurred. When HealthyAt is set, a replica is likely to have
                  useful (though possibly stale) data. HealthyAt is cleared before a rebuild. HealthyAt may be later than the
                  corresponding entry in an engine's replicaTransitionTimeMap because it is set when the volume controller
                  acknowledges the change.
                type: string
              image:
                type: string
              lastFailedAt:
                description: |-
                  LastFailedAt is always set at the same time as FailedAt. Unlike FailedAt, LastFailedAt is never cleared.
                  LastFailedAt is not a reliable indicator of the state of a replica's data. For example, a replica with
                  LastFailedAt may already be healthy and in use again. However, because it is never cleared, it can be compared to
                  LastHealthyAt to help prevent dangerous replica deletion in some corner cases. LastFailedAt may be later than the
                  corresponding entry in an engine's replicaTransitionTimeMap because it is set when the volume controller
                  acknowledges the change.
                type: string
              lastHealthyAt:
                description: |-
                  LastHealthyAt is set every time a replica becomes read/write in an engine. Unlike HealthyAt, LastHealthyAt is
                  never cleared. LastHealthyAt is not a reliable indicator of the state of a replica's data. For example, a
                  replica with LastHealthyAt set may be in the middle of a rebuild. However, because it is never cleared, it can be
                  compared to LastFailedAt to help prevent dangerous replica deletion in some corner cases. LastHealthyAt may be
                  later than the corresponding entry in an engine's replicaTransitionTimeMap because it is set when the volume
                  controller acknowledges the change.
                type: string
              logRequested:
                type: boolean
              migrationEngineName:
                description: |-
                  MigrationEngineName is indicating the migrating engine which current connected to this replica. This is only
                  used for live migration of v2 data engine
                type: string
              nodeID:
                type: string
              rebuildRetryCount:
                type: integer
              revisionCounterDisabled:
                type: boolean
              salvageRequested:
                type: boolean
              snapshotMaxCount:
                type: integer
              snapshotMaxSize:
                format: int64
                type: string
              unmapMarkDiskChainRemovedEnabled:
                type: boolean
              volumeName:
                type: string
              volumeSize:
                format: int64
                type: string
            type: object
          status:
            description: ReplicaStatus defines the observed state of the Longhorn
              replica
            properties:
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              currentImage:
                type: string
              currentState:
                type: string
              instanceManagerName:
                type: string
              ip:
                type: string
              logFetched:
                type: boolean
              ownerID:
                type: string
              port:
                type: integer
              salvageExecuted:
                type: boolean
              started:
                type: boolean
              starting:
                type: boolean
              storageIP:
                type: string
              ublkID:
                format: int32
                type: integer
              uuid:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: settings.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: Setting
    listKind: SettingList
    plural: settings
    shortNames:
    - lhs
    singular: setting
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The value of the setting
      jsonPath: .value
      name: Value
      type: string
    - description: The setting is applied
      jsonPath: .status.applied
      name: Applied
      type: boolean
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: Setting is where Longhorn stores setting 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
          status:
            description: The status of the setting.
            properties:
              applied:
                description: The setting is applied.
                type: boolean
            required:
            - applied
            type: object
          value:
            description: |-
              The value of the setting.
              - It can be a non-JSON formatted string that is applied to all the applicable data engines listed in the setting definition.
              - It can be a JSON formatted string that contains values for applicable data engines listed in the setting definition's Default.
            type: string
        required:
        - value
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: sharemanagers.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: ShareManager
    listKind: ShareManagerList
    plural: sharemanagers
    shortNames:
    - lhsm
    singular: sharemanager
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The state of the share manager
      jsonPath: .status.state
      name: State
      type: string
    - description: The node that the share manager is owned by
      jsonPath: .status.ownerID
      name: Node
      type: string
    - description: The current image of the share manager
      jsonPath: .status.currentImage
      name: Image
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: ShareManager is where Longhorn stores share manager 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: ShareManagerSpec defines the desired state of the Longhorn
              share manager
            properties:
              image:
                description: Share manager image used for creating a share manager
                  pod
                type: string
            type: object
          status:
            description: ShareManagerStatus defines the observed state of the Longhorn
              share manager
            properties:
              currentImage:
                description: The image currently used by the share manager pod
                type: string
              endpoint:
                description: NFS endpoint that can access the mounted filesystem of
                  the volume
                type: string
              ownerID:
                description: The node ID on which the controller is responsible to
                  reconcile this share manager resource
                type: string
              state:
                description: The state of the share manager resource
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: snapshots.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: Snapshot
    listKind: SnapshotList
    plural: snapshots
    shortNames:
    - lhsnap
    singular: snapshot
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The volume that this snapshot belongs to
      jsonPath: .spec.volume
      name: Volume
      type: string
    - description: Timestamp when the point-in-time snapshot was taken
      jsonPath: .status.creationTime
      name: CreationTime
      type: string
    - description: Indicates if the snapshot is ready to be used to restore/backup
        a volume
      jsonPath: .status.readyToUse
      name: ReadyToUse
      type: boolean
    - description: Represents the minimum size of volume required to rehydrate from
        this snapshot
      jsonPath: .status.restoreSize
      name: RestoreSize
      type: string
    - description: The actual size of the snapshot
      jsonPath: .status.size
      name: Size
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: Snapshot is the Schema for the snapshots API
        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: SnapshotSpec defines the desired state of Longhorn Snapshot
            properties:
              createSnapshot:
                description: require creating a new snapshot
                type: boolean
              labels:
                additionalProperties:
                  type: string
                description: The labels of snapshot
                nullable: true
                type: object
              volume:
                description: |-
                  the volume that this snapshot belongs to.
                  This field is immutable after creation.
                type: string
            required:
            - volume
            type: object
          status:
            description: SnapshotStatus defines the observed state of Longhorn Snapshot
            properties:
              checksum:
                type: string
              checksumCalculatedAt:
                description: |-
                  ChecksumCalculatedAt is the RFC3339 timestamp indicating when the checksum
                  for this snapshot was last calculated or updated.
                type: string
              children:
                additionalProperties:
                  type: boolean
                nullable: true
                type: object
              creationTime:
                type: string
              error:
                type: string
              labels:
                additionalProperties:
                  type: string
                nullable: true
                type: object
              markRemoved:
                type: boolean
              ownerID:
                type: string
              parent:
                type: string
              readyToUse:
                type: boolean
              requestedTime:
                type: string
              restoreSize:
                format: int64
                type: integer
              size:
                format: int64
                type: integer
              userCreated:
                type: boolean
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: supportbundles.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: SupportBundle
    listKind: SupportBundleList
    plural: supportbundles
    shortNames:
    - lhbundle
    singular: supportbundle
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The state of the support bundle
      jsonPath: .status.state
      name: State
      type: string
    - description: The issue URL
      jsonPath: .spec.issueURL
      name: Issue
      type: string
    - description: A brief description of the issue
      jsonPath: .spec.description
      name: Description
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: SupportBundle is where Longhorn stores support bundle 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: SupportBundleSpec defines the desired state of the Longhorn
              SupportBundle
            properties:
              description:
                description: A brief description of the issue
                type: string
              issueURL:
                description: The issue URL
                nullable: true
                type: string
              nodeID:
                description: The preferred responsible controller node ID.
                type: string
            required:
            - description
            type: object
          status:
            description: SupportBundleStatus defines the observed state of the Longhorn
              SupportBundle
            properties:
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                type: array
              filename:
                type: string
              filesize:
                format: int64
                type: integer
              image:
                description: The support bundle manager image
                type: string
              managerIP:
                description: The support bundle manager IP
                type: string
              ownerID:
                description: The current responsible controller node ID
                type: string
              progress:
                type: integer
              state:
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: systembackups.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: SystemBackup
    listKind: SystemBackupList
    plural: systembackups
    shortNames:
    - lhsb
    singular: systembackup
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The system backup Longhorn version
      jsonPath: .status.version
      name: Version
      type: string
    - description: The system backup state
      jsonPath: .status.state
      name: State
      type: string
    - description: The system backup creation time
      jsonPath: .status.createdAt
      name: Created
      type: string
    - description: The last time that the system backup was synced into the cluster
      jsonPath: .status.lastSyncedAt
      name: LastSyncedAt
      type: string
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: SystemBackup is where Longhorn stores system backup 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: SystemBackupSpec defines the desired state of the Longhorn
              SystemBackup
            properties:
              volumeBackupPolicy:
                description: |-
                  The create volume backup policy
                  Can be "if-not-present", "always" or "disabled"
                nullable: true
                type: string
            type: object
          status:
            description: SystemBackupStatus defines the observed state of the Longhorn
              SystemBackup
            properties:
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              createdAt:
                description: The system backup creation time.
                format: date-time
                type: string
              gitCommit:
                description: The saved Longhorn manager git commit.
                nullable: true
                type: string
              lastSyncedAt:
                description: The last time that the system backup was synced into
                  the cluster.
                format: date-time
                nullable: true
                type: string
              managerImage:
                description: The saved manager image.
                type: string
              ownerID:
                description: The node ID of the responsible controller to reconcile
                  this SystemBackup.
                type: string
              state:
                description: The system backup state.
                type: string
              version:
                description: The saved Longhorn version.
                nullable: true
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: systemrestores.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: SystemRestore
    listKind: SystemRestoreList
    plural: systemrestores
    shortNames:
    - lhsr
    singular: systemrestore
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The system restore state
      jsonPath: .status.state
      name: State
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: SystemRestore is where Longhorn stores system restore 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: SystemRestoreSpec defines the desired state of the Longhorn
              SystemRestore
            properties:
              systemBackup:
                description: The system backup name in the object store.
                type: string
            required:
            - systemBackup
            type: object
          status:
            description: SystemRestoreStatus defines the observed state of the Longhorn
              SystemRestore
            properties:
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              ownerID:
                description: The node ID of the responsible controller to reconcile
                  this SystemRestore.
                type: string
              sourceURL:
                description: The source system backup URL.
                type: string
              state:
                description: The system restore state.
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: volumeattachments.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: VolumeAttachment
    listKind: VolumeAttachmentList
    plural: volumeattachments
    shortNames:
    - lhva
    singular: volumeattachment
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: VolumeAttachment stores attachment information of a Longhorn
          volume
        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: VolumeAttachmentSpec defines the desired state of Longhorn
              VolumeAttachment
            properties:
              attachmentTickets:
                additionalProperties:
                  properties:
                    generation:
                      description: |-
                        A sequence number representing a specific generation of the desired state.
                        Populated by the system. Read-only.
                      format: int64
                      type: integer
                    id:
                      description: The unique ID of this attachment. Used to differentiate
                        different attachments of the same volume.
                      type: string
                    nodeID:
                      description: The node that this attachment is requesting
                      type: string
                    parameters:
                      additionalProperties:
                        type: string
                      description: Optional additional parameter for this attachment
                      type: object
                    type:
                      type: string
                  type: object
                type: object
              volume:
                description: The name of Longhorn volume of this VolumeAttachment
                type: string
            required:
            - volume
            type: object
          status:
            description: VolumeAttachmentStatus defines the observed state of Longhorn
              VolumeAttachment
            properties:
              attachmentTicketStatuses:
                additionalProperties:
                  properties:
                    conditions:
                      description: Record any error when trying to fulfill this attachment
                      items:
                        properties:
                          lastProbeTime:
                            description: Last time we probed the condition.
                            type: string
                          lastTransitionTime:
                            description: Last time the condition transitioned from
                              one status to another.
                            type: string
                          message:
                            description: Human-readable message indicating details
                              about last transition.
                            type: string
                          reason:
                            description: Unique, one-word, CamelCase reason for the
                              condition's last transition.
                            type: string
                          status:
                            description: |-
                              Status is the status of the condition.
                              Can be True, False, Unknown.
                            type: string
                          type:
                            description: Type is the type of the condition.
                            type: string
                        type: object
                      nullable: true
                      type: array
                    generation:
                      description: |-
                        A sequence number representing a specific generation of the desired state.
                        Populated by the system. Read-only.
                      format: int64
                      type: integer
                    id:
                      description: The unique ID of this attachment. Used to differentiate
                        different attachments of the same volume.
                      type: string
                    satisfied:
                      description: Indicate whether this attachment ticket has been
                        satisfied
                      type: boolean
                  required:
                  - conditions
                  - satisfied
                  type: object
                type: object
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/crds.yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    longhorn-manager: ""
  name: volumes.longhorn.io
spec:
  group: longhorn.io
  names:
    kind: Volume
    listKind: VolumeList
    plural: volumes
    shortNames:
    - lhv
    singular: volume
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - description: The data engine of the volume
      jsonPath: .spec.dataEngine
      name: Data Engine
      type: string
    - description: The state of the volume
      jsonPath: .status.state
      name: State
      type: string
    - description: The robustness of the volume
      jsonPath: .status.robustness
      name: Robustness
      type: string
    - description: The scheduled condition of the volume
      jsonPath: .status.conditions[?(@.type=='Schedulable')].status
      name: Scheduled
      type: string
    - description: The size of the volume
      jsonPath: .spec.size
      name: Size
      type: string
    - description: The node that the volume is currently attaching to
      jsonPath: .status.currentNodeID
      name: Node
      type: string
    - description: The engine switchover state
      jsonPath: .status.switchoverState
      name: Switchover
      priority: 1
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        description: Volume is where Longhorn stores volume 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: VolumeSpec defines the desired state of the Longhorn volume
            properties:
              Standby:
                type: boolean
              accessMode:
                enum:
                - rwo
                - rwop
                - rwx
                type: string
              backingImage:
                type: string
                x-kubernetes-validations:
                - message: BackingImage is immutable
                  rule: self == oldSelf
              backupBlockSize:
                description: BackupBlockSize indicate the block size to create backups.
                  The block size is immutable.
                enum:
                - "2097152"
                - "16777216"
                format: int64
                type: string
              backupCompressionMethod:
                enum:
                - none
                - lz4
                - gzip
                type: string
              backupTargetName:
                description: The backup target name that the volume will be backed
                  up to or is synced.
                type: string
              cloneMode:
                enum:
                - ""
                - full-copy
                - linked-clone
                type: string
              dataEngine:
                enum:
                - v1
                - v2
                type: string
              dataLocality:
                enum:
                - disabled
                - best-effort
                - strict-local
                type: string
              dataSource:
                type: string
              disableFrontend:
                type: boolean
              diskSelector:
                items:
                  type: string
                type: array
              encrypted:
                type: boolean
                x-kubernetes-validations:
                - message: Encrypted is immutable
                  rule: self == oldSelf
              engineNodeID:
                description: |-
                  engineNodeID defines the node where the backend engine (target) runs.
                  If empty, falls back to NodeID.
                type: string
              freezeFilesystemForSnapshot:
                description: Setting that freezes the filesystem on the root partition
                  before a snapshot is created.
                enum:
                - ignored
                - enabled
                - disabled
                type: string
              fromBackup:
                type: string
              frontend:
                enum:
                - blockdev
                - iscsi
                - nvmf
                - ublk
                - ""
                type: string
              image:
                type: string
              lastAttachedBy:
                type: string
              migratable:
                type: boolean
              migrationNodeID:
                type: string
              nodeID:
                description: nodeID defines the node where the volume is attached
                  (where the frontend initiator runs).
                type: string
              nodeSelector:
                items:
                  type: string
                type: array
              numberOfReplicas:
                type: integer
              offlineRebuilding:
                description: |-
                  Specifies whether Longhorn should rebuild replicas while the detached volume is degraded.
                  - ignored: Use the global setting for offline replica rebuilding.
                  - enabled: Enable offline rebuilding for this volume, regardless of the global setting.
                  - disabled: Disable offline rebuilding for this volume, regardless of the global setting
                enum:
                - ignored
                - disabled
                - enabled
                type: string
              rebuildConcurrentSyncLimit:
                description: |-
                  RebuildConcurrentSyncLimit controls the maximum number of file synchronization operations that can run
                  concurrently during a single replica rebuild.
                  When set to 0, it means following the global setting.
                maximum: 5
                minimum: 0
                type: integer
              replicaAutoBalance:
                enum:
                - ignored
                - disabled
                - least-effort
                - best-effort
                type: string
              replicaDiskSoftAntiAffinity:
                description: Replica disk soft anti affinity of the volume. Set enabled
                  to allow replicas to be scheduled in the same disk.
                enum:
                - ignored
                - enabled
                - disabled
                type: string
              replicaRebuildingBandwidthLimit:
                description: ReplicaRebuildingBandwidthLimit controls the maximum
                  write bandwidth (in megabytes per second) allowed on the destination
                  replica during the rebuilding process. Set this value to 0 to disable
                  bandwidth limiting.
                format: int64
                minimum: 0
                type: integer
              replicaSoftAntiAffinity:
                description: Replica soft anti affinity of the volume. Set enabled
                  to allow replicas to be scheduled on the same node.
                enum:
                - ignored
                - enabled
                - disabled
                type: string
              replicaZoneSoftAntiAffinity:
                description: Replica zone soft anti affinity of the volume. Set enabled
                  to allow replicas to be scheduled in the same zone.
                enum:
                - ignored
                - enabled
                - disabled
                type: string
              restoreVolumeRecurringJob:
                enum:
                - ignored
                - enabled
                - disabled
                type: string
              revisionCounterDisabled:
                type: boolean
              size:
                format: int64
                type: string
              snapshotDataIntegrity:
                enum:
                - ignored
                - disabled
                - enabled
                - fast-check
                type: string
              snapshotHashingRequestedAt:
                description: |-
                  SnapshotHashingRequestedAt is the RFC3339 timestamp (e.g., "2026-03-16T10:30:00Z") when an on-demand snapshot checksum calculation is requested.
                  When this value is set and is later than LastOnDemandSnapshotHashingCompleteAt, the system will calculate checksums
                  for all user snapshots.

                  If SnapshotHashingRequestedAt differs from LastOnDemandSnapshotHashingCompleteAt, it indicates that a hashing request
                  is still in progress, and a new request will be rejected.
                type: string
              snapshotMaxCount:
                type: integer
              snapshotMaxSize:
                format: int64
                type: string
              staleReplicaTimeout:
                type: integer
              ublkNumberOfQueue:
                description: ublkNumberOfQueue controls the number of queues for ublk
                  frontend.
                type: integer
              ublkQueueDepth:
                description: ublkQueueDepth controls the depth of each queue for ublk
                  frontend.
                type: integer
              unmapMarkSnapChainRemoved:
                enum:
                - ignored
                - disabled
                - enabled
                type: string
            type: object
          status:
            description: VolumeStatus defines the observed state of the Longhorn volume
            properties:
              actualSize:
                format: int64
                type: integer
              cloneStatus:
                properties:
                  attemptCount:
                    type: integer
                  nextAllowedAttemptAt:
                    type: string
                  snapshot:
                    type: string
                  sourceVolume:
                    type: string
                  state:
                    type: string
                type: object
              conditions:
                items:
                  properties:
                    lastProbeTime:
                      description: Last time we probed the condition.
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned from one status
                        to another.
                      type: string
                    message:
                      description: Human-readable message indicating details about
                        last transition.
                      type: string
                    reason:
                      description: Unique, one-word, CamelCase reason for the condition's
                        last transition.
                      type: string
                    status:
                      description: |-
                        Status is the status of the condition.
                        Can be True, False, Unknown.
                      type: string
                    type:
                      description: Type is the type of the condition.
                      type: string
                  type: object
                nullable: true
                type: array
              currentEngineNodeID:
                description: the node that the engine (target) is currently running
                  on.
                type: string
              currentImage:
                type: string
              currentMigrationNodeID:
                description: the node that this volume is currently migrating to
                type: string
              currentNodeID:
                type: string
              expansionRequired:
                type: boolean
              frontendDisabled:
                type: boolean
              isStandby:
                type: boolean
              kubernetesStatus:
                properties:
                  lastPVCRefAt:
                    type: string
                  lastPodRefAt:
                    type: string
                  namespace:
                    description: determine if PVC/Namespace is history or not
                    type: string
                  pvName:
                    type: string
                  pvStatus:
                    type: string
                  pvcName:
                    type: string
                  workloadsStatus:
                    description: determine if Pod/Workload is history or not
                    items:
                      properties:
                        podName:
                          type: string
                        podStatus:
                          type: string
                        workloadName:
                          type: string
                        workloadType:
                          type: string
                      type: object
                    nullable: true
                    type: array
                type: object
              lastAutoSalvagedAt:
                type: string
              lastBackup:
                type: string
              lastBackupAt:
                type: string
              lastDegradedAt:
                type: string
              lastOnDemandSnapshotHashingCompleteAt:
                description: |-
                  LastOnDemandSnapshotHashingCompleteAt is the RFC3339 timestamp (e.g., "2026-03-16T10:30:00Z") when the
                  most recent on-demand snapshot checksum calculation completed.
                  When this value matches SnapshotHashingRequestedAt, the requested on-demand checksum calculation is considered complete.
                type: string
              ownerID:
                type: string
              remountRequestedAt:
                type: string
              restoreInitiated:
                type: boolean
              restoreRequired:
                type: boolean
              robustness:
                type: string
              shareEndpoint:
                type: string
              shareState:
                type: string
              state:
                type: string
              switchoverState:
                description: |-
                  SwitchoverState describes the current progress of a v2 engine live switchover.
                  Empty when no switchover is in progress.
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
---
# Source: longhorn/templates/clusterrole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: longhorn-role
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
rules:
- apiGroups:
  - apiextensions.k8s.io
  resources:
  - customresourcedefinitions
  verbs:
  - "*"
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "list", "watch", "delete", "deletecollection"]
- apiGroups: [""]
  resources: ["secrets", "services", "endpoints", "configmaps", "serviceaccounts", "pods/log"]
  verbs: ["get", "list", "watch"]
- apiGroups: [""]
  resources: ["events", "persistentvolumes", "persistentvolumeclaims", "persistentvolumeclaims/status", "nodes"]
  verbs: ["*"]
- apiGroups: [""]
  resources: ["namespaces"]
  verbs: ["get", "list"]
- apiGroups: ["apps"]
  resources: ["daemonsets", "statefulsets", "deployments", "replicasets"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["batch"]
  resources: ["jobs", "cronjobs"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["policy"]
  resources: ["poddisruptionbudgets"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["scheduling.k8s.io"]
  resources: ["priorityclasses"]
  verbs: ["watch", "list"]
- apiGroups: ["storage.k8s.io"]
  resources: ["storageclasses", "volumeattachments", "volumeattachments/status", "volumeattributesclasses", "csinodes", "csidrivers", "csistoragecapacities"]
  verbs: ["*"]
- apiGroups: ["snapshot.storage.k8s.io"]
  resources: ["volumesnapshotclasses", "volumesnapshots", "volumesnapshotcontents", "volumesnapshotcontents/status"]
  verbs: ["*"]
- apiGroups: ["longhorn.io"]
  resources: ["volumes", "volumes/status", "enginefrontends", "enginefrontends/status", "engines", "engines/status", "replicas", "replicas/status", "settings", "settings/status",
              "engineimages", "engineimages/status", "nodes", "nodes/status", "instancemanagers", "instancemanagers/status",
              "sharemanagers", "sharemanagers/status", "backingimages", "backingimages/status",
              "backingimagemanagers", "backingimagemanagers/status", "backingimagedatasources", "backingimagedatasources/status",
              "backuptargets", "backuptargets/status", "backupvolumes", "backupvolumes/status", "backups", "backups/status",
              "recurringjobs", "recurringjobs/status", "orphans", "orphans/status", "snapshots", "snapshots/status",
              "supportbundles", "supportbundles/status", "systembackups", "systembackups/status", "systemrestores", "systemrestores/status",
              "volumeattachments", "volumeattachments/status", "backupbackingimages", "backupbackingimages/status"]
  verbs: ["*"]
- apiGroups: ["coordination.k8s.io"]
  resources: ["leases"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["metrics.k8s.io"]
  resources: ["pods", "nodes"]
  verbs: ["get", "list"]
- apiGroups: ["apiregistration.k8s.io"]
  resources: ["apiservices"]
  verbs: ["list", "watch"]
- apiGroups: ["admissionregistration.k8s.io"]
  resources: ["mutatingwebhookconfigurations", "validatingwebhookconfigurations"]
  verbs: ["get", "list", "create", "patch", "delete"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["roles", "rolebindings"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["discovery.k8s.io"]
  resources: ["endpointslices"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["clusterrolebindings", "clusterroles"]
  verbs: ["*"]
---
# Source: longhorn/templates/clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: longhorn-bind
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: longhorn-role
subjects:
- kind: ServiceAccount
  name: longhorn-service-account
  namespace: longhorn-system
---
# Source: longhorn/templates/clusterrolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: longhorn-support-bundle
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: longhorn-support-bundle
  namespace: longhorn-system
---
# Source: longhorn/templates/role.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: longhorn
  namespace: longhorn-system
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
rules:
- apiGroups: [""]
  resources: ["pods", "pods/log", "events", "secrets", "services", "endpoints", "configmaps", "serviceaccounts", "persistentvolumeclaims", "persistentvolumeclaims/status"]
  verbs: ["*"]
- apiGroups: ["apps"]
  resources: ["daemonsets", "deployments", "statefulsets", "replicasets"]
  verbs: ["*"]
- apiGroups: ["batch"]
  resources: ["jobs", "cronjobs"]
  verbs: ["*"]
- apiGroups: ["policy"]
  resources: ["poddisruptionbudgets"]
  verbs: ["*"]
- apiGroups: ["coordination.k8s.io"]
  resources: ["leases"]
  verbs: ["*"]
- apiGroups: ["rbac.authorization.k8s.io"]
  resources: ["roles", "rolebindings"]
  verbs: ["*"]
- apiGroups: ["discovery.k8s.io"]
  resources: ["endpointslices"]
  verbs: ["*"]
---
# Source: longhorn/templates/rolebinding.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: longhorn
  namespace: longhorn-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: longhorn
subjects:
- kind: ServiceAccount
  name: longhorn-service-account
  namespace: longhorn-system
---
# Source: longhorn/templates/daemonset-sa.yaml
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    app: longhorn-manager
  name: longhorn-backend
  namespace: longhorn-system
spec:
  type: ClusterIP
  selector:
    app: longhorn-manager
  ports:
  - name: manager
    port: 9500
    targetPort: manager
---
# Source: longhorn/templates/deployment-ui.yaml
kind: Service
apiVersion: v1
metadata:
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    app: longhorn-ui
  name: longhorn-frontend
  namespace: longhorn-system
spec:
  type: ClusterIP
  selector:
    app: longhorn-ui
  ports:
  - name: http
    port: 80
    targetPort: http
    nodePort: null
---
# Source: longhorn/templates/services.yaml
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    app: longhorn-admission-webhook
  name: longhorn-admission-webhook
  namespace: longhorn-system
spec:
  type: ClusterIP
  selector:
    longhorn.io/admission-webhook: longhorn-admission-webhook
  ports:
  - name: admission-webhook
    port: 9502
    targetPort: admission-wh
---
# Source: longhorn/templates/services.yaml
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    app: longhorn-recovery-backend
  name: longhorn-recovery-backend
  namespace: longhorn-system
spec:
  type: ClusterIP
  selector:
    longhorn.io/recovery-backend: longhorn-recovery-backend
  ports:
  - name: recovery-backend
    port: 9503
    targetPort: recov-backend
---
# Source: longhorn/templates/daemonset-sa.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    app: longhorn-manager
  name: longhorn-manager
  namespace: longhorn-system
spec:
  selector:
    matchLabels:
      app: longhorn-manager
  template:
    metadata:
      labels:
        app.kubernetes.io/name: longhorn
        app.kubernetes.io/instance: longhorn
        app.kubernetes.io/version: v1.12.0
        app: longhorn-manager
    spec:
      containers:
      - name: longhorn-manager
        image: docker.io/longhornio/longhorn-manager:v1.12.0
        imagePullPolicy: IfNotPresent
        securityContext:
          privileged: true
        command:
        - longhorn-manager
        - -d
        - daemon
        - --engine-image
        - "docker.io/longhornio/longhorn-engine:v1.12.0"
        - --instance-manager-image
        - "docker.io/longhornio/longhorn-instance-manager:v1.12.0"
        - --share-manager-image
        - "docker.io/longhornio/longhorn-share-manager:v1.12.0"
        - --backing-image-manager-image
        - "docker.io/longhornio/backing-image-manager:v1.12.0"
        - --support-bundle-manager-image
        - "docker.io/longhornio/support-bundle-kit:v0.0.86"
        - --manager-image
        - "docker.io/longhornio/longhorn-manager:v1.12.0"
        - --service-account
        - longhorn-service-account
        - --upgrade-version-check
        ports:
        - containerPort: 9500
          name: manager
        - containerPort: 9502
          name: admission-wh
        - containerPort: 9503
          name: recov-backend
        readinessProbe:
          httpGet:
            path: /v1/healthz
            port: 9502
            scheme: HTTPS
        volumeMounts:
        - name: boot
          mountPath: /host/boot/
          readOnly: true
        - name: dev
          mountPath: /host/dev/
        - name: proc
          mountPath: /host/proc/
          readOnly: true
        - name: etc
          mountPath: /host/etc/
          readOnly: true
        - name: longhorn
          mountPath: /var/lib/longhorn/
          mountPropagation: Bidirectional
        - name: longhorn-grpc-tls
          mountPath: /tls-files/
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: LONGHORN_DISTRO
          value: "longhorn"

      - name: pre-pull-share-manager-image
        imagePullPolicy: IfNotPresent
        image: docker.io/longhornio/longhorn-share-manager:v1.12.0
        command: ["sh", "-c", "echo share-manager image pulled && sleep infinity"]
      volumes:
      - name: boot
        hostPath:
          path: /boot/
      - name: dev
        hostPath:
          path: /dev/
      - name: proc
        hostPath:
          path: /proc/
      - name: etc
        hostPath:
          path: /etc/
      - name: longhorn
        hostPath:
          path: /var/lib/longhorn/
      - name: longhorn-grpc-tls
        secret:
          secretName: longhorn-grpc-tls
          optional: true
      priorityClassName: "longhorn-critical"
      serviceAccountName: longhorn-service-account
  updateStrategy:
    rollingUpdate:
      maxUnavailable: 100%
---
# Source: longhorn/templates/deployment-driver.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: longhorn-driver-deployer
  namespace: longhorn-system
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
spec:
  replicas: 1
  selector:
    matchLabels:
      app: longhorn-driver-deployer
  template:
    metadata:
      labels:
        app.kubernetes.io/name: longhorn
        app.kubernetes.io/instance: longhorn
        app.kubernetes.io/version: v1.12.0
        app: longhorn-driver-deployer
    spec:
      initContainers:
        - name: wait-longhorn-manager
          image: docker.io/longhornio/longhorn-manager:v1.12.0
          command: ['sh', '-c', 'while [ $(curl -m 1 -s -o /dev/null -w "%{http_code}" http://longhorn-backend:9500/v1) != "200" ]; do echo waiting; sleep 2; done']
      containers:
        - name: longhorn-driver-deployer
          image: docker.io/longhornio/longhorn-manager:v1.12.0
          imagePullPolicy: IfNotPresent
          command:
          - longhorn-manager
          - -d
          - deploy-driver
          - --manager-image
          - "docker.io/longhornio/longhorn-manager:v1.12.0"
          - --manager-url
          - http://longhorn-backend:9500/v1
          env:
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: SERVICE_ACCOUNT
            valueFrom:
              fieldRef:
                fieldPath: spec.serviceAccountName
          - name: CSI_ATTACHER_IMAGE
            value: "docker.io/longhornio/csi-attacher:v4.12.0"
          - name: CSI_PROVISIONER_IMAGE
            value: "docker.io/longhornio/csi-provisioner:v5.3.0-20260514"
          - name: CSI_NODE_DRIVER_REGISTRAR_IMAGE
            value: "docker.io/longhornio/csi-node-driver-registrar:v2.17.0"
          - name: CSI_RESIZER_IMAGE
            value: "docker.io/longhornio/csi-resizer:v2.1.0-20260514"
          - name: CSI_SNAPSHOTTER_IMAGE
            value: "docker.io/longhornio/csi-snapshotter:v8.5.0-20260514"
          - name: CSI_LIVENESS_PROBE_IMAGE
            value: "docker.io/longhornio/livenessprobe:v2.19.0"

      priorityClassName: "longhorn-critical"
      serviceAccountName: longhorn-service-account
      securityContext:
        runAsUser: 0
---
# Source: longhorn/templates/deployment-ui.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: longhorn
    app.kubernetes.io/instance: longhorn
    app.kubernetes.io/version: v1.12.0
    app: longhorn-ui
  name: longhorn-ui
  namespace: longhorn-system
spec:
  replicas: 2
  selector:
    matchLabels:
      app: longhorn-ui
  template:
    metadata:
      labels:
        app.kubernetes.io/name: longhorn
        app.kubernetes.io/instance: longhorn
        app.kubernetes.io/version: v1.12.0
        app: longhorn-ui
    spec:
      serviceAccountName: longhorn-ui-service-account
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - longhorn-ui
              topologyKey: kubernetes.io/hostname
            weight: 1
      containers:
      - name: longhorn-ui
        image: docker.io/longhornio/longhorn-ui:v1.12.0
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: nginx-cache
          mountPath: /var/cache/nginx/
        - name: nginx-config
          mountPath: /var/config/nginx/
        - name: var-run
          mountPath: /var/run/
        ports:
        - containerPort: 8000
          name: http
        env:
          - name: LONGHORN_MANAGER_IP
            value: "http://longhorn-backend:9500"
          - name: LONGHORN_UI_PORT
            value: "8000"

      volumes:
      - emptyDir: {}
        name: nginx-cache
      - emptyDir: {}
        name: nginx-config
      - emptyDir: {}
        name: var-run
      priorityClassName: "longhorn-critical"
---
# Source: longhorn/templates/validate-psp-install.yaml
#
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: longhorn-rwx
  annotations:
    storageclass.kubernetes.io/is-default-class: "false"
provisioner: driver.longhorn.io
allowVolumeExpansion: true
reclaimPolicy: Delete
volumeBindingMode: Immediate
parameters:
  numberOfReplicas: "3"
  staleReplicaTimeout: "30"
  fromBackup: ""
  fsType: "ext4"
---
# ClawManager cluster install profile.
# Official validation target: Longhorn CSI example.
# Defaults use longhorn for RWO data and longhorn-rwx for RWX workspaces.
# These StorageClass names are examples and may be replaced by any compatible CSI classes.
apiVersion: v1
kind: Namespace
metadata:
  name: clawmanager-system
---
apiVersion: v1
kind: Secret
metadata:
  name: clawmanager-secrets
  namespace: clawmanager-system
type: Opaque
stringData:
  mysql-root-password: root123
  mysql-password: clawreef123
  jwt-secret: change-me-in-production
  runtime-agent-control-token: change-me-runtime-control-token
  runtime-agent-report-token: change-me-runtime-report-token
  openclaw-gateway-token: change-me-openclaw-gateway-token
  minio-root-user: minioadmin
  minio-root-password: minioadmin123
  minio-access-key: minioadmin
  minio-secret-key: minioadmin123
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: clawmanager-mysql-init
  namespace: clawmanager-system
data:
  001_init_schema.sql: |
    CREATE DATABASE IF NOT EXISTS clawmanager CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    USE clawmanager;

    CREATE TABLE IF NOT EXISTS users (
      id INT AUTO_INCREMENT PRIMARY KEY,
      username VARCHAR(255) UNIQUE NOT NULL,
      email VARCHAR(320) UNIQUE NOT NULL,
      password_hash VARCHAR(255) NOT NULL,
      role ENUM('admin', 'user') DEFAULT 'user',
      is_active BOOLEAN DEFAULT TRUE,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      last_login TIMESTAMP,
      INDEX idx_username (username),
      INDEX idx_role (role)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS instances (
      id INT AUTO_INCREMENT PRIMARY KEY,
      user_id INT NOT NULL,
      name VARCHAR(255) NOT NULL,
      description TEXT,
      type ENUM('openclaw', 'ubuntu', 'debian', 'centos', 'custom', 'webtop', 'hermes') DEFAULT 'ubuntu',
      runtime_type ENUM('desktop', 'shell') NOT NULL DEFAULT 'desktop',
      status ENUM('creating', 'running', 'stopped', 'error', 'deleting') DEFAULT 'creating',
      cpu_cores DECIMAL(10,2) NOT NULL,
      memory_gb INT NOT NULL,
      disk_gb INT NOT NULL,
      gpu_enabled BOOLEAN DEFAULT FALSE,
      gpu_type VARCHAR(100),
      gpu_count INT DEFAULT 0,
      os_type VARCHAR(50) NOT NULL,
      os_version VARCHAR(50) NOT NULL,
      image_registry VARCHAR(255),
      image_tag VARCHAR(100),
      storage_class VARCHAR(50) DEFAULT 'standard',
      mount_path VARCHAR(255) DEFAULT '/data',
      pod_name VARCHAR(255),
      pod_namespace VARCHAR(255),
      pod_ip VARCHAR(45),
      access_url VARCHAR(500),
      access_token VARCHAR(255),
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      started_at TIMESTAMP,
      stopped_at TIMESTAMP,
      FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
      INDEX idx_user_id (user_id),
      INDEX idx_status (status),
      INDEX idx_type (type)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS persistent_volumes (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      pvc_name VARCHAR(255) UNIQUE NOT NULL,
      pvc_namespace VARCHAR(255) NOT NULL,
      storage_size_gb INT NOT NULL,
      storage_class VARCHAR(50),
      mount_path VARCHAR(255),
      status ENUM('pending', 'bound', 'released', 'failed') DEFAULT 'pending',
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      INDEX idx_instance_id (instance_id),
      UNIQUE KEY uk_pvc_name_namespace (pvc_name, pvc_namespace)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS backups (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      backup_name VARCHAR(255) NOT NULL,
      backup_size_gb INT,
      backup_path VARCHAR(500),
      status ENUM('creating', 'completed', 'failed', 'deleted') DEFAULT 'creating',
      backup_type ENUM('manual', 'scheduled') DEFAULT 'manual',
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      completed_at TIMESTAMP,
      expires_at TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      INDEX idx_instance_id (instance_id),
      INDEX idx_created_at (created_at)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS backup_schedules (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      schedule_name VARCHAR(255),
      cron_expression VARCHAR(100) NOT NULL,
      retention_days INT DEFAULT 30,
      is_active BOOLEAN DEFAULT TRUE,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      INDEX idx_instance_id (instance_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS user_quotas (
      id INT AUTO_INCREMENT PRIMARY KEY,
      user_id INT NOT NULL UNIQUE,
      max_instances INT DEFAULT 10,
      max_cpu_cores DECIMAL(10,2) DEFAULT 40,
      max_memory_gb INT DEFAULT 100,
      max_storage_gb INT DEFAULT 500,
      max_gpu_count INT DEFAULT 2,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
      INDEX idx_user_id (user_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS instance_usage (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      cpu_usage_percent DECIMAL(5,2),
      memory_usage_gb DECIMAL(10,2),
      disk_usage_gb DECIMAL(10,2),
      gpu_usage_percent DECIMAL(5,2),
      uptime_seconds INT,
      recorded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      INDEX idx_instance_recorded (instance_id, recorded_at)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS audit_logs (
      id INT AUTO_INCREMENT PRIMARY KEY,
      user_id INT,
      action VARCHAR(100) NOT NULL,
      resource_type VARCHAR(50) NOT NULL,
      resource_id INT,
      details JSON,
      ip_address VARCHAR(45),
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL,
      INDEX idx_user_id (user_id),
      INDEX idx_action (action),
      INDEX idx_created_at (created_at)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    INSERT INTO users (username, email, password_hash, role, is_active)
    SELECT 'admin', 'admin@clawmanager.local', '$2a$10$pbenze514mwv3pvQySQBVOsF5J4DBXL2kVo1hLa8JFhQu5x3AKvBi', 'admin', TRUE
    WHERE NOT EXISTS (SELECT 1 FROM users WHERE username = 'admin');

    INSERT INTO user_quotas (user_id, max_instances, max_cpu_cores, max_memory_gb, max_storage_gb, max_gpu_count)
    SELECT id, 100, 200, 1000, 5000, 10 FROM users
    WHERE username = 'admin'
      AND NOT EXISTS (SELECT 1 FROM user_quotas WHERE user_id = users.id);
  002_add_webtop_instance_type.sql: |
    USE clawmanager;
    ALTER TABLE instances
    MODIFY COLUMN type ENUM('openclaw', 'ubuntu', 'debian', 'centos', 'custom', 'webtop', 'hermes') DEFAULT 'ubuntu';
  003_add_system_image_settings.sql: |
    USE clawmanager;
    CREATE TABLE IF NOT EXISTS system_image_settings (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_type VARCHAR(50) NOT NULL,
      runtime_type ENUM('desktop', 'shell') NOT NULL DEFAULT 'desktop',
      display_name VARCHAR(255) NOT NULL,
      image VARCHAR(500) NOT NULL,
      is_enabled BOOLEAN NOT NULL DEFAULT TRUE,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      INDEX idx_instance_type (instance_type)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  004_fix_seeded_admin_password.sql: |
    USE clawmanager;
    UPDATE users
    SET password_hash = '$2a$10$pbenze514mwv3pvQySQBVOsF5J4DBXL2kVo1hLa8JFhQu5x3AKvBi'
    WHERE username = 'admin'
      AND password_hash = '$2a$10$N9qo8uLOickgx2ZMRZoMy.MqrzL9wGC3qD3Q.ZHqQH6t3q7l1L5uG';
  005_update_openclaw_default_image.sql: |
    USE clawmanager;
    UPDATE system_image_settings
    SET image = 'ghcr.io/yuan-lab-llm/agentsruntime/openclaw:latest'
    WHERE instance_type = 'openclaw'
      AND image IN (
        'ericpearlee/openclaw:v2026.3.24',
        'ghcr.io/yuan-lab-llm/clawmanager-openclaw-image/openclaw:latest'
      );
  006_add_openclaw_config_center.sql: |
    USE clawmanager;
    SET @openclaw_snapshot_column_exists = (
      SELECT COUNT(*)
      FROM information_schema.COLUMNS
      WHERE TABLE_SCHEMA = DATABASE()
        AND TABLE_NAME = 'instances'
        AND COLUMN_NAME = 'openclaw_config_snapshot_id'
    );
    SET @openclaw_snapshot_column_sql = IF(
      @openclaw_snapshot_column_exists = 0,
      'ALTER TABLE instances ADD COLUMN openclaw_config_snapshot_id INT NULL AFTER access_token',
      'SELECT 1'
    );
    PREPARE openclaw_snapshot_column_stmt FROM @openclaw_snapshot_column_sql;
    EXECUTE openclaw_snapshot_column_stmt;
    DEALLOCATE PREPARE openclaw_snapshot_column_stmt;

    CREATE TABLE IF NOT EXISTS openclaw_config_resources (
      id INT AUTO_INCREMENT PRIMARY KEY,
      user_id INT NOT NULL,
      resource_type VARCHAR(50) NOT NULL,
      resource_key VARCHAR(100) NOT NULL,
      name VARCHAR(255) NOT NULL,
      description TEXT NULL,
      enabled BOOLEAN NOT NULL DEFAULT TRUE,
      version INT NOT NULL DEFAULT 1,
      tags_json LONGTEXT NOT NULL,
      content_json LONGTEXT NOT NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
      UNIQUE KEY uk_openclaw_resource_key (user_id, resource_type, resource_key),
      INDEX idx_openclaw_resource_user_type (user_id, resource_type),
      INDEX idx_openclaw_resource_user_enabled (user_id, enabled)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS openclaw_config_bundles (
      id INT AUTO_INCREMENT PRIMARY KEY,
      user_id INT NOT NULL,
      name VARCHAR(255) NOT NULL,
      description TEXT NULL,
      enabled BOOLEAN NOT NULL DEFAULT TRUE,
      version INT NOT NULL DEFAULT 1,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
      INDEX idx_openclaw_bundle_user (user_id),
      INDEX idx_openclaw_bundle_user_enabled (user_id, enabled)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS openclaw_config_bundle_items (
      id INT AUTO_INCREMENT PRIMARY KEY,
      bundle_id INT NOT NULL,
      resource_id INT NOT NULL,
      sort_order INT NOT NULL DEFAULT 0,
      required BOOLEAN NOT NULL DEFAULT TRUE,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      FOREIGN KEY (bundle_id) REFERENCES openclaw_config_bundles(id) ON DELETE CASCADE,
      FOREIGN KEY (resource_id) REFERENCES openclaw_config_resources(id) ON DELETE CASCADE,
      UNIQUE KEY uk_openclaw_bundle_resource (bundle_id, resource_id),
      INDEX idx_openclaw_bundle_item_bundle (bundle_id, sort_order)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS openclaw_injection_snapshots (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NULL,
      user_id INT NOT NULL,
      mode VARCHAR(20) NOT NULL,
      bundle_id INT NULL,
      selected_resource_ids_json LONGTEXT NOT NULL,
      resolved_resources_json LONGTEXT NOT NULL,
      rendered_manifest_json LONGTEXT NOT NULL,
      rendered_env_json LONGTEXT NOT NULL,
      secret_name VARCHAR(255) NULL,
      status VARCHAR(30) NOT NULL DEFAULT 'pending',
      error_message TEXT NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      activated_at TIMESTAMP NULL,
      INDEX idx_openclaw_snapshot_user_created (user_id, created_at),
      INDEX idx_openclaw_snapshot_instance (instance_id),
      INDEX idx_openclaw_snapshot_bundle (bundle_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  007_add_instance_agent_control_plane.sql: |
    USE clawmanager;
    SET @instance_agent_bootstrap_token_column_exists = (
      SELECT COUNT(*)
      FROM information_schema.COLUMNS
      WHERE TABLE_SCHEMA = DATABASE()
        AND TABLE_NAME = 'instances'
        AND COLUMN_NAME = 'agent_bootstrap_token'
    );
    SET @instance_agent_bootstrap_token_column_sql = IF(
      @instance_agent_bootstrap_token_column_exists = 0,
      'ALTER TABLE instances ADD COLUMN agent_bootstrap_token VARCHAR(255) NULL AFTER access_token',
      'SELECT 1'
    );
    PREPARE instance_agent_bootstrap_token_column_stmt FROM @instance_agent_bootstrap_token_column_sql;
    EXECUTE instance_agent_bootstrap_token_column_stmt;
    DEALLOCATE PREPARE instance_agent_bootstrap_token_column_stmt;

    CREATE TABLE IF NOT EXISTS instance_agents (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      agent_id VARCHAR(255) NOT NULL,
      agent_version VARCHAR(50) NOT NULL,
      protocol_version VARCHAR(50) NOT NULL,
      status VARCHAR(30) NOT NULL DEFAULT 'online',
      capabilities_json LONGTEXT NOT NULL,
      host_info_json LONGTEXT NULL,
      session_token VARCHAR(255) NULL,
      session_expires_at TIMESTAMP NULL,
      last_heartbeat_at TIMESTAMP NULL,
      last_reported_at TIMESTAMP NULL,
      last_seen_ip VARCHAR(45) NULL,
      registered_at TIMESTAMP NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      UNIQUE KEY uk_instance_agents_instance (instance_id),
      UNIQUE KEY uk_instance_agents_session_token (session_token),
      INDEX idx_instance_agents_agent_id (agent_id),
      INDEX idx_instance_agents_status (status),
      INDEX idx_instance_agents_last_heartbeat (last_heartbeat_at)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS instance_runtime_status (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      infra_status VARCHAR(30) NOT NULL DEFAULT 'creating',
      agent_status VARCHAR(30) NOT NULL DEFAULT 'offline',
      openclaw_status VARCHAR(30) NOT NULL DEFAULT 'unknown',
      openclaw_pid INT NULL,
      openclaw_version VARCHAR(100) NULL,
      current_config_revision_id INT NULL,
      desired_config_revision_id INT NULL,
      summary_json LONGTEXT NULL,
      system_info_json LONGTEXT NULL,
      health_json LONGTEXT NULL,
      last_reported_at TIMESTAMP NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      UNIQUE KEY uk_instance_runtime_status_instance (instance_id),
      INDEX idx_instance_runtime_status_agent_status (agent_status),
      INDEX idx_instance_runtime_status_openclaw_status (openclaw_status)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS instance_desired_state (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      desired_power_state VARCHAR(30) NOT NULL DEFAULT 'running',
      desired_config_revision_id INT NULL,
      desired_runtime_action VARCHAR(50) NULL,
      updated_by INT NULL,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      FOREIGN KEY (updated_by) REFERENCES users(id) ON DELETE SET NULL,
      UNIQUE KEY uk_instance_desired_state_instance (instance_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS instance_commands (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      agent_id VARCHAR(255) NULL,
      command_type VARCHAR(50) NOT NULL,
      payload_json LONGTEXT NULL,
      status VARCHAR(30) NOT NULL DEFAULT 'pending',
      idempotency_key VARCHAR(255) NOT NULL,
      issued_by INT NULL,
      issued_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      dispatched_at TIMESTAMP NULL,
      started_at TIMESTAMP NULL,
      finished_at TIMESTAMP NULL,
      timeout_seconds INT NOT NULL DEFAULT 300,
      result_json LONGTEXT NULL,
      error_message TEXT NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      FOREIGN KEY (issued_by) REFERENCES users(id) ON DELETE SET NULL,
      UNIQUE KEY uk_instance_commands_idempotency (instance_id, idempotency_key),
      INDEX idx_instance_commands_instance_status (instance_id, status),
      INDEX idx_instance_commands_agent_status (agent_id, status),
      INDEX idx_instance_commands_issued_at (issued_at)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS instance_config_revisions (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      source_snapshot_id INT NULL,
      source_bundle_id INT NULL,
      revision_no INT NOT NULL,
      content_json LONGTEXT NOT NULL,
      checksum VARCHAR(255) NOT NULL,
      status VARCHAR(30) NOT NULL DEFAULT 'published',
      published_by INT NULL,
      published_at TIMESTAMP NULL,
      activated_at TIMESTAMP NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      FOREIGN KEY (published_by) REFERENCES users(id) ON DELETE SET NULL,
      UNIQUE KEY uk_instance_config_revision_unique (instance_id, revision_no),
      INDEX idx_instance_config_revision_instance (instance_id, revision_no),
      INDEX idx_instance_config_revision_status (status)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  008_add_skill_management.sql: |
    USE clawmanager;
    CREATE TABLE IF NOT EXISTS skill_blobs (
      id INT AUTO_INCREMENT PRIMARY KEY,
      content_hash VARCHAR(128) NOT NULL,
      archive_hash VARCHAR(128) NOT NULL,
      object_key VARCHAR(512) NOT NULL,
      file_name VARCHAR(255) NOT NULL,
      media_type VARCHAR(100) NOT NULL DEFAULT 'application/gzip',
      size_bytes BIGINT NOT NULL DEFAULT 0,
      scan_status VARCHAR(30) NOT NULL DEFAULT 'pending',
      risk_level VARCHAR(30) NOT NULL DEFAULT 'unknown',
      last_scanned_at TIMESTAMP NULL,
      last_scan_result_id INT NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      UNIQUE KEY uk_skill_blobs_content_hash (content_hash),
      INDEX idx_skill_blobs_scan_status (scan_status),
      INDEX idx_skill_blobs_risk_level (risk_level)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS skills (
      id INT AUTO_INCREMENT PRIMARY KEY,
      user_id INT NOT NULL,
      skill_key VARCHAR(120) NOT NULL,
      name VARCHAR(255) NOT NULL,
      description TEXT NULL,
      current_version_id INT NULL,
      source_type VARCHAR(30) NOT NULL DEFAULT 'uploaded',
      status VARCHAR(30) NOT NULL DEFAULT 'active',
      risk_level VARCHAR(30) NOT NULL DEFAULT 'unknown',
      last_scanned_at TIMESTAMP NULL,
      last_scan_result_id INT NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
      UNIQUE KEY uk_skills_user_key (user_id, skill_key),
      INDEX idx_skills_user_status (user_id, status),
      INDEX idx_skills_risk_level (risk_level)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS skill_versions (
      id INT AUTO_INCREMENT PRIMARY KEY,
      skill_id INT NOT NULL,
      blob_id INT NOT NULL,
      version_no INT NOT NULL,
      manifest_json LONGTEXT NULL,
      source_type VARCHAR(30) NOT NULL DEFAULT 'uploaded',
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (skill_id) REFERENCES skills(id) ON DELETE CASCADE,
      FOREIGN KEY (blob_id) REFERENCES skill_blobs(id) ON DELETE RESTRICT,
      UNIQUE KEY uk_skill_versions_skill_version (skill_id, version_no),
      UNIQUE KEY uk_skill_versions_skill_blob (skill_id, blob_id),
      INDEX idx_skill_versions_skill_id (skill_id, version_no)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS instance_skills (
      id INT AUTO_INCREMENT PRIMARY KEY,
      instance_id INT NOT NULL,
      skill_id INT NOT NULL,
      skill_version_id INT NULL,
      source_type VARCHAR(40) NOT NULL DEFAULT 'discovered_in_instance',
      install_path VARCHAR(1024) NULL,
      observed_hash VARCHAR(128) NULL,
      status VARCHAR(30) NOT NULL DEFAULT 'active',
      last_seen_at TIMESTAMP NULL,
      removed_at TIMESTAMP NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE,
      FOREIGN KEY (skill_id) REFERENCES skills(id) ON DELETE CASCADE,
      FOREIGN KEY (skill_version_id) REFERENCES skill_versions(id) ON DELETE SET NULL,
      UNIQUE KEY uk_instance_skills_instance_skill (instance_id, skill_id),
      INDEX idx_instance_skills_instance (instance_id, status),
      INDEX idx_instance_skills_skill (skill_id, status)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

    CREATE TABLE IF NOT EXISTS skill_scan_results (
      id INT AUTO_INCREMENT PRIMARY KEY,
      blob_id INT NOT NULL,
      engine VARCHAR(60) NOT NULL,
      risk_level VARCHAR(30) NOT NULL DEFAULT 'unknown',
      status VARCHAR(30) NOT NULL DEFAULT 'completed',
      summary TEXT NULL,
      findings_json LONGTEXT NULL,
      scanned_at TIMESTAMP NULL,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      FOREIGN KEY (blob_id) REFERENCES skill_blobs(id) ON DELETE CASCADE,
      INDEX idx_skill_scan_results_blob (blob_id, scanned_at),
      INDEX idx_skill_scan_results_risk (risk_level, scanned_at)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  009_cpu_cores_decimal.sql: |
    USE clawmanager;
    ALTER TABLE instances MODIFY COLUMN cpu_cores DECIMAL(10,2) NOT NULL;
    ALTER TABLE user_quotas MODIFY COLUMN max_cpu_cores DECIMAL(10,2) DEFAULT 40;
  011_add_hermes_instance_type.sql: |
    USE clawmanager;
    ALTER TABLE instances
    MODIFY COLUMN type ENUM('openclaw', 'ubuntu', 'debian', 'centos', 'custom', 'webtop', 'hermes') DEFAULT 'ubuntu';
  012_update_agents_runtime_default_images.sql: |
    USE clawmanager;
    UPDATE system_image_settings
    SET image = 'ghcr.io/yuan-lab-llm/agentsruntime/openclaw:latest'
    WHERE instance_type = 'openclaw'
      AND image IN (
        'ericpearlee/openclaw:v2026.3.24',
        'ghcr.io/yuan-lab-llm/clawmanager-openclaw-image/openclaw:latest'
      );

    UPDATE system_image_settings
    SET image = 'ghcr.io/yuan-lab-llm/agentsruntime/hermes:latest'
    WHERE instance_type = 'hermes'
      AND image IN (
        'registry.example.com/hermes-webtop:latest',
        'lscr.io/linuxserver/webtop:ubuntu-xfce'
      );
  013_normalize_agents_runtime_image_names.sql: |
    USE clawmanager;
    UPDATE system_image_settings
    SET image = 'ghcr.io/yuan-lab-llm/agentsruntime/openclaw:latest'
    WHERE image = 'ghcr.io/Yuan-lab-LLM/AgentsRuntime/openclaw:latest';

    UPDATE system_image_settings
    SET image = 'ghcr.io/yuan-lab-llm/agentsruntime/hermes:latest'
    WHERE image = 'ghcr.io/Yuan-lab-LLM/AgentsRuntime/hermes:latest';
  019_add_instance_runtime_type.sql: |
    USE clawmanager;
    SET @instance_runtime_type_column_exists = (
      SELECT COUNT(*)
      FROM information_schema.COLUMNS
      WHERE TABLE_SCHEMA = DATABASE()
        AND TABLE_NAME = 'instances'
        AND COLUMN_NAME = 'runtime_type'
    );
    SET @instance_runtime_type_column_sql = IF(
      @instance_runtime_type_column_exists = 0,
      'ALTER TABLE instances ADD COLUMN runtime_type ENUM(''desktop'', ''shell'') NOT NULL DEFAULT ''desktop'' AFTER type',
      'SELECT 1'
    );
    PREPARE instance_runtime_type_column_stmt FROM @instance_runtime_type_column_sql;
    EXECUTE instance_runtime_type_column_stmt;
    DEALLOCATE PREPARE instance_runtime_type_column_stmt;
  020_add_system_image_runtime_type.sql: |
    USE clawmanager;
    SET @system_image_runtime_type_column_exists = (
      SELECT COUNT(*)
      FROM information_schema.COLUMNS
      WHERE TABLE_SCHEMA = DATABASE()
        AND TABLE_NAME = 'system_image_settings'
        AND COLUMN_NAME = 'runtime_type'
    );
    SET @system_image_runtime_type_column_sql = IF(
      @system_image_runtime_type_column_exists = 0,
      'ALTER TABLE system_image_settings ADD COLUMN runtime_type ENUM(''desktop'', ''shell'') NOT NULL DEFAULT ''desktop'' AFTER instance_type',
      'SELECT 1'
    );
    PREPARE system_image_runtime_type_column_stmt FROM @system_image_runtime_type_column_sql;
    EXECUTE system_image_runtime_type_column_stmt;
    DEALLOCATE PREPARE system_image_runtime_type_column_stmt;
  021_add_openclaw_shell_runtime_image.sql: |
    USE clawmanager;
    SET @system_image_is_enabled_column_exists = (
      SELECT COUNT(*)
      FROM information_schema.COLUMNS
      WHERE TABLE_SCHEMA = DATABASE()
        AND TABLE_NAME = 'system_image_settings'
        AND COLUMN_NAME = 'is_enabled'
    );
    SET @system_image_is_enabled_column_sql = IF(
      @system_image_is_enabled_column_exists = 0,
      'ALTER TABLE system_image_settings ADD COLUMN is_enabled BOOLEAN NOT NULL DEFAULT TRUE',
      'SELECT 1'
    );
    PREPARE system_image_is_enabled_column_stmt FROM @system_image_is_enabled_column_sql;
    EXECUTE system_image_is_enabled_column_stmt;
    DEALLOCATE PREPARE system_image_is_enabled_column_stmt;

    SET @system_image_unique_instance_type_index_name = (
      SELECT INDEX_NAME
      FROM information_schema.STATISTICS
      WHERE TABLE_SCHEMA = DATABASE()
        AND TABLE_NAME = 'system_image_settings'
        AND COLUMN_NAME = 'instance_type'
        AND NON_UNIQUE = 0
        AND INDEX_NAME <> 'PRIMARY'
      LIMIT 1
    );
    SET @system_image_unique_instance_type_index_sql = IF(
      @system_image_unique_instance_type_index_name IS NOT NULL,
      CONCAT(
        'ALTER TABLE system_image_settings DROP INDEX `',
        REPLACE(@system_image_unique_instance_type_index_name, '`', '``'),
        '`'
      ),
      'SELECT 1'
    );
    PREPARE system_image_unique_instance_type_index_stmt FROM @system_image_unique_instance_type_index_sql;
    EXECUTE system_image_unique_instance_type_index_stmt;
    DEALLOCATE PREPARE system_image_unique_instance_type_index_stmt;

    INSERT INTO system_image_settings (instance_type, runtime_type, display_name, image, is_enabled)
    SELECT
      'openclaw',
      'desktop',
      'OpenClaw Desktop',
      'ghcr.io/yuan-lab-llm/agentsruntime/openclaw:latest',
      TRUE
    WHERE NOT EXISTS (
      SELECT 1
      FROM system_image_settings
      WHERE instance_type = 'openclaw'
        AND runtime_type = 'desktop'
    )
    AND NOT EXISTS (
      SELECT 1
      FROM system_image_settings
      WHERE instance_type = 'openclaw'
        AND is_enabled = FALSE
    );

    INSERT INTO system_image_settings (instance_type, runtime_type, display_name, image, is_enabled)
    SELECT
      'openclaw',
      'shell',
      'OpenClaw Lite',
      'ghcr.io/yuan-lab-llm/agentsruntime/openclaw-lite:latest',
      TRUE
    WHERE NOT EXISTS (
      SELECT 1
      FROM system_image_settings
      WHERE instance_type = 'openclaw'
        AND runtime_type = 'shell'
    )
    AND NOT EXISTS (
      SELECT 1
      FROM system_image_settings
      WHERE instance_type = 'openclaw'
        AND is_enabled = FALSE
    );
  022_add_openclaw_config_bundle_skills.sql: |
    USE clawmanager;
    CREATE TABLE IF NOT EXISTS openclaw_config_bundle_skills (
      id INT AUTO_INCREMENT PRIMARY KEY,
      bundle_id INT NOT NULL,
      skill_id INT NOT NULL,
      sort_order INT NOT NULL DEFAULT 0,
      required BOOLEAN NOT NULL DEFAULT TRUE,
      created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
      FOREIGN KEY (bundle_id) REFERENCES openclaw_config_bundles(id) ON DELETE CASCADE,
      FOREIGN KEY (skill_id) REFERENCES skills(id) ON DELETE CASCADE,
      UNIQUE KEY uk_openclaw_bundle_skill (bundle_id, skill_id),
      INDEX idx_openclaw_bundle_skill_bundle (bundle_id, sort_order)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  023_normalize_runtime_config_mounts.sql: |
    USE clawmanager;
    UPDATE instances
    SET mount_path = '/config',
        updated_at = CURRENT_TIMESTAMP
    WHERE type IN ('openclaw', 'ubuntu', 'webtop', 'hermes')
      AND mount_path IN ('/data', '/home/user/data', '/config/.hermes');
  031_add_hermes_lite_runtime_image.sql: |
    USE clawmanager;
    UPDATE system_image_settings
    SET
      image = 'ghcr.io/yuan-lab-llm/agentsruntime/hermes-lite:latest',
      display_name = 'Hermes Lite',
      is_enabled = TRUE
    WHERE instance_type = 'hermes'
      AND runtime_type = 'shell'
      AND image IN (
        'ghcr.io/yuan-lab-llm/agentsruntime/hermes-shell:latest',
        'registry.example.com/your-custom-shell-image:latest'
      );

    INSERT INTO system_image_settings (instance_type, runtime_type, display_name, image, is_enabled)
    SELECT
      'hermes',
      'shell',
      'Hermes Lite',
      'ghcr.io/yuan-lab-llm/agentsruntime/hermes-lite:latest',
      TRUE
    WHERE NOT EXISTS (
      SELECT 1
      FROM system_image_settings
      WHERE instance_type = 'hermes'
        AND runtime_type = 'shell'
    )
    AND NOT EXISTS (
      SELECT 1
      FROM system_image_settings
      WHERE instance_type = 'hermes'
        AND is_enabled = FALSE
    );
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-data
  namespace: clawmanager-system
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: longhorn
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: minio-data
  namespace: clawmanager-system
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: longhorn
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: redis-data
  namespace: clawmanager-system
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: longhorn
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: clawmanager-workspaces
  namespace: clawmanager-system
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 50Gi
  storageClassName: longhorn-rwx
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  namespace: clawmanager-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
        - name: mysql
          image: mysql:8.4.8
          imagePullPolicy: IfNotPresent
          args:
            - "--innodb-use-native-aio=0"
          ports:
            - containerPort: 3306
          env:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: mysql-root-password
            - name: MYSQL_DATABASE
              value: clawmanager
            - name: MYSQL_USER
              value: clawmanager
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: mysql-password
          volumeMounts:
            - name: mysql-data
              mountPath: /var/lib/mysql
            - name: mysql-init
              mountPath: /docker-entrypoint-initdb.d
          readinessProbe:
            exec:
              command: ["sh", "-c", "mysqladmin ping -h 127.0.0.1 -uroot -p$MYSQL_ROOT_PASSWORD"]
            initialDelaySeconds: 20
            periodSeconds: 10
      volumes:
        - name: mysql-data
          persistentVolumeClaim:
            claimName: mysql-data
        - name: mysql-init
          configMap:
            name: clawmanager-mysql-init
---
apiVersion: v1
kind: Service
metadata:
  name: mysql
  namespace: clawmanager-system
spec:
  selector:
    app: mysql
  ports:
    - name: mysql
      port: 3306
      targetPort: 3306
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: minio
  namespace: clawmanager-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: minio
  template:
    metadata:
      labels:
        app: minio
    spec:
      containers:
        - name: minio
          image: minio/minio:latest
          imagePullPolicy: IfNotPresent
          args:
            - server
            - /data
            - --console-address
            - ":9001"
          env:
            - name: MINIO_ROOT_USER
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: minio-root-user
            - name: MINIO_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: minio-root-password
          ports:
            - name: api
              containerPort: 9000
            - name: console
              containerPort: 9001
          volumeMounts:
            - name: minio-data
              mountPath: /data
          readinessProbe:
            tcpSocket:
              port: api
            initialDelaySeconds: 10
            periodSeconds: 10
      volumes:
        - name: minio-data
          persistentVolumeClaim:
            claimName: minio-data
---
apiVersion: v1
kind: Service
metadata:
  name: minio
  namespace: clawmanager-system
spec:
  selector:
    app: minio
  ports:
    - name: api
      port: 9000
      targetPort: api
    - name: console
      port: 9001
      targetPort: console
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: clawmanager-team-redis
  namespace: clawmanager-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: clawmanager-team-redis
  template:
    metadata:
      labels:
        app: clawmanager-team-redis
    spec:
      containers:
        - name: redis
          image: redis:7-alpine
          imagePullPolicy: IfNotPresent
          args:
            - redis-server
            - --appendonly
            - "yes"
          ports:
            - name: redis
              containerPort: 6379
          readinessProbe:
            tcpSocket:
              port: redis
            initialDelaySeconds: 5
            periodSeconds: 10
          volumeMounts:
            - name: redis-data
              mountPath: /data
      volumes:
        - name: redis-data
          persistentVolumeClaim:
            claimName: redis-data
---
apiVersion: v1
kind: Service
metadata:
  name: clawmanager-redis
  namespace: clawmanager-system
spec:
  selector:
    app: clawmanager-team-redis
  ports:
    - name: redis
      port: 6379
      targetPort: redis
---
apiVersion: v1
kind: Service
metadata:
  name: clawmanager-team-redis
  namespace: clawmanager-system
spec:
  selector:
    app: clawmanager-team-redis
  ports:
    - name: redis
      port: 6379
      targetPort: redis
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: clawmanager-app
  namespace: clawmanager-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: clawmanager-runtime-manager
rules:
  - apiGroups:
      - coordination.k8s.io
    resources:
      - leases
    verbs:
      - get
      - create
      - update
  - apiGroups:
      - apps
    resources:
      - deployments
      - deployments/scale
    verbs:
      - get
      - list
      - watch
      - create
      - update
      - patch
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - get
      - list
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: clawmanager-runtime-manager
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: clawmanager-runtime-manager
subjects:
  - kind: ServiceAccount
    name: clawmanager-app
    namespace: clawmanager-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: clawmanager-app-cluster-admin
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: clawmanager-app
    namespace: clawmanager-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: skill-scanner
  namespace: clawmanager-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: skill-scanner
  template:
    metadata:
      labels:
        app: skill-scanner
    spec:
      containers:
        - name: skill-scanner
          image: ghcr.io/yuan-lab-llm/skill-scanner:latest
          imagePullPolicy: IfNotPresent
          command:
            - /opt/skill-scanner-venv/bin/skill-scanner-api
            - --host
            - 0.0.0.0
            - --port
            - "8000"
          env:
            - name: SKILL_SCANNER_LLM_API_KEY
              value: ""
            - name: SKILL_SCANNER_LLM_MODEL
              value: ""
            - name: SKILL_SCANNER_LLM_BASE_URL
              value: ""
            - name: SKILL_SCANNER_META_LLM_API_KEY
              value: ""
            - name: SKILL_SCANNER_META_LLM_MODEL
              value: ""
            - name: SKILL_SCANNER_META_LLM_BASE_URL
              value: ""
          ports:
            - name: http
              containerPort: 8000
---
apiVersion: v1
kind: Service
metadata:
  name: skill-scanner
  namespace: clawmanager-system
spec:
  selector:
    app: skill-scanner
  ports:
    - name: http
      port: 8000
      targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: clawmanager-app
  namespace: clawmanager-system
spec:
  replicas: 3
  selector:
    matchLabels:
      app: clawmanager-app
  template:
    metadata:
      labels:
        app: clawmanager-app
    spec:
      serviceAccountName: clawmanager-app
      containers:
        - name: clawmanager-app
          image: ghcr.io/yuan-lab-llm/clawmanager:latest
          imagePullPolicy: IfNotPresent
          ports:
            - name: https
              containerPort: 8443
            - name: proxy
              containerPort: 9001
          env:
            - name: SERVER_ADDRESS
              value: ":9001"
            - name: SERVER_MODE
              value: "release"
            - name: DB_HOST
              value: "mysql"
            - name: DB_PORT
              value: "3306"
            - name: DB_USER
              value: "clawmanager"
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: mysql-password
            - name: DB_NAME
              value: "clawmanager"
            - name: JWT_SECRET
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: jwt-secret
            - name: OBJECT_STORAGE_ENDPOINT
              value: "minio.clawmanager-system.svc.cluster.local:9000"
            - name: OBJECT_STORAGE_REGION
              value: ""
            - name: OBJECT_STORAGE_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: minio-access-key
            - name: OBJECT_STORAGE_SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: minio-secret-key
            - name: OBJECT_STORAGE_BUCKET
              value: "clawmanager-skills"
            - name: OBJECT_STORAGE_USE_SSL
              value: "false"
            - name: OBJECT_STORAGE_BASE_PATH
              value: "skills"
            - name: OBJECT_STORAGE_FORCE_PATH_STYLE
              value: "true"
            - name: K8S_MODE
              value: "incluster"
            - name: K8S_NAMESPACE
              value: "clawmanager"
            - name: K8S_STORAGE_CLASS
              value: "longhorn"
            - name: CLAWMANAGER_STORAGE_PROFILE
              value: "cluster"
            - name: K8S_HOSTPATH_FALLBACK_ENABLED
              value: "false"
            - name: K8S_PVC_BIND_TIMEOUT
              value: "2m"
            - name: K8S_CONTROL_PLANE_STORAGE_CLASS
              value: "longhorn"
            - name: K8S_INSTANCE_STORAGE_CLASS
              value: "longhorn"
            - name: K8S_WORKSPACE_STORAGE_CLASS
              value: "longhorn-rwx"
            - name: K8S_WORKSPACE_ACCESS_MODE
              value: "ReadWriteMany"
            - name: CLAWMANAGER_WORKSPACE_ARCHIVE_MAX_MIB
              value: "500"
            - name: PLATFORM_REDIS_URL
              value: "redis://clawmanager-redis.clawmanager-system.svc.cluster.local:6379/0"
            - name: TEAM_REDIS_URL
              value: "redis://clawmanager-redis.clawmanager-system.svc.cluster.local:6379/0"
            - name: CLAWMANAGER_DESKTOP_DIRECT_PROXY
              value: "true"
            - name: CLAWMANAGER_TEAM_REDIS_URL
              value: "redis://clawmanager-redis.clawmanager-system.svc.cluster.local:6379/0"
            - name: CLAWMANAGER_TEAM_MANAGER_BASE_URL
              value: "http://clawmanager-gateway.clawmanager-system.svc.cluster.local:9001"
            - name: RUNTIME_NAMESPACE
              value: "clawmanager-system"
            - name: RUNTIME_WORKSPACE_ROOT
              value: "/workspaces"
            - name: RUNTIME_WORKSPACE_PVC_CLAIM
              value: "clawmanager-workspaces"
            - name: RUNTIME_MAX_GATEWAYS_PER_POD
              value: "100"
            - name: RUNTIME_GATEWAY_PORT_START
              value: "20000"
            - name: RUNTIME_GATEWAY_PORT_END
              value: "20299"
            - name: RUNTIME_SCHEDULER_ENABLED
              value: "true"
            - name: RUNTIME_HEARTBEAT_TIMEOUT
              value: "10s"
            - name: RUNTIME_AGENT_CONTROL_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: runtime-agent-control-token
            - name: RUNTIME_AGENT_REPORT_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: runtime-agent-report-token
            - name: OPENCLAW_GATEWAY_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: openclaw-gateway-token
            - name: SKILL_SCANNER_ENABLED
              value: "true"
            - name: SKILL_SCANNER_BASE_URL
              value: "http://skill-scanner.clawmanager-system.svc.cluster.local:8000"
            - name: SKILL_SCANNER_TIMEOUT_SECONDS
              value: "120"
            - name: SKILL_SCANNER_NAMESPACE
              value: "clawmanager-system"
            - name: SKILL_SCANNER_DEPLOYMENT
              value: "skill-scanner"
          volumeMounts:
            - name: tls-cert
              mountPath: /var/run/clawreef-tls
              readOnly: true
            - name: workspaces
              mountPath: /workspaces
          readinessProbe:
            httpGet:
              scheme: HTTPS
              path: /healthz
              port: https
            initialDelaySeconds: 10
            periodSeconds: 10
          livenessProbe:
            httpGet:
              scheme: HTTPS
              path: /healthz
              port: https
            initialDelaySeconds: 30
            periodSeconds: 20
      volumes:
        - name: tls-cert
          secret:
            secretName: clawmanager-tls
            optional: true
        - name: workspaces
          persistentVolumeClaim:
            claimName: clawmanager-workspaces
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: openclaw-runtime
  namespace: clawmanager-system
  labels:
    app: openclaw-runtime
    clawmanager.io/runtime-type: openclaw
spec:
  replicas: 1
  selector:
    matchLabels:
      app: openclaw-runtime
      clawmanager.io/runtime-type: openclaw
  template:
    metadata:
      labels:
        app: openclaw-runtime
        clawmanager.io/runtime-type: openclaw
    spec:
      containers:
        - name: runtime
          image: ghcr.io/yuan-lab-llm/agentsruntime/openclaw-lite:latest
          imagePullPolicy: Always
          env:
            - name: CLAWMANAGER_RUNTIME_TYPE
              value: openclaw
            - name: CLAWMANAGER_BACKEND_URL
              value: "http://clawmanager-gateway.clawmanager-system.svc.cluster.local:9001"
            - name: CLAWMANAGER_RUNTIME_DEPLOYMENT_NAME
              value: openclaw-runtime
            - name: CLAWMANAGER_RUNTIME_IMAGE_REF
              value: ghcr.io/yuan-lab-llm/agentsruntime/openclaw-lite:latest
            - name: RUNTIME_WORKSPACE_ROOT
              value: /workspaces
            - name: RUNTIME_GATEWAY_PORT_START
              value: "20000"
            - name: RUNTIME_GATEWAY_PORT_END
              value: "20299"
            - name: RUNTIME_AGENT_LISTEN_ADDR
              value: "0.0.0.0:19090"
            - name: RUNTIME_AGENT_PUBLIC_PORT
              value: "19090"
            - name: RUNTIME_GATEWAY_COMMAND
              value: "/usr/local/bin/openclaw gateway run --allow-unconfigured --auth token --bind lan --force"
            - name: OPENCLAW_GATEWAY_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: openclaw-gateway-token
            - name: RUNTIME_AGENT_CONTROL_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: runtime-agent-control-token
            - name: RUNTIME_AGENT_REPORT_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: runtime-agent-report-token
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          ports:
            - name: agent
              containerPort: 19090
          volumeMounts:
            - name: workspaces
              mountPath: /workspaces
      volumes:
        - name: workspaces
          persistentVolumeClaim:
            claimName: clawmanager-workspaces
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hermes-runtime
  namespace: clawmanager-system
  labels:
    app: hermes-runtime
    clawmanager.io/runtime-type: hermes
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hermes-runtime
      clawmanager.io/runtime-type: hermes
  template:
    metadata:
      labels:
        app: hermes-runtime
        clawmanager.io/runtime-type: hermes
    spec:
      containers:
        - name: runtime
          image: ghcr.io/yuan-lab-llm/agentsruntime/hermes-lite:latest
          imagePullPolicy: IfNotPresent
          env:
            - name: CLAWMANAGER_RUNTIME_TYPE
              value: hermes
            - name: CLAWMANAGER_BACKEND_URL
              value: "http://clawmanager-gateway.clawmanager-system.svc.cluster.local:9001"
            - name: CLAWMANAGER_RUNTIME_DEPLOYMENT_NAME
              value: hermes-runtime
            - name: CLAWMANAGER_RUNTIME_IMAGE_REF
              value: ghcr.io/yuan-lab-llm/agentsruntime/hermes-lite:latest
            - name: CLAWMANAGER_AGENT_PORT
              value: "19090"
            - name: CLAWMANAGER_GATEWAY_PORT_START
              value: "20000"
            - name: CLAWMANAGER_GATEWAY_PORT_END
              value: "20299"
            - name: HERMES_TUI_DIR
              value: /usr/local/lib/hermes-agent/ui-tui
            - name: CLAWMANAGER_AGENT_CONTROL_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: runtime-agent-control-token
            - name: CLAWMANAGER_AGENT_REPORT_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: runtime-agent-report-token
            - name: RUNTIME_WORKSPACE_ROOT
              value: /workspaces
            - name: RUNTIME_AGENT_LISTEN_ADDR
              value: "0.0.0.0:19090"
            - name: RUNTIME_AGENT_PUBLIC_PORT
              value: "19090"
            - name: RUNTIME_GATEWAY_PORT_START
              value: "20000"
            - name: RUNTIME_GATEWAY_PORT_END
              value: "20299"
            - name: RUNTIME_AGENT_CONTROL_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: runtime-agent-control-token
            - name: RUNTIME_AGENT_REPORT_TOKEN
              valueFrom:
                secretKeyRef:
                  name: clawmanager-secrets
                  key: runtime-agent-report-token
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          ports:
            - name: agent
              containerPort: 19090
          volumeMounts:
            - name: workspaces
              mountPath: /workspaces
      volumes:
        - name: workspaces
          persistentVolumeClaim:
            claimName: clawmanager-workspaces
---
apiVersion: v1
kind: Service
metadata:
  name: clawmanager-frontend
  namespace: clawmanager-system
spec:
  type: NodePort
  selector:
    app: clawmanager-app
  ports:
    - name: https
      port: 443
      targetPort: https
      nodePort: 30443
---
apiVersion: v1
kind: Service
metadata:
  name: clawmanager-gateway
  namespace: clawmanager-system
spec:
  type: ClusterIP
  selector:
    app: clawmanager-app
  ports:
    - name: api
      port: 9001
      targetPort: 9001
---
apiVersion: v1
kind: Service
metadata:
  name: clawmanager-egress-proxy
  namespace: clawmanager-system
spec:
  type: ClusterIP
  selector:
    app: clawmanager-app
  ports:
    - name: proxy
      port: 3128
      targetPort: 9001
