diff --git a/charts/kubezero-storage/Chart.yaml b/charts/kubezero-storage/Chart.yaml index 5654e7d..ec3f844 100644 --- a/charts/kubezero-storage/Chart.yaml +++ b/charts/kubezero-storage/Chart.yaml @@ -22,19 +22,19 @@ dependencies: - name: lvm-localpv version: 1.0.1 condition: lvm-localpv.enabled - # we patch: repository: https://openebs.github.io/lvm-localpv + repository: https://openebs.github.io/lvm-localpv - name: aws-ebs-csi-driver version: 2.18.0 condition: aws-ebs-csi-driver.enabled - # repository: https://kubernetes-sigs.github.io/aws-ebs-csi-driver + repository: https://kubernetes-sigs.github.io/aws-ebs-csi-driver - name: aws-efs-csi-driver version: 2.4.1 condition: aws-efs-csi-driver.enabled - # repository: https://kubernetes-sigs.github.io/aws-ebs-csi-driver + repository: https://kubernetes-sigs.github.io/aws-efs-csi-driver - name: gemini version: 2.0.0 condition: gemini.enabled - # repository: https://charts.fairwinds.com/stable + repository: https://charts.fairwinds.com/stable - name: k8up version: 4.2.0 condition: k8up.enabled diff --git a/charts/kubezero-storage/efs.patch b/charts/kubezero-storage/aws-efs-csi-driver.patch similarity index 100% rename from charts/kubezero-storage/efs.patch rename to charts/kubezero-storage/aws-efs-csi-driver.patch diff --git a/charts/kubezero-storage/charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml b/charts/kubezero-storage/charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml new file mode 100644 index 0000000..217db10 --- /dev/null +++ b/charts/kubezero-storage/charts/aws-ebs-csi-driver/templates/tests/helm-tester.yaml @@ -0,0 +1,223 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: ebs-csi-driver-test + annotations: + "helm.sh/hook": test + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: ebs-csi-driver-test + annotations: + "helm.sh/hook": test + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed +rules: + - apiGroups: [ "" ] + resources: + - events + - nodes + - pods + - replicationcontrollers + - serviceaccounts + - configmaps + - persistentvolumes + - persistentvolumeclaims + verbs: [ "list" ] + - apiGroups: [ "" ] + resources: + - services + - nodes + - nodes/proxy + - persistentvolumes + - persistentvolumeclaims + - pods + - pods/log + verbs: [ "get" ] + - apiGroups: [ "" ] + resources: + - namespaces + - persistentvolumes + - persistentvolumeclaims + - pods + - pods/exec + verbs: [ "create" ] + - apiGroups: [ "" ] + resources: + - namespaces + - persistentvolumes + - persistentvolumeclaims + - pods + verbs: [ "delete" ] + - apiGroups: [ "" ] + resources: + - persistentvolumeclaims + verbs: [ "update" ] + - apiGroups: [ "" ] + resources: + - pods/ephemeralcontainers + verbs: [ "patch" ] + - apiGroups: [ "" ] + resources: + - serviceaccounts + - configmaps + verbs: [ "watch" ] + - apiGroups: [ "apps" ] + resources: + - replicasets + - daemonsets + verbs: [ "list" ] + - apiGroups: [ "storage.k8s.io" ] + resources: + - storageclasses + verbs: [ "create" ] + - apiGroups: [ "storage.k8s.io" ] + resources: + - storageclasses + - csinodes + verbs: [ "get" ] + - apiGroups: [ "storage.k8s.io" ] + resources: + - storageclasses + verbs: [ "delete" ] + - apiGroups: [ "snapshot.storage.k8s.io" ] + resources: + - volumesnapshots + - volumesnapshotclasses + - volumesnapshotcontents + verbs: [ "create" ] + - apiGroups: [ "snapshot.storage.k8s.io" ] + resources: + - volumesnapshots + - volumesnapshotclasses + - volumesnapshotcontents + verbs: [ "get" ] + - apiGroups: [ "snapshot.storage.k8s.io" ] + resources: + - volumesnapshotcontents + verbs: [ "update" ] + - apiGroups: [ "snapshot.storage.k8s.io" ] + resources: + - volumesnapshots + - volumesnapshotclasses + - volumesnapshotcontents + verbs: [ "delete" ] + - apiGroups: [ "authorization.k8s.io" ] + resources: + - clusterroles + verbs: [ "list" ] + - apiGroups: [ "authorization.k8s.io" ] + resources: + - subjectaccessreviews + verbs: [ "create" ] + - apiGroups: [ "rbac.authorization.k8s.io" ] + resources: + - clusterroles + verbs: [ "list" ] + - apiGroups: [ "rbac.authorization.k8s.io" ] + resources: + - clusterrolebindings + verbs: [ "create" ] + - apiGroups: [ "apiextensions.k8s.io" ] + resources: + - customresourcedefinitions + verbs: [ "get" ] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: ebs-csi-driver-test + annotations: + "helm.sh/hook": test + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed +subjects: + - kind: ServiceAccount + name: ebs-csi-driver-test + namespace: kube-system +roleRef: + kind: ClusterRole + name: ebs-csi-driver-test + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: v1 +kind: ConfigMap +data: + manifests.yaml: | + ShortName: ebs + StorageClass: + FromFile: storageclass.yaml + SnapshotClass: + FromName: true + DriverInfo: + Name: ebs.csi.aws.com + SupportedSizeRange: + Min: 1Gi + Max: 16Ti + SupportedFsType: + xfs: {} + ext4: {} + SupportedMountOption: + dirsync: {} + TopologyKeys: ["topology.ebs.csi.aws.com/zone"] + Capabilities: + persistence: true + fsGroup: true + block: true + exec: true + snapshotDataSource: true + pvcDataSource: false + multipods: true + controllerExpansion: true + nodeExpansion: true + volumeLimits: true + topology: true + storageclass.yaml: | + kind: StorageClass + apiVersion: storage.k8s.io/v1 + metadata: + name: ebs.csi.aws.com + provisioner: ebs.csi.aws.com + volumeBindingMode: WaitForFirstConsumer +metadata: + name: ebs-csi-driver-test + annotations: + "helm.sh/hook": test + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed +--- +apiVersion: v1 +kind: Pod +metadata: + name: ebs-csi-driver-test + annotations: + "helm.sh/hook": test + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed +spec: + containers: + - name: kubetest2 + image: gcr.io/k8s-staging-test-infra/kubekins-e2e:v20220624-1a63fdd9f2-master + command: [ "/bin/sh", "-c" ] + args: + - | + cp /etc/config/storageclass.yaml /workspace/storageclass.yaml + go install sigs.k8s.io/kubetest2/...@latest + kubectl config set-cluster cluster --server=https://kubernetes.default --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt + kubectl config set-context kubetest2 --cluster=cluster + kubectl config set-credentials sa --token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) + kubectl config set-context kubetest2 --user=sa && kubectl config use-context kubetest2 + kubectl get crd volumesnapshots.snapshot.storage.k8s.io + if [ $? -eq 0 ]; then + SNAPSHOTS="|snapshot fields" + fi + export FOCUS_REGEX="\bebs.csi.aws.com\b.+(validate content|resize volume|offline PVC|AllowedTopologies|store data$SNAPSHOTS)" + kubetest2 noop --run-id='e2e-kubernetes' --test=ginkgo -- --test-package-version=$(curl https://storage.googleapis.com/kubernetes-release/release/stable-1.25.txt) --skip-regex='\[Disruptive\]|\[Serial\]' --focus-regex="$FOCUS_REGEX" --parallel=25 --test-args='-storage.testdriver=/etc/config/manifests.yaml' + volumeMounts: + - name: config-vol + mountPath: /etc/config + serviceAccountName: ebs-csi-driver-test + volumes: + - name: config-vol + configMap: + name: ebs-csi-driver-test + restartPolicy: Never diff --git a/charts/kubezero-storage/lvm.patch b/charts/kubezero-storage/lvm-localpv.patch similarity index 100% rename from charts/kubezero-storage/lvm.patch rename to charts/kubezero-storage/lvm-localpv.patch diff --git a/charts/kubezero-storage/update.sh b/charts/kubezero-storage/update.sh index d2ca852..ab4387b 100755 --- a/charts/kubezero-storage/update.sh +++ b/charts/kubezero-storage/update.sh @@ -1,40 +1,28 @@ #!/bin/bash set -ex -helm dependencies update +. ../../scripts/lib-update.sh -### Gemini -rm -rf charts/gemini -helm pull fairwinds-stable/gemini --untar --untardir charts -# Patch to run gemini on controller nodes -patch -p0 -i gemini.patch --no-backup-if-mismatch +#login_ecr_public +update_helm -# k8up -VERSION=$(yq eval '.dependencies[] | select(.name=="k8up") | .version' Chart.yaml) -curl -L -s -o crds/k8up.yaml https://github.com/k8up-io/k8up/releases/download/k8up-${VERSION}/k8up-crd.yaml +patch_chart gemini -### openEBS -VERSION=$(yq eval '.dependencies[] | select(.name=="lvm-localpv") | .version' Chart.yaml) -helm repo add openebs-lvmlocalpv https://openebs.github.io/lvm-localpv || true -rm -rf charts/lvm-localpv -helm pull openebs-lvmlocalpv/lvm-localpv --version $VERSION --untar --untardir charts -mv charts/lvm-localpv/crds/volumesnapshot* crds -patch -i lvm.patch -p0 --no-backup-if-mismatch - -### EBS -VERSION=$(yq eval '.dependencies[] | select(.name=="aws-ebs-csi-driver") | .version' Chart.yaml) -rm -rf charts/aws-ebs-csi-driver -curl -L -s -o - https://github.com/kubernetes-sigs/aws-ebs-csi-driver/releases/download/helm-chart-aws-ebs-csi-driver-${VERSION}/aws-ebs-csi-driver-${VERSION}.tgz | tar xfz - -C charts +patch_chart aws-ebs-csi-driver rm -rf charts/aws-ebs-csi-driver/templates/tests -### EFS -VERSION=$(yq eval '.dependencies[] | select(.name=="aws-efs-csi-driver") | .version' Chart.yaml) -rm -rf charts/aws-efs-csi-driver -curl -L -s -o - https://github.com/kubernetes-sigs/aws-efs-csi-driver/releases/download/helm-chart-aws-efs-csi-driver-${VERSION}/aws-efs-csi-driver-${VERSION}.tgz | tar xfz - -C charts -patch -i efs.patch -p0 --no-backup-if-mismatch +patch_chart aws-efs-csi-driver + +patch_chart lvm-localpv +# move crds +mv charts/lvm-localpv/crds/volumesnapshot* crds + +# k8up - CRDs +VERSION=$(yq eval '.dependencies[] | select(.name=="k8up") | .version' Chart.yaml) +curl -L -s -o crds/k8up.yaml https://github.com/k8up-io/k8up/releases/download/k8up-${VERSION}/k8up-crd.yaml # Metrics cd jsonnet make render -helm-docs +update_docs