diff --git a/chart/questions.yaml b/chart/questions.yaml index 2d35c7e..882f9d6 100644 --- a/chart/questions.yaml +++ b/chart/questions.yaml @@ -508,6 +508,12 @@ WARNING: group: "Longhorn Default Settings" type: boolean default: false +- variable: defaultSettings.orphanAutoDeletion + label: Orphaned Data Cleanup + description: "This setting allows Longhorn to delete the orphan resource and its corresponding orphaned data automatically. Orphan resources on down or unknown nodes will not be cleaned up automatically. + group: "Longhorn Default Settings" + type: boolean + default: false - variable: persistence.defaultClass default: "true" description: "Set as default StorageClass for Longhorn" diff --git a/chart/templates/clusterrole.yaml b/chart/templates/clusterrole.yaml index 8a2c2bd..04c8d81 100644 --- a/chart/templates/clusterrole.yaml +++ b/chart/templates/clusterrole.yaml @@ -40,7 +40,7 @@ rules: "sharemanagers", "sharemanagers/status", "backingimages", "backingimages/status", "backingimagemanagers", "backingimagemanagers/status", "backingimagedatasources", "backingimagedatasources/status", "backuptargets", "backuptargets/status", "backupvolumes", "backupvolumes/status", "backups", "backups/status", - "recurringjobs", "recurringjobs/status"] + "recurringjobs", "recurringjobs/status", "orphans", "orphans/status"] verbs: ["*"] - apiGroups: ["coordination.k8s.io"] resources: ["leases"] diff --git a/chart/templates/crds.yaml b/chart/templates/crds.yaml index 2d7d874..fa6cd51 100644 --- a/chart/templates/crds.yaml +++ b/chart/templates/crds.yaml @@ -1919,6 +1919,105 @@ metadata: creationTimestamp: null labels: {{- include "longhorn.labels" . | nindent 4 }} 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: + 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: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.7.0 + creationTimestamp: null + labels: + longhorn-manager: "" name: recurringjobs.longhorn.io spec: group: longhorn.io diff --git a/chart/templates/default-setting.yaml b/chart/templates/default-setting.yaml index 8a73319..cc40111 100644 --- a/chart/templates/default-setting.yaml +++ b/chart/templates/default-setting.yaml @@ -43,3 +43,4 @@ data: guaranteed-engine-manager-cpu: {{ .Values.defaultSettings.guaranteedEngineManagerCPU }} guaranteed-replica-manager-cpu: {{ .Values.defaultSettings.guaranteedReplicaManagerCPU }} kubernetes-cluster-autoscaler-enabled: {{ .Values.defaultSettings.kubernetesClusterAutoscalerEnabled }} + orphan-auto-deletion: {{ .Values.defaultSettings.orphanAutoDeletion }} diff --git a/chart/values.yaml b/chart/values.yaml index 4a24ba0..7c4cf47 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -115,6 +115,7 @@ defaultSettings: guaranteedEngineManagerCPU: ~ guaranteedReplicaManagerCPU: ~ kubernetesClusterAutoscalerEnabled: ~ + orphanAutoDeletion: ~ privateRegistry: createSecret: ~ registryUrl: ~ diff --git a/deploy/longhorn.yaml b/deploy/longhorn.yaml index 4515365..33521e8 100644 --- a/deploy/longhorn.yaml +++ b/deploy/longhorn.yaml @@ -98,8 +98,9 @@ data: backing-image-cleanup-wait-interval: backing-image-recovery-wait-interval: guaranteed-engine-manager-cpu: - guaranteed-replica-manager-cpu: - kubernetes-cluster-autoscaler-enabled: + guaranteed-replica-manager-cpu: + kubernetes-cluster-autoscaler-enabled: + orphan-auto-deletion: --- # Source: longhorn/templates/storageclass.yaml apiVersion: v1 @@ -2095,6 +2096,106 @@ metadata: app.kubernetes.io/instance: longhorn app.kubernetes.io/version: v1.3.0-dev 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: + 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: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] +--- +# Source: longhorn/templates/crds.yaml +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.7.0 + creationTimestamp: null + labels: + longhorn-manager: "" name: recurringjobs.longhorn.io spec: group: longhorn.io @@ -3020,7 +3121,7 @@ rules: "sharemanagers", "sharemanagers/status", "backingimages", "backingimages/status", "backingimagemanagers", "backingimagemanagers/status", "backingimagedatasources", "backingimagedatasources/status", "backuptargets", "backuptargets/status", "backupvolumes", "backupvolumes/status", "backups", "backups/status", - "recurringjobs", "recurringjobs/status"] + "recurringjobs", "recurringjobs/status", "orphans", "orphans/status"] verbs: ["*"] - apiGroups: ["coordination.k8s.io"] resources: ["leases"]