diff --git a/bin/update.sh b/bin/update.sh index 47e1fa8..0156196 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -20,7 +20,7 @@ mv files/longhorn{,.old} mv generated files/longhorn echo -e "---\nstorage_longhorn_files_list:" > vars/longhorn.yaml cat generated.log | while read LIGNE; do if [ $(echo "${LIGNE}" | grep -c ^File) -eq 1 ]; then echo -n "${LIGNE} "; else echo "${LIGNE}"; fi; done | grep ^File | sort -V | sed 's|.*\(generated/\)\(.*\.yaml\)| - "\2"|' >> vars/longhorn.yaml -sed '/numberOfReplicas/ s/3/2/' -i files/longhorn/longhorn-StorageClass.yaml +sed '/numberOfReplicas/ s/3/2/' -i files/longhorn/longhorn-storageclass-ConfigMap.yaml sed '/default-data-path/ s|:.*$|: "/var/lib/longhorn/"|' -i files/longhorn/longhorn-default-setting-ConfigMap.yaml rm -fr files/longhorn.old generated.log longhorn.yaml diff --git a/files/longhorn/engineimages.longhorn.io-CustomResourceDefinition.yaml b/files/longhorn/engineimages.longhorn.io-CustomResourceDefinition.yaml index dcd6100..0f665ee 100644 --- a/files/longhorn/engineimages.longhorn.io-CustomResourceDefinition.yaml +++ b/files/longhorn/engineimages.longhorn.io-CustomResourceDefinition.yaml @@ -1,4 +1,4 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: labels: @@ -14,6 +14,37 @@ spec: - lhei singular: engineimage scope: Namespaced - version: v1beta1 - subresources: - status: {} + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + x-kubernetes-preserve-unknown-fields: true + status: + x-kubernetes-preserve-unknown-fields: true + subresources: + status: {} + additionalPrinterColumns: + - name: State + type: string + description: State of the engine image + jsonPath: .status.state + - name: Image + type: string + description: The Longhorn engine image + jsonPath: .spec.image + - name: RefCount + type: integer + description: Number of volumes are using the engine image + jsonPath: .status.refCount + - name: BuildDate + type: date + description: The build date of the engine image + jsonPath: .status.buildDate + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/files/longhorn/engines.longhorn.io-CustomResourceDefinition.yaml b/files/longhorn/engines.longhorn.io-CustomResourceDefinition.yaml index eb34f0f..7dd200a 100644 --- a/files/longhorn/engines.longhorn.io-CustomResourceDefinition.yaml +++ b/files/longhorn/engines.longhorn.io-CustomResourceDefinition.yaml @@ -1,4 +1,4 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: labels: @@ -14,6 +14,37 @@ spec: - lhe singular: engine scope: Namespaced - version: v1beta1 - subresources: - status: {} + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + x-kubernetes-preserve-unknown-fields: true + status: + x-kubernetes-preserve-unknown-fields: true + subresources: + status: {} + additionalPrinterColumns: + - name: State + type: string + description: The current state of the engine + jsonPath: .status.currentState + - name: Node + type: string + description: The node that the engine is on + jsonPath: .spec.nodeID + - name: InstanceManager + type: string + description: The instance manager of the engine + jsonPath: .status.instanceManagerName + - name: Image + type: string + description: The current image of the engine + jsonPath: .status.currentImage + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/files/longhorn/instancemanagers.longhorn.io-CustomResourceDefinition.yaml b/files/longhorn/instancemanagers.longhorn.io-CustomResourceDefinition.yaml index 7e30ab3..b1f1623 100644 --- a/files/longhorn/instancemanagers.longhorn.io-CustomResourceDefinition.yaml +++ b/files/longhorn/instancemanagers.longhorn.io-CustomResourceDefinition.yaml @@ -1,4 +1,4 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: labels: @@ -14,6 +14,33 @@ spec: - lhim singular: instancemanager scope: Namespaced - version: v1beta1 - subresources: - status: {} + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + x-kubernetes-preserve-unknown-fields: true + status: + x-kubernetes-preserve-unknown-fields: true + subresources: + status: {} + additionalPrinterColumns: + - name: State + type: string + description: The state of the instance manager + jsonPath: .status.currentState + - name: Type + type: string + description: The type of the instance manager (engine or replica) + jsonPath: .spec.type + - name: Node + type: string + description: The node that the instance manager is running on + jsonPath: .spec.nodeID + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/files/longhorn/longhorn-StorageClass.yaml b/files/longhorn/longhorn-StorageClass.yaml deleted file mode 100644 index ee05ff3..0000000 --- a/files/longhorn/longhorn-StorageClass.yaml +++ /dev/null @@ -1,15 +0,0 @@ -kind: StorageClass -apiVersion: storage.k8s.io/v1 -metadata: - name: longhorn -provisioner: driver.longhorn.io -allowVolumeExpansion: true -parameters: - numberOfReplicas: "2" - staleReplicaTimeout: "2880" - fromBackup: "" -# diskSelector: "ssd,fast" -# nodeSelector: "storage,fast" -# recurringJobs: '[{"name":"snap", "task":"snapshot", "cron":"*/1 * * * *", "retain":1}, -# {"name":"backup", "task":"backup", "cron":"*/2 * * * *", "retain":1, -# "labels": {"interval":"2m"}}]' diff --git a/files/longhorn/longhorn-default-setting-ConfigMap.yaml b/files/longhorn/longhorn-default-setting-ConfigMap.yaml index ed8c95c..50ac253 100644 --- a/files/longhorn/longhorn-default-setting-ConfigMap.yaml +++ b/files/longhorn/longhorn-default-setting-ConfigMap.yaml @@ -7,6 +7,7 @@ data: default-setting.yaml: |- backup-target: backup-target-credential-secret: + allow-recurring-job-while-volume-detached: create-default-disk-labeled-nodes: default-data-path: "/var/lib/longhorn/" replica-soft-anti-affinity: @@ -14,14 +15,23 @@ data: storage-minimal-available-percentage: upgrade-checker: default-replica-count: + default-data-locality: guaranteed-engine-cpu: default-longhorn-static-storage-class: backupstore-poll-interval: taint-toleration: priority-class: - registry-secret: auto-salvage: + auto-delete-pod-when-volume-detached-unexpectedly: disable-scheduling-on-cordoned-node: replica-zone-soft-anti-affinity: volume-attachment-recovery-policy: + node-down-pod-deletion-policy: + allow-node-drain-with-last-healthy-replica: mkfs-ext4-parameters: + disable-replica-rebuild: + replica-replenishment-wait-interval: + disable-revision-counter: + system-managed-pods-image-pull-policy: + allow-volume-creation-with-degraded-availability: + auto-cleanup-system-generated-snapshot: diff --git a/files/longhorn/longhorn-driver-deployer-Deployment.yaml b/files/longhorn/longhorn-driver-deployer-Deployment.yaml index 9790ce1..14c31f9 100644 --- a/files/longhorn/longhorn-driver-deployer-Deployment.yaml +++ b/files/longhorn/longhorn-driver-deployer-Deployment.yaml @@ -15,18 +15,18 @@ spec: spec: initContainers: - name: wait-longhorn-manager - image: longhornio/longhorn-manager:v1.0.2 + image: longhornio/longhorn-manager:v1.1.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: longhornio/longhorn-manager:v1.0.2 + image: longhornio/longhorn-manager:v1.1.0 imagePullPolicy: IfNotPresent command: - longhorn-manager - -d - deploy-driver - --manager-image - - longhornio/longhorn-manager:v1.0.2 + - longhornio/longhorn-manager:v1.1.0 - --manager-url - http://longhorn-backend:9500/v1 env: @@ -48,13 +48,15 @@ spec: # For AirGap Installation # Replace PREFIX with your private registery #- name: CSI_ATTACHER_IMAGE - # value: PREFIX/csi-attacher:v2.0.0 + # value: PREFIX/csi-attacher:v2.2.1-lh1 #- name: CSI_PROVISIONER_IMAGE - # value: PREFIX/csi-provisioner:v1.4.0 + # value: PREFIX/csi-provisioner:v1.6.0-lh1 #- name: CSI_NODE_DRIVER_REGISTRAR_IMAGE - # value: PREFIX/csi-node-driver-registrar:v1.2.0 + # value: PREFIX/csi-node-driver-registrar:v1.2.0-lh1 #- name: CSI_RESIZER_IMAGE - # value: PREFIX/csi-resizer:v0.3.0 + # value: PREFIX/csi-resizer:v0.5.1-lh1 + #- name: CSI_SNAPSHOTTER_IMAGE + # value: PREFIX/csi-snapshotter:v2.1.1-lh1 # Manually specify number of CSI attacher replicas #- name: CSI_ATTACHER_REPLICA_COUNT # value: "3" @@ -63,6 +65,8 @@ spec: # value: "3" #- name: CSI_RESIZER_REPLICA_COUNT # value: "3" + #- name: CSI_SNAPSHOTTER_REPLICA_COUNT + # value: "3" #imagePullSecrets: #- name: serviceAccountName: longhorn-service-account diff --git a/files/longhorn/longhorn-manager-DaemonSet.yaml b/files/longhorn/longhorn-manager-DaemonSet.yaml index 8e43de6..79f0ed6 100644 --- a/files/longhorn/longhorn-manager-DaemonSet.yaml +++ b/files/longhorn/longhorn-manager-DaemonSet.yaml @@ -16,7 +16,7 @@ spec: spec: containers: - name: longhorn-manager - image: longhornio/longhorn-manager:v1.0.2 + image: longhornio/longhorn-manager:v1.1.0 imagePullPolicy: IfNotPresent securityContext: privileged: true @@ -25,11 +25,13 @@ spec: - -d - daemon - --engine-image - - longhornio/longhorn-engine:v1.0.2 + - longhornio/longhorn-engine:v1.1.0 - --instance-manager-image - - longhornio/longhorn-instance-manager:v1_20200514 + - longhornio/longhorn-instance-manager:v1_20201216 + - --share-manager-image + - longhornio/longhorn-share-manager:v1_20201204 - --manager-image - - longhornio/longhorn-manager:v1.0.2 + - longhornio/longhorn-manager:v1.1.0 - --service-account - longhorn-service-account ports: @@ -43,9 +45,6 @@ spec: mountPath: /host/dev/ - name: proc mountPath: /host/proc/ - - name: varrun - mountPath: /var/run/ - mountPropagation: Bidirectional - name: longhorn mountPath: /var/lib/longhorn/ mountPropagation: Bidirectional @@ -74,9 +73,6 @@ spec: - name: proc hostPath: path: /proc/ - - name: varrun - hostPath: - path: /var/run/ - name: longhorn hostPath: path: /var/lib/longhorn/ diff --git a/files/longhorn/longhorn-role-ClusterRole.yaml b/files/longhorn/longhorn-role-ClusterRole.yaml index bdf4e6c..6e71da6 100644 --- a/files/longhorn/longhorn-role-ClusterRole.yaml +++ b/files/longhorn/longhorn-role-ClusterRole.yaml @@ -21,19 +21,26 @@ rules: - apiGroups: ["batch"] resources: ["jobs", "cronjobs"] verbs: ["*"] +- apiGroups: ["policy"] + resources: ["poddisruptionbudgets"] + verbs: ["*"] - apiGroups: ["scheduling.k8s.io"] resources: ["priorityclasses"] verbs: ["watch", "list"] - apiGroups: ["storage.k8s.io"] resources: ["storageclasses", "volumeattachments", "csinodes", "csidrivers"] verbs: ["*"] -- apiGroups: ["coordination.k8s.io"] - resources: ["leases"] - verbs: ["get", "watch", "list", "delete", "update", "create"] +- apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshotclasses", "volumesnapshots", "volumesnapshotcontents", "volumesnapshotcontents/status"] + verbs: ["*"] - apiGroups: ["longhorn.io"] resources: ["volumes", "volumes/status", "engines", "engines/status", "replicas", "replicas/status", "settings", - "engineimages", "engineimages/status", "nodes", "nodes/status", "instancemanagers", "instancemanagers/status"] + "engineimages", "engineimages/status", "nodes", "nodes/status", "instancemanagers", "instancemanagers/status", + "sharemanagers", "sharemanagers/status"] verbs: ["*"] - apiGroups: ["coordination.k8s.io"] resources: ["leases"] verbs: ["*"] +- apiGroups: ["metrics.k8s.io"] + resources: ["pods", "nodes"] + verbs: ["get", "list"] diff --git a/files/longhorn/longhorn-storageclass-ConfigMap.yaml b/files/longhorn/longhorn-storageclass-ConfigMap.yaml new file mode 100644 index 0000000..47099be --- /dev/null +++ b/files/longhorn/longhorn-storageclass-ConfigMap.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: longhorn-storageclass + namespace: longhorn-system +data: + storageclass.yaml: | + kind: StorageClass + apiVersion: storage.k8s.io/v1 + metadata: + name: longhorn + provisioner: driver.longhorn.io + allowVolumeExpansion: true + reclaimPolicy: Delete + volumeBindingMode: Immediate + parameters: + numberOfReplicas: "2" + staleReplicaTimeout: "2880" + fromBackup: "" + # diskSelector: "ssd,fast" + # nodeSelector: "storage,fast" + # recurringJobs: '[{"name":"snap", "task":"snapshot", "cron":"*/1 * * * *", "retain":1}, + # {"name":"backup", "task":"backup", "cron":"*/2 * * * *", "retain":1, + # "labels": {"interval":"2m"}}]' diff --git a/files/longhorn/longhorn-ui-Deployment.yaml b/files/longhorn/longhorn-ui-Deployment.yaml index 1ecf6a3..276d8e6 100644 --- a/files/longhorn/longhorn-ui-Deployment.yaml +++ b/files/longhorn/longhorn-ui-Deployment.yaml @@ -17,7 +17,7 @@ spec: spec: containers: - name: longhorn-ui - image: longhornio/longhorn-ui:v1.0.2 + image: longhornio/longhorn-ui:v1.1.0 imagePullPolicy: IfNotPresent securityContext: runAsUser: 0 diff --git a/files/longhorn/nodes.longhorn.io-CustomResourceDefinition.yaml b/files/longhorn/nodes.longhorn.io-CustomResourceDefinition.yaml index 74dba45..40364fe 100644 --- a/files/longhorn/nodes.longhorn.io-CustomResourceDefinition.yaml +++ b/files/longhorn/nodes.longhorn.io-CustomResourceDefinition.yaml @@ -1,4 +1,4 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: labels: @@ -14,6 +14,33 @@ spec: - lhn singular: node scope: Namespaced - version: v1beta1 - subresources: - status: {} + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + x-kubernetes-preserve-unknown-fields: true + status: + x-kubernetes-preserve-unknown-fields: true + subresources: + status: {} + additionalPrinterColumns: + - name: Ready + type: string + description: Indicate whether the node is ready + jsonPath: .status.conditions['Ready']['status'] + - name: AllowScheduling + type: boolean + description: Indicate whether the user disabled/enabled replica scheduling for the node + jsonPath: .spec.allowScheduling + - name: Schedulable + type: string + description: Indicate whether Longhorn can schedule replicas on the node + jsonPath: .status.conditions['Schedulable']['status'] + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/files/longhorn/replicas.longhorn.io-CustomResourceDefinition.yaml b/files/longhorn/replicas.longhorn.io-CustomResourceDefinition.yaml index ad8dd2c..c59559a 100644 --- a/files/longhorn/replicas.longhorn.io-CustomResourceDefinition.yaml +++ b/files/longhorn/replicas.longhorn.io-CustomResourceDefinition.yaml @@ -1,4 +1,4 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: labels: @@ -14,6 +14,41 @@ spec: - lhr singular: replica scope: Namespaced - version: v1beta1 - subresources: - status: {} + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + x-kubernetes-preserve-unknown-fields: true + status: + x-kubernetes-preserve-unknown-fields: true + subresources: + status: {} + additionalPrinterColumns: + - name: State + type: string + description: The current state of the replica + jsonPath: .status.currentState + - name: Node + type: string + description: The node that the replica is on + jsonPath: .spec.nodeID + - name: Disk + type: string + description: The disk that the replica is on + jsonPath: .spec.diskID + - name: InstanceManager + type: string + description: The instance manager of the replica + jsonPath: .status.instanceManagerName + - name: Image + type: string + description: The current image of the replica + jsonPath: .status.currentImage + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/files/longhorn/settings.longhorn.io-CustomResourceDefinition.yaml b/files/longhorn/settings.longhorn.io-CustomResourceDefinition.yaml index f8117f7..fcb6990 100644 --- a/files/longhorn/settings.longhorn.io-CustomResourceDefinition.yaml +++ b/files/longhorn/settings.longhorn.io-CustomResourceDefinition.yaml @@ -1,4 +1,4 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: labels: @@ -14,4 +14,18 @@ spec: - lhs singular: setting scope: Namespaced - version: v1beta1 + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + x-kubernetes-preserve-unknown-fields: true + additionalPrinterColumns: + - name: Value + type: string + description: The value of the setting + jsonPath: .value + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/files/longhorn/sharemanagers.longhorn.io-CustomResourceDefinition.yaml b/files/longhorn/sharemanagers.longhorn.io-CustomResourceDefinition.yaml new file mode 100644 index 0000000..f2cff59 --- /dev/null +++ b/files/longhorn/sharemanagers.longhorn.io-CustomResourceDefinition.yaml @@ -0,0 +1,42 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + labels: + longhorn-manager: ShareManager + name: sharemanagers.longhorn.io +spec: + group: longhorn.io + names: + kind: ShareManager + listKind: ShareManagerList + plural: sharemanagers + shortNames: + - lhsm + singular: sharemanager + scope: Namespaced + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + x-kubernetes-preserve-unknown-fields: true + status: + x-kubernetes-preserve-unknown-fields: true + subresources: + status: {} + additionalPrinterColumns: + - name: State + type: string + description: The state of the share manager + jsonPath: .status.state + - name: Node + type: string + description: The node that the share manager is owned by + jsonPath: .status.ownerID + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/files/longhorn/volumes.longhorn.io-CustomResourceDefinition.yaml b/files/longhorn/volumes.longhorn.io-CustomResourceDefinition.yaml index f473696..e1eed71 100644 --- a/files/longhorn/volumes.longhorn.io-CustomResourceDefinition.yaml +++ b/files/longhorn/volumes.longhorn.io-CustomResourceDefinition.yaml @@ -1,4 +1,4 @@ -apiVersion: apiextensions.k8s.io/v1beta1 +apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: labels: @@ -14,6 +14,41 @@ spec: - lhv singular: volume scope: Namespaced - version: v1beta1 - subresources: - status: {} + versions: + - name: v1beta1 + served: true + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + x-kubernetes-preserve-unknown-fields: true + status: + x-kubernetes-preserve-unknown-fields: true + subresources: + status: {} + additionalPrinterColumns: + - name: State + type: string + description: The state of the volume + jsonPath: .status.state + - name: Robustness + type: string + description: The robustness of the volume + jsonPath: .status.robustness + - name: Scheduled + type: string + description: The scheduled condition of the volume + jsonPath: .status.conditions['scheduled']['status'] + - name: Size + type: string + description: The size of the volume + jsonPath: .spec.size + - name: Node + type: string + description: The node that the volume is currently attaching to + jsonPath: .status.currentNodeID + - name: Age + type: date + jsonPath: .metadata.creationTimestamp diff --git a/vars/longhorn.yaml b/vars/longhorn.yaml index 2db69bb..dc20774 100644 --- a/vars/longhorn.yaml +++ b/vars/longhorn.yaml @@ -11,13 +11,14 @@ storage_longhorn_files_list: - "engineimages.longhorn.io-CustomResourceDefinition.yaml" - "nodes.longhorn.io-CustomResourceDefinition.yaml" - "instancemanagers.longhorn.io-CustomResourceDefinition.yaml" + - "sharemanagers.longhorn.io-CustomResourceDefinition.yaml" - "longhorn-default-setting-ConfigMap.yaml" - "longhorn-psp-PodSecurityPolicy.yaml" - "longhorn-psp-role-Role.yaml" - "longhorn-psp-binding-RoleBinding.yaml" + - "longhorn-storageclass-ConfigMap.yaml" - "longhorn-manager-DaemonSet.yaml" - "longhorn-backend-Service.yaml" - "longhorn-ui-Deployment.yaml" - "longhorn-frontend-Service.yaml" - "longhorn-driver-deployer-Deployment.yaml" - - "longhorn-StorageClass.yaml"