From 89b47f93baa14664b28f0e7668dce702ca6c375b Mon Sep 17 00:00:00 2001 From: sergeyberezansky <66549633+sergeyberezansky@users.noreply.github.com> Date: Sun, 9 Feb 2025 07:55:56 +0000 Subject: [PATCH 1/5] Release v2.6.1 --- README.md | 6 +++--- RELEASE.md | 10 ++++++++++ charts/csi-wekafsplugin/CHANGELOG.md | 23 ++--------------------- charts/csi-wekafsplugin/Chart.yaml | 8 ++++---- charts/csi-wekafsplugin/README.md | 6 +++--- charts/csi-wekafsplugin/values.yaml | 2 +- 6 files changed, 23 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 035aea5f..265d4904 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # CSI WekaFS Driver Helm chart for Deployment of WekaIO Container Storage Interface (CSI) plugin for WekaFS - the world fastest filesystem -![Version: 2.6.1-SNAPSHOT.6.233e4bd](https://img.shields.io/badge/Version-2.6.1--SNAPSHOT.6.233e4bd-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.6.1-SNAPSHOT.6.233e4bd](https://img.shields.io/badge/AppVersion-v2.6.1--SNAPSHOT.6.233e4bd-informational?style=flat-square) +![Version: 2.6.1](https://img.shields.io/badge/Version-2.6.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.6.1](https://img.shields.io/badge/AppVersion-v2.6.1-informational?style=flat-square) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/csi-wekafs)](https://artifacthub.io/packages/search?repo=csi-wekafs) @@ -48,7 +48,7 @@ make build |-----|------|---------|-------------| | dynamicProvisionPath | string | `"csi-volumes"` | Directory in root of file system where dynamic volumes are provisioned | | csiDriverName | string | `"csi.weka.io"` | Name of the driver (and provisioner) | -| csiDriverVersion | string | `"2.6.1-SNAPSHOT.6.233e4bd"` | CSI driver version | +| csiDriverVersion | string | `"2.6.1"` | CSI driver version | | images.livenessprobesidecar | string | `"registry.k8s.io/sig-storage/livenessprobe:v2.15.0"` | CSI liveness probe sidecar image URL | | images.attachersidecar | string | `"registry.k8s.io/sig-storage/csi-attacher:v4.8.0"` | CSI attacher sidecar image URL | | images.provisionersidecar | string | `"registry.k8s.io/sig-storage/csi-provisioner:v5.1.0"` | CSI provisioner sidecar image URL | @@ -57,7 +57,7 @@ make build | images.snapshottersidecar | string | `"registry.k8s.io/sig-storage/csi-snapshotter:v8.2.0"` | CSI snapshotter sidecar image URL | | images.nodeinfo | string | `"quay.io/weka.io/csi-wekafs"` | CSI nodeinfo sidecar image URL, used for reading node metadata | | images.csidriver | string | `"quay.io/weka.io/csi-wekafs"` | CSI driver main image URL | -| images.csidriverTag | string | `"2.6.1-SNAPSHOT.6.233e4bd"` | CSI driver tag | +| images.csidriverTag | string | `"2.6.1"` | CSI driver tag | | imagePullSecret | string | `""` | image pull secret required for image download. Must have permissions to access all images above. Should be used in case of private registry that requires authentication | | globalPluginTolerations | list | `[{"effect":"NoSchedule","key":"node-role.kubernetes.io/master","operator":"Exists"}]` | Tolerations for all CSI driver components | | controllerPluginTolerations | list | `[{"effect":"NoSchedule","key":"node-role.kubernetes.io/master","operator":"Exists"}]` | Tolerations for CSI controller component only (by default same as global) | diff --git a/RELEASE.md b/RELEASE.md index cd80648b..977f0407 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,13 @@ +# Release v2.6.1 + + +## What's Changed +### New features +* feat(CSI-321): provide ability to add custom labels to CSI components by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/445 +### Miscellaneous +* chore(deps): update helm/chart-testing-action action to v2.7.0 by @renovate in https://github.com/weka/csi-wekafs/pull/433 + + # Release v2.6.0 diff --git a/charts/csi-wekafsplugin/CHANGELOG.md b/charts/csi-wekafsplugin/CHANGELOG.md index c6f823ae..ce810753 100644 --- a/charts/csi-wekafsplugin/CHANGELOG.md +++ b/charts/csi-wekafsplugin/CHANGELOG.md @@ -2,27 +2,8 @@ ## What's Changed ### New features -* feat(CSI-300): add arm64 support by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/379* -* feat(CSI-312): add topology awareness by providing accessibleTopology in PV creation by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/426 -* feat(CSI-313): add configuration for skipping out-of-band volume garbage collection by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/427 -### Improvements -* feat(CSI-310): drop container_name mount option from volume context by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/408 -* feat(CSI-311): add CSI driver version used for provisioning a PV into volumeContext by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/409 -* feat(CSI-308): add support for ReadWriteOncePod, ReadOnlyOncePod by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/399 -* feat(CSI-309): migrate from Alpine to RedHat UBI9 base image by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/400 -### Bug fixes -* refactor(CSI-305): change mount Map logic for WEKAFS to align with NFS and support same fs name on SCMC by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/383 -* chore(deps): improve the way of locar to delete multi-depth directories by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/422 -* fix(CSI-306): compatibility for sync_on_close not logged by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/395 +* feat(CSI-321): provide ability to add custom labels to CSI components by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/445 ### Miscellaneous -* chore(deps): add LICENSE to UBI /licenses by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/418 -* chore(deps): update golang dependencies as of 2024-12-09 by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/410 -* chore(deps): update helm/kind-action action to v1.12.0 by @renovate in https://github.com/weka/csi-wekafs/pull/414 -* chore(deps): update registry.access.redhat.com/ubi9/ubi to v9.5-1736404036 by @renovate in https://github.com/weka/csi-wekafs/pull/421 -* fix(deps): update golang.org/x/exp digest to 7588d65 by @renovate in https://github.com/weka/csi-wekafs/pull/407 -* fix(deps): update module google.golang.org/grpc to v1.69.4 by @renovate in https://github.com/weka/csi-wekafs/pull/406 -* fix(deps): update module google.golang.org/protobuf to v1.36.2 by @renovate in https://github.com/weka/csi-wekafs/pull/415 -* chore(deps): add labels to CSI Docker image by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/425 -* chore(deps): update go dependencies as of 2025-01-19 by @sergeyberezansky in https://github.com/weka/csi-wekafs/pull/429 +* chore(deps): update helm/chart-testing-action action to v2.7.0 by @renovate in https://github.com/weka/csi-wekafs/pull/433 diff --git a/charts/csi-wekafsplugin/Chart.yaml b/charts/csi-wekafsplugin/Chart.yaml index cb7caf25..2062b5bb 100644 --- a/charts/csi-wekafsplugin/Chart.yaml +++ b/charts/csi-wekafsplugin/Chart.yaml @@ -6,17 +6,17 @@ maintainers: email: csi@weka.io url: https://weka.io sources: - - https://github.com/weka/csi-wekafs/tree/v$CHART_VERSION/charts/csi-wekafsplugin + - https://github.com/weka/csi-wekafs/tree/v2.6.1 home: https://github.com/weka/csi-wekafs icon: https://weka.github.io/csi-wekafs/logo.png type: application -version: 2.6.1-SNAPSHOT.6.233e4bd -appVersion: v2.6.1-SNAPSHOT.6.233e4bd +version: 2.6.1 +appVersion: v2.6.1 keywords: [storage, filesystem, HPC] annotations: artifacthub.io/category: "storage" artifacthub.io/prerelease: "false" - artifacthub.io/containsSecurityUpdates: "true" + artifacthub.io/containsSecurityUpdates: "false" artifacthub.io/license: Apache-2.0 artifacthub.io/signKey: | fingerprint: BA9F2D31BE9193E01FA17450BCE0A5CF67AC0C59 diff --git a/charts/csi-wekafsplugin/README.md b/charts/csi-wekafsplugin/README.md index 4cb8871a..d4cd5f61 100644 --- a/charts/csi-wekafsplugin/README.md +++ b/charts/csi-wekafsplugin/README.md @@ -3,7 +3,7 @@ Helm chart for Deployment of WekaIO Container Storage Interface (CSI) plugin for [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/csi-wekafs)](https://artifacthub.io/packages/search?repo=csi-wekafs) -![Version: 2.6.1-SNAPSHOT.6.233e4bd](https://img.shields.io/badge/Version-2.6.1--SNAPSHOT.6.233e4bd-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.6.1-SNAPSHOT.6.233e4bd](https://img.shields.io/badge/AppVersion-v2.6.1--SNAPSHOT.6.233e4bd-informational?style=flat-square) +![Version: 2.6.1](https://img.shields.io/badge/Version-2.6.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.6.1](https://img.shields.io/badge/AppVersion-v2.6.1-informational?style=flat-square) ## Homepage https://github.com/weka/csi-wekafs @@ -52,7 +52,7 @@ helm install csi-wekafsplugin csi-wekafs/csi-wekafsplugin --namespace csi-wekafs |-----|------|---------|-------------| | dynamicProvisionPath | string | `"csi-volumes"` | Directory in root of file system where dynamic volumes are provisioned | | csiDriverName | string | `"csi.weka.io"` | Name of the driver (and provisioner) | -| csiDriverVersion | string | `"2.6.1-SNAPSHOT.6.233e4bd"` | CSI driver version | +| csiDriverVersion | string | `"2.6.1"` | CSI driver version | | images.livenessprobesidecar | string | `"registry.k8s.io/sig-storage/livenessprobe:v2.15.0"` | CSI liveness probe sidecar image URL | | images.attachersidecar | string | `"registry.k8s.io/sig-storage/csi-attacher:v4.8.0"` | CSI attacher sidecar image URL | | images.provisionersidecar | string | `"registry.k8s.io/sig-storage/csi-provisioner:v5.1.0"` | CSI provisioner sidecar image URL | @@ -61,7 +61,7 @@ helm install csi-wekafsplugin csi-wekafs/csi-wekafsplugin --namespace csi-wekafs | images.snapshottersidecar | string | `"registry.k8s.io/sig-storage/csi-snapshotter:v8.2.0"` | CSI snapshotter sidecar image URL | | images.nodeinfo | string | `"quay.io/weka.io/csi-wekafs"` | CSI nodeinfo sidecar image URL, used for reading node metadata | | images.csidriver | string | `"quay.io/weka.io/csi-wekafs"` | CSI driver main image URL | -| images.csidriverTag | string | `"2.6.1-SNAPSHOT.6.233e4bd"` | CSI driver tag | +| images.csidriverTag | string | `"2.6.1"` | CSI driver tag | | imagePullSecret | string | `""` | image pull secret required for image download. Must have permissions to access all images above. Should be used in case of private registry that requires authentication | | globalPluginTolerations | list | `[{"effect":"NoSchedule","key":"node-role.kubernetes.io/master","operator":"Exists"}]` | Tolerations for all CSI driver components | | controllerPluginTolerations | list | `[{"effect":"NoSchedule","key":"node-role.kubernetes.io/master","operator":"Exists"}]` | Tolerations for CSI controller component only (by default same as global) | diff --git a/charts/csi-wekafsplugin/values.yaml b/charts/csi-wekafsplugin/values.yaml index 8cea00ae..926770fb 100644 --- a/charts/csi-wekafsplugin/values.yaml +++ b/charts/csi-wekafsplugin/values.yaml @@ -5,7 +5,7 @@ dynamicProvisionPath: "csi-volumes" # -- Name of the driver (and provisioner) csiDriverName: "csi.weka.io" # -- CSI driver version -csiDriverVersion: &csiDriverVersion 2.6.1-SNAPSHOT.6.233e4bd +csiDriverVersion: &csiDriverVersion 2.6.1 images: # -- CSI liveness probe sidecar image URL livenessprobesidecar: registry.k8s.io/sig-storage/livenessprobe:v2.15.0 From 66d62314d62e8835ef875a81bb67a33efba62544 Mon Sep 17 00:00:00 2001 From: Sergey Berezansky Date: Tue, 28 Jan 2025 11:25:58 +0200 Subject: [PATCH 2/5] breaking(CSI-314): remove legacy volume support --- .github/workflows/sanity.yaml | 10 - README.md | 1 - charts/csi-wekafsplugin/templates/NOTES.txt | 12 +- .../controllerserver-deployment.yaml | 10 - .../templates/nodeserver-daemonset.yaml | 10 - charts/csi-wekafsplugin/values.schema.json | 3 - charts/csi-wekafsplugin/values.yaml | 2 - go.mod | 1 - go.sum | 3 - migration/migrate-legacy-csi-volumes.sh | 238 ------------------ pkg/wekafs/apiclient/cluster.go | 1 - pkg/wekafs/apiclient/compatibility.go | 9 - pkg/wekafs/controllerserver.go | 1 - pkg/wekafs/server.go | 5 - pkg/wekafs/utilities.go | 22 -- pkg/wekafs/volume.go | 120 ++------- pkg/wekafs/wekafs.go | 44 +--- tests/csi-sanity/ga_docker_run_sanity.sh | 17 -- 18 files changed, 21 insertions(+), 488 deletions(-) delete mode 100755 migration/migrate-legacy-csi-volumes.sh diff --git a/.github/workflows/sanity.yaml b/.github/workflows/sanity.yaml index 487e25b1..8466cfaf 100644 --- a/.github/workflows/sanity.yaml +++ b/.github/workflows/sanity.yaml @@ -39,19 +39,9 @@ jobs: tags: sanity:latest load: true - legacy_sanity: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }} - needs: build - runs-on: self-hosted - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - run: docker-compose -f tests/csi-sanity/docker-compose-nosnapshotcaps.yaml up $COMPOSE_DEFAULTS - env: - SANITY_FUNCTION: legacy_sanity directory_volume_and_snapshots: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }} - needs: legacy_sanity runs-on: self-hosted steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 diff --git a/README.md b/README.md index 265d4904..1079f230 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,6 @@ make build | node.podLabels | object | `{}` | optional labels to add to node pods | | logLevel | int | `5` | Log level of CSI plugin | | useJsonLogging | bool | `false` | Use JSON structured logging instead of human-readable logging format (for exporting logs to structured log parser) | -| legacyVolumeSecretName | string | `""` | for migration of pre-CSI 0.7.0 volumes only, default API secret. Must reside in same namespace as the plugin | | priorityClassName | string | `""` | Optional CSI Plugin priorityClassName | | selinuxSupport | string | `"off"` | Support SELinux labeling for Persistent Volumes, may be either `off`, `mixed`, `enforced` (default off) In `enforced` mode, CSI node components will only start on nodes having a label `selinuxNodeLabel` below In `mixed` mode, separate CSI node components will be installed on SELinux-enabled and regular hosts In `off` mode, only non-SELinux-enabled node components will be run on hosts without label. WARNING: if SELinux is not enabled, volume provisioning and publishing might fail! NOTE: SELinux support is enabled automatically on clusters recognized as RedHat OpenShift Container Platform | | selinuxNodeLabel | string | `"csi.weka.io/selinux_enabled"` | This label must be set to `"true"` on SELinux-enabled Kubernetes nodes, e.g., to run the node server in secure mode on SELinux-enabled node, the node must have label `csi.weka.io/selinux_enabled="true"` | diff --git a/charts/csi-wekafsplugin/templates/NOTES.txt b/charts/csi-wekafsplugin/templates/NOTES.txt index c1a79810..e6d9d220 100644 --- a/charts/csi-wekafsplugin/templates/NOTES.txt +++ b/charts/csi-wekafsplugin/templates/NOTES.txt @@ -13,17 +13,9 @@ Official Weka CSI Plugin documentation can be found here: https://docs.weka.io/a Examples on how to configure a storage class and start using the driver are here: https://github.com/weka/csi-wekafs/tree/master/examples --------------------------------------------------- NOTICE -------------------------------------------------- -| THIS VERSION INTRODUCES SUPPORT FOR ADDITIONAL VOLUME TYPES, AS WELL AS SNAPSHOT AND VOLUME CLONING CAPS | -| TO BETTER UNDERSTAND DIFFERENT TYPES OF VOLUMES AND THEIR IMPLICATIONS, REFER TO THE DOCUMENTATION ABOVE | -| ALSO, IT IS RECOMMENDED TO CAREFULLY GO OVER NEW CONFIGURATION PARAMETERS AND ITS MEANINGS, AS BEHAVIOR | -| OF THE PLUGIN AND ITS REPORTED CAPABILITIES LARGELY DEPEND ON THE CONFIGURATION AND WEKA CLUSTER VERSION | ------------------------------------------------------------------------------------------------------------- -------------------------------------------------- WARNING ------------------------------------------------- -| SUPPORT OF LEGACY VOLUMES WITHOUT API BINDING WILL BE REMOVED IN NEXT MAJOR RELEASE OF WEKA CSI PLUGIN. | -| NEW FEATURES RELY ON API CONNECTIVITY TO WEKA CLUSTER AND WILL NOT BE SUPPORTED ON API-UNBOUND VOLUMES. | -| PLEASE MAKE SURE TO MIGRATE ALL EXISTING VOLUMES TO API-BASED SCHEME PRIOR TO NEXT VERSION UPGRADE. | +| SUPPORT OF LEGACY VOLUMES (DIRECTORY BACKED WITHOUT API BINDING) WAS REMOVED IN THIS RELEASE. | ------------------------------------------------------------------------------------------------------------ {{- if or .Values.pluginConfig.mountProtocol.useNfs .Values.pluginConfig.mountProtocol.allowNfsFailback }} @@ -36,7 +28,7 @@ https://github.com/weka/csi-wekafs/tree/master/examples | NFS TRANSPORT DOES NOT PROVIDE MAXIMUM PERFORMANCE AND IS NOT RECOMMENDED FOR PRODUCTION USE. | | HOWEVER, IN CERTAIN CASES WHEN WEKA CLIENT INSTALLATION IS NOT POSSIBLE, NFS MOUNTS WILL BE USED. | | IF WEKA CLIENT IS INSTALLED ON NODES AFTER CSI PLUGIN INSTALLATION, RESTART IS REQUIRED FOR THE | -| CORRESPONDENT CSI PLUGIN COMPONENTS RUNNING ON THE NODE TO SWITCH BACK TO WEKAFS PROTOCOL MOUNTING. | +| CORRESPONDING CSI PLUGIN COMPONENTS RUNNING ON THE NODE TO SWITCH TO WEKAFS PROTOCOL MOUNTING. | {{- end }} | MAKE SURE THAT AT LEAST ONE INTERFACE GROUP IS CONFIGURED ON WEKA CLUSTER, OTHERWISE PROVISION WILL FAIL | | REFER TO THE DOCUMENTATION ABOVE FOR MORE INFORMATION ON NFS INTERFACE GROUP CONFIGURATION. | diff --git a/charts/csi-wekafsplugin/templates/controllerserver-deployment.yaml b/charts/csi-wekafsplugin/templates/controllerserver-deployment.yaml index 4b88162d..90b5d40f 100755 --- a/charts/csi-wekafsplugin/templates/controllerserver-deployment.yaml +++ b/charts/csi-wekafsplugin/templates/controllerserver-deployment.yaml @@ -174,11 +174,6 @@ spec: name: csi-data-dir - mountPath: /dev name: dev-dir - {{- if .Values.legacyVolumeSecretName }} - - mountPath: /legacy-volume-access - name: legacy-volume-access - readOnly: true - {{- end }} - name: csi-attacher image: {{ required "csi attacher sidercar image." .Values.images.attachersidecar }} securityContext: @@ -365,8 +360,3 @@ spec: path: /dev type: Directory name: dev-dir -{{- if .Values.legacyVolumeSecretName }} - - name: legacy-volume-access - secret: - secretName: {{ .Values.legacyVolumeSecretName }} -{{- end }} diff --git a/charts/csi-wekafsplugin/templates/nodeserver-daemonset.yaml b/charts/csi-wekafsplugin/templates/nodeserver-daemonset.yaml index 6544de79..e6a2c964 100644 --- a/charts/csi-wekafsplugin/templates/nodeserver-daemonset.yaml +++ b/charts/csi-wekafsplugin/templates/nodeserver-daemonset.yaml @@ -181,11 +181,6 @@ spec: - mountPath: /etc/nodeinfo name: nodeinfo readOnly: true -{{- if .Values.legacyVolumeSecretName }} - - mountPath: /legacy-volume-access - name: legacy-volume-access - readOnly: true -{{- end }} {{- if or (.Capabilities.APIVersions.Has "security.openshift.io/v1/SecurityContextConstraints") (eq .Values.selinuxSupport "enforced") }} - mountPath: /etc/selinux/config name: selinux-config @@ -277,8 +272,3 @@ spec: {{- end }} - name: nodeinfo emptyDir: {} -{{- if .Values.legacyVolumeSecretName }} - - name: legacy-volume-access - secret: - secretName: {{ .Values.legacyVolumeSecretName }} -{{- end }} diff --git a/charts/csi-wekafsplugin/values.schema.json b/charts/csi-wekafsplugin/values.schema.json index 1eac0986..0119d695 100644 --- a/charts/csi-wekafsplugin/values.schema.json +++ b/charts/csi-wekafsplugin/values.schema.json @@ -147,9 +147,6 @@ "kubeletPath": { "type": "string" }, - "legacyVolumeSecretName": { - "type": "string" - }, "logLevel": { "type": "integer" }, diff --git a/charts/csi-wekafsplugin/values.yaml b/charts/csi-wekafsplugin/values.yaml index 926770fb..14c4b8c5 100644 --- a/charts/csi-wekafsplugin/values.yaml +++ b/charts/csi-wekafsplugin/values.yaml @@ -101,8 +101,6 @@ node: logLevel: 5 # -- Use JSON structured logging instead of human-readable logging format (for exporting logs to structured log parser) useJsonLogging: false -# -- for migration of pre-CSI 0.7.0 volumes only, default API secret. Must reside in same namespace as the plugin -legacyVolumeSecretName: "" # -- Optional CSI Plugin priorityClassName priorityClassName: "" # -- Support SELinux labeling for Persistent Volumes, may be either `off`, `mixed`, `enforced` (default off) diff --git a/go.mod b/go.mod index ede77602..8f10a1a4 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/google/uuid v1.6.0 github.com/hashicorp/go-version v1.7.0 github.com/kubernetes-csi/csi-lib-utils v0.20.0 - github.com/pkg/xattr v0.4.10 github.com/prometheus/client_golang v1.20.5 github.com/rs/zerolog v1.33.0 github.com/showa-93/go-mask v0.6.2 diff --git a/go.sum b/go.sum index f7637406..5ca45093 100644 --- a/go.sum +++ b/go.sum @@ -48,8 +48,6 @@ github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcY github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/xattr v0.4.10 h1:Qe0mtiNFHQZ296vRgUjRCoPHPqH7VdTOrZx3g0T+pGA= -github.com/pkg/xattr v0.4.10/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= @@ -91,7 +89,6 @@ golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/migration/migrate-legacy-csi-volumes.sh b/migration/migrate-legacy-csi-volumes.sh deleted file mode 100755 index 66505664..00000000 --- a/migration/migrate-legacy-csi-volumes.sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/bash -BANNER="Weka CSI Volume migration utility. Copyright 2021 Weka" -LOG_LEVEL=4 -CSI_VOLUMES_DIR="csi-volumes" -FILESYSTEM= -LOG_FILE="/tmp/$(basename "$0")-$$.log" -PROCESSED_DIRS=0 -UPDATED_DIRS=0 -SKIPPED_DIRS=0 -WARNINGS=0 -FAILURES=0 - -usage() { - cat <<-DELIM - -The utility simplifies hard capacity enforcement on CSI volumes created prior to Weka CSI plugin 0.7.0 -This utility can be run from any host being a part of Weka cluster which the CSI volumes are located on. - -The following OS packages or utilities are required: -- xattr (xattr package) -- getfattr (attr package) -- jq (jq package) -- Weka client software - -Usage: $0 [--csi-volumes-dir ] [--endpoint-address IP_ADDRESS:PORT] - $0 --help - -Optional parameters: --------------------- ---debug Execute with debug level logging ---csi-volumes-dir Assume CSI volumes are stored in different directory on the filesystem. Default is "csi-volumes" ---endpoint-address API_ADDRESS:PORT of a Weka backend server, should be used for stateless clients. - -DELIM -} - -export GRAY="\033[1;30m" -export LIGHT_GRAY="\033[0;37m" -export CYAN="\033[0;36m" -export LIGHT_CYAN="\033[1;36m" -export PURPLE="\033[1;35m" -export YELLOW="\033[1;33m" -export LIGHT_RED="\033[1;31m" -export NO_COLOUR="\033[0m" - -ts() { - local LINE - while read -r LINE; do - echo -e "$(date "+$*") $LINE" - done -} - -log_message() { - # just add timestamp and redirect logs to stderr - local LEVEL COLOR - [[ ${1} =~ TRACE|DEBUG|INFO|NOTICE|WARN|WARNING|ERROR|CRITICAL|FATAL ]] && LEVEL="${1}" && shift || LEVEL="INFO" - - case $LEVEL in - DEBUG) COLOR="$LIGHT_GRAY"; [[ $LOG_LEVEL ]] && [[ $LOG_LEVEL -lt 5 ]] && return ;; - INFO) COLOR="$CYAN"; [[ $LOG_LEVEL ]] && [[ $LOG_LEVEL -lt 4 ]] && return ;; - NOTICE) COLOR="$PURPLE"; [[ $LOG_LEVEL ]] && [[ $LOG_LEVEL -lt 3 ]] && return ;; - WARNING | WARN) COLOR="$YELLOW" ; [[ $LOG_LEVEL ]] && [[ $LOG_LEVEL -lt 2 ]] && return ;; - ERROR | CRITICAL | FATAL) COLOR="$LIGHT_RED";; - esac - ts "$(echo -e "$NO_COLOUR")[%Y-%m-%d %H:%M:%S] $(echo -e "${COLOR}${LEVEL}${NO_COLOUR}")"$'\t' <<< "$*" | tee -a "$LOG_FILE" >&2 -} - -log_fatal() { - log_message CRITICAL "$@" - exit 1 -} - -check_settings() { - log_message NOTICE Checking for settings and dependencies - which getfattr &>/dev/null || log_fatal "attr package not installed!" - which xattr &>/dev/null || log_fatal "xattr package not installed!" - which jq &>/dev/null || log_fatal "jq package is not installed!" - which weka &>/dev/null || log_fatal "Weka software not installed!" - log_message "Settings OK" -} - -cleanup () { - log_message DEBUG "Initiating cleanup sequence" - [[ $PUSHED ]] && popd &>/dev/null - if [[ $TMPDIR ]]; then - if [[ $FILESYSTEM ]]; then - if umount "$TMPDIR" &>> "$LOG_FILE" ; then - log_message DEBUG "Filesystem $FILESYSTEM successfully unmounted" - else - log_message ERROR "Failed to umount $FILESYSTEM from $TMPDIR" - fi - else - log_message DEBUG "Nothing to unmount" - fi - rm -rf "$TMPDIR" - fi -} - -mount_fs() { - local FS="$1" - log_message NOTICE "Mounting filesystem $FILESYSTEM and accessing CSI volumes directory $CSI_VOLUMES_DIR..." - if mount -t wekafs -o acl "${ENDPOINT_ADDRESS}${FS}" "$TMPDIR" 2>&1 | tee -a "$LOG_FILE"; then - log_message NOTICE "Successfully mounted filesystem $FILESYSTEM" - else - log_fatal "Failed to mount filesystem $FILESYSTEM" - fi -} - -get_directory_quota() { - RET="$(weka fs quota list -p "$1" --all -R -J | jq '.[0].hard_limit_bytes')" - [[ $RET == null ]] && return 1 - echo -n "$RET" -} - -set_directory_quota() { - weka fs quota set --hard "$2"B "$1" -} - -get_legacy_capacity() { - RET="$(getfattr "$1" -n "user.weka_capacity" --only-values)" && echo -n "$RET" || return 1 -} - -remove_xattr_capacity() { - setfattr "$1" -x "user.weka_capacity" &>> "$LOG_FILE" -} - -migrate_directory() { - log_message INFO "Processing directory '$1'" - local DIR_PATH="$1" - local XATTR_CAPACITY QUOTA_CAPACITY NEW_CAPACITY - (( PROCESSED_DIRS ++ )) - log_message DEBUG "Fetching legacy capacity of $DIR_PATH" - XATTR_CAPACITY=$(get_legacy_capacity "$DIR_PATH" 2>> "$LOG_FILE") - - if [[ $XATTR_CAPACITY ]]; then - log_message DEBUG "Current capacity: $XATTR_CAPACITY" - NEW_CAPACITY=$XATTR_CAPACITY - QUOTA_CAPACITY="$(get_directory_quota "$DIR_PATH")" - if [[ $QUOTA_CAPACITY ]]; then - log_message DEBUG "Current quota: $QUOTA_CAPACITY" - if (( QUOTA_CAPACITY != XATTR_CAPACITY )); then - NEW_CAPACITY=$(( XATTR_CAPACITY > QUOTA_CAPACITY ? XATTR_CAPACITY : QUOTA_CAPACITY )) - log_message WARNING "Current quota doesn't match previously set volume capacity, setting max value $NEW_CAPACITY!" - fi - fi - log_message INFO "Creating quota of $NEW_CAPACITY bytes for directory $DIR_PATH" - if set_directory_quota "$DIR_PATH" "$NEW_CAPACITY"; then - (( UPDATED_DIRS ++ )) - log_message INFO "Quota was successfully set for directory $DIR_PATH" - if remove_xattr_capacity "$DIR_PATH"; then - log_message DEBUG "Removed legacy capacity from directory $DIR_PATH" - else - log_message WARNING "Failed to remove legacy capacity from directory $DIR_PATH" - (( WARNINGS ++ )) - fi - else - log_message ERROR "Failed to set quota on directory $DIR_PATH" - (( FAILURES ++ )) - fi - else - QUOTA_CAPACITY="$(get_directory_quota "$DIR_PATH")" - if [[ $QUOTA_CAPACITY ]]; then - log_message INFO "Directory $DIR_PATH already has quota, skipping..." - (( SKIPPED_DIRS ++ )) - else - log_message ERROR "Could not obtain capacity for directory $DIR_PATH, assuming not a CSI volume" - (( FAILURES ++ )) - fi - fi -} - -main() { - echo "$BANNER" - while [[ $# -gt 0 ]]; do - case "$1" in - --help) - usage - exit 0 - ;; - --endpoint-address) - ENDPOINT_ADDRESS="$2" - shift 2 - ;; - --debug) - LOG_LEVEL=5 - shift - ;; - --csi-volumes-dir) - CSI_VOLUMES_DIR="$2" - shift 2 - ;; - *) - if [[ -z $FILESYSTEM ]]; then - FILESYSTEM="$1" - shift - else - usage - log_fatal "Invalid argument '$1'" - fi - ;; - esac - done - [[ $ENDPOINT_ADDRESS ]] && ENDPOINT_ADDRESS="$ENDPOINT_ADDRESS/" - - if [[ -z $FILESYSTEM ]]; then - usage - log_fatal "Filesystem name not specified" - fi - check_settings - log_message NOTICE "Initializing volume migration for filesystem $FILESYSTEM" - TMPDIR="$(mktemp -d)" && log_message DEBUG "Created a temporary directory $TMPDIR" - mount_fs "$FILESYSTEM" - if pushd "$TMPDIR/$CSI_VOLUMES_DIR" &>/dev/null ; then - PUSHED=1 - else - log_fatal "Could not find directory $CSI_VOLUMES_DIR on filesystem $FILESYSTEM" - fi - log_message NOTICE "Starting Persistent Volume migration" - - for file in *; do - migrate_directory "$file" - done - - log_message NOTICE "Migration process complete!" - log_message NOTICE "$PROCESSED_DIRS directories processed" - log_message NOTICE "$UPDATED_DIRS directories migrated successfully" - log_message NOTICE "$SKIPPED_DIRS directories skipped" - if (( WARNINGS > 0 )); then - log_message WARNING "$WARNINGS warnings occurred, please inspect log" - fi - if (( FAILURES > 0 )); then - log_message ERROR "$FAILURES failures occurred, please inspect log" - fi - log_message NOTICE "Full migration log can be found in $LOG_FILE" -} - -trap cleanup EXIT -main "$@" \ No newline at end of file diff --git a/pkg/wekafs/apiclient/cluster.go b/pkg/wekafs/apiclient/cluster.go index 5dcce562..99656536 100644 --- a/pkg/wekafs/apiclient/cluster.go +++ b/pkg/wekafs/apiclient/cluster.go @@ -49,7 +49,6 @@ func (a *ApiClient) fetchClusterInfo(ctx context.Context) error { Str("cluster_version", clusterVersion).Msg("Successfully connected to cluster") logger.Info().Msg(fmt.Sprintf("Cluster compatibility for filesystem as CSI volume: %t", a.SupportsFilesystemAsVolume())) logger.Info().Msg(fmt.Sprintf("Cluster compatibility for quota directory as CSI volume: %t", a.SupportsQuotaDirectoryAsVolume())) - logger.Info().Msg(fmt.Sprintf("Cluster compatibility for quota on non-empty CSI volume: %t", a.SupportsQuotaOnNonEmptyDirs())) logger.Info().Msg(fmt.Sprintf("Cluster compatibility for regular directory as CSI volume: %t", a.SupportsDirectoryAsVolume())) logger.Info().Msg(fmt.Sprintf("Cluster compatibility for authenticated filesystem mounts: %t", a.SupportsAuthenticatedMounts())) logger.Info().Msg(fmt.Sprintf("Cluster compatibility for new filesystem from snapshot: %t", a.SupportsNewFileSystemFromSnapshot())) diff --git a/pkg/wekafs/apiclient/compatibility.go b/pkg/wekafs/apiclient/compatibility.go index f4fd94ad..76399876 100644 --- a/pkg/wekafs/apiclient/compatibility.go +++ b/pkg/wekafs/apiclient/compatibility.go @@ -24,7 +24,6 @@ var MinimumSupportedWekaVersions = &WekaCompatibilityRequiredVersions{ DirectoryAsCSIVolume: "v3.0", // can create CSI volume from directory, without quota support FilesystemAsVolume: "v3.13", // can create CSI volume from filesystem QuotaDirectoryAsVolume: "v3.13", // can create CSI volume from directory with quota support - QuotaOnNonEmptyDirs: "v9.99", // can enable quota on legacy CSI volume (directory) without quota support QuotaOnSnapshot: "v4.2", // can create a valid quota on snapshot MountFilesystemsUsingAuthToken: "v3.14", // can mount filesystems that require authentication (and non-root orgID) NewFilesystemFromSnapshot: "v9.99", // can create new filesystem from snapshot on storage side @@ -39,7 +38,6 @@ type WekaCompatibilityMap struct { FilesystemAsCSIVolume bool DirectoryAsCSIVolume bool QuotaOnDirectoryVolume bool - QuotaSetOnNonEmptyVolume bool QuotaOnSnapshot bool MountFilesystemsUsingAuthToken bool CreateNewFilesystemFromSnapshot bool @@ -57,7 +55,6 @@ func (cm *WekaCompatibilityMap) fillIn(versionStr string) { cm.DirectoryAsCSIVolume = true cm.FilesystemAsCSIVolume = false cm.QuotaOnDirectoryVolume = false - cm.QuotaSetOnNonEmptyVolume = false cm.MountFilesystemsUsingAuthToken = false cm.CreateNewFilesystemFromSnapshot = false cm.CloneFilesystem = false @@ -71,7 +68,6 @@ func (cm *WekaCompatibilityMap) fillIn(versionStr string) { d, _ := version.NewVersion(MinimumSupportedWekaVersions.DirectoryAsCSIVolume) f, _ := version.NewVersion(MinimumSupportedWekaVersions.FilesystemAsVolume) q, _ := version.NewVersion(MinimumSupportedWekaVersions.QuotaDirectoryAsVolume) - n, _ := version.NewVersion(MinimumSupportedWekaVersions.QuotaOnNonEmptyDirs) a, _ := version.NewVersion(MinimumSupportedWekaVersions.MountFilesystemsUsingAuthToken) s, _ := version.NewVersion(MinimumSupportedWekaVersions.NewFilesystemFromSnapshot) c, _ := version.NewVersion(MinimumSupportedWekaVersions.CloneFilesystem) @@ -84,7 +80,6 @@ func (cm *WekaCompatibilityMap) fillIn(versionStr string) { cm.DirectoryAsCSIVolume = v.GreaterThanOrEqual(d) cm.FilesystemAsCSIVolume = v.GreaterThanOrEqual(f) cm.QuotaOnDirectoryVolume = v.GreaterThanOrEqual(q) - cm.QuotaSetOnNonEmptyVolume = v.GreaterThanOrEqual(n) cm.MountFilesystemsUsingAuthToken = v.GreaterThanOrEqual(a) cm.CreateNewFilesystemFromSnapshot = v.GreaterThanOrEqual(s) cm.CloneFilesystem = v.GreaterThanOrEqual(c) @@ -99,10 +94,6 @@ func (a *ApiClient) SupportsQuotaDirectoryAsVolume() bool { return a.CompatibilityMap.QuotaOnDirectoryVolume } -func (a *ApiClient) SupportsQuotaOnNonEmptyDirs() bool { - return a.CompatibilityMap.QuotaSetOnNonEmptyVolume -} - func (a *ApiClient) SupportsQuotaOnSnapshots() bool { return a.CompatibilityMap.QuotaOnSnapshot } diff --git a/pkg/wekafs/controllerserver.go b/pkg/wekafs/controllerserver.go index b57ed8ee..91af43a9 100644 --- a/pkg/wekafs/controllerserver.go +++ b/pkg/wekafs/controllerserver.go @@ -250,7 +250,6 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol } // check if with current API client state we can modify this volume or not - // (basically only legacy dirVolume with xAttr fallback can be operated without API client) if err := volume.CanBeOperated(); err != nil { return CreateVolumeError(ctx, codes.InvalidArgument, err.Error()) } diff --git a/pkg/wekafs/server.go b/pkg/wekafs/server.go index cd5063df..ff7f39b2 100644 --- a/pkg/wekafs/server.go +++ b/pkg/wekafs/server.go @@ -31,11 +31,6 @@ import ( "github.com/container-storage-interface/spec/lib/go/csi" ) -const ( - xattrCapacity = "user.weka_capacity" - xattrVolumeName = "user.weka_k8s_volname" -) - //goland:noinspection GoExportedFuncWithUnexportedType func NewNonBlockingGRPCServer(mode CsiPluginMode) *nonBlockingGRPCServer { return &nonBlockingGRPCServer{ diff --git a/pkg/wekafs/utilities.go b/pkg/wekafs/utilities.go index 65ac6830..2cfb5158 100644 --- a/pkg/wekafs/utilities.go +++ b/pkg/wekafs/utilities.go @@ -9,7 +9,6 @@ import ( "errors" "fmt" "github.com/container-storage-interface/spec/lib/go/csi" - "github.com/pkg/xattr" "github.com/rs/zerolog/log" "github.com/wekafs/csi-wekafs/pkg/wekafs/apiclient" "golang.org/x/exp/constraints" @@ -450,27 +449,6 @@ func validateSnapshotId(snapshotId string) error { } } -func updateXattrs(volPath string, attrs map[string][]byte) error { - for key, val := range attrs { - if err := xattr.Set(volPath, key, val); err != nil { - return status.Errorf(codes.Internal, "failed to update volume attribute %s: %s, %s", key, val, err.Error()) - } - } - return nil -} - -func setVolumeProperties(volPath string, capacity int64, volName string) error { - // assumes that volPath is already mounted and accessible - xattrs := make(map[string][]byte) - if volName != "" { - xattrs[xattrVolumeName] = []byte(volName) - } - if capacity > 0 { - xattrs[xattrCapacity] = []byte(fmt.Sprint(capacity)) - } - return updateXattrs(volPath, xattrs) -} - func pathIsDirectory(filename string) error { info, err := os.Stat(filename) if os.IsNotExist(err) { diff --git a/pkg/wekafs/volume.go b/pkg/wekafs/volume.go index 85fb81ed..81bccd14 100644 --- a/pkg/wekafs/volume.go +++ b/pkg/wekafs/volume.go @@ -6,7 +6,6 @@ import ( "fmt" "github.com/container-storage-interface/spec/lib/go/csi" "github.com/google/uuid" - "github.com/pkg/xattr" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/wekafs/csi-wekafs/pkg/wekafs/apiclient" @@ -30,8 +29,6 @@ const ( var ErrFilesystemHasUnderlyingSnapshots = status.Errorf(codes.FailedPrecondition, "volume cannot be deleted since it has underlying snapshots") var ErrFilesystemNotFound = status.Errorf(codes.FailedPrecondition, "underlying filesystem was not found") -var ErrNoXattrOnVolume = errors.New("xattr not set on volume") -var ErrBadXattrOnVolume = errors.New("could not parse xattr on volume") var ErrFilesystemBiggerThanRequested = errors.New("could not resize filesystem since it is already larger than requested size") @@ -410,19 +407,12 @@ func (v *Volume) getCapacityFromQuota(ctx context.Context) (int64, error) { return 0, err } - if v.apiClient != nil && v.apiClient.SupportsQuotaDirectoryAsVolume() && !v.server.isInDevMode() { - size, err := v.getSizeFromQuota(ctx) - if err == nil { - logger.Debug().Uint64("current_capacity", size).Str("capacity_source", "quota").Msg("Resolved current capacity") - return int64(size), nil - } - } - logger.Trace().Msg("Volume appears to be a legacy volume, failing back to Xattr") - size, err := v.getSizeFromXattr(ctx) + size, err := v.getSizeFromQuota(ctx) if err != nil { return 0, err } - logger.Debug().Uint64("current_capacity", size).Str("capacity_source", "xattr").Msg("Resolved current capacity") + + logger.Debug().Uint64("current_capacity", size).Str("capacity_source", "quota").Msg("Resolved current capacity") return int64(size), nil } @@ -527,42 +517,19 @@ func (v *Volume) UpdateCapacity(ctx context.Context, enforceCapacity *bool, capa return err } - // update capacity of the volume by updating quota object on its root directory (or XATTR) logger.Info().Int64("desired_capacity", capacityLimit).Msg("Updating volume capacity") - var fallback = true // whether we should try to use xAttr fallback or not if setting quota was attempted and failed. note that in certain cases a fallbackFunc will be used right away: - primaryFunc := func() error { return v.updateCapacityQuota(ctx, enforceCapacity, capacityLimit) } - fallbackFunc := func() error { return v.updateCapacityXattr(ctx, enforceCapacity, capacityLimit) } - if v.server.isInDevMode() { - logger.Trace().Msg("Updating quota via API is not possible since running in DEV mode") - primaryFunc = fallbackFunc - fallback = false - } else if v.apiClient == nil { - logger.Trace().Msg("Volume has no API client bound, updating capacity in legacy mode") - primaryFunc = fallbackFunc - fallback = false - } else if !v.apiClient.SupportsQuotaDirectoryAsVolume() { - logger.Warn().Msg("Updating quota via API not supported by Weka cluster, updating capacity in legacy mode") - primaryFunc = fallbackFunc - fallback = false - } else if !v.apiClient.SupportsAuthenticatedMounts() && v.apiClient.Credentials.Organization != "Root" { - logger.Warn().Msg("Updating quota via API is not supported by Weka cluster since filesystem is located in non-default organization, updating capacity in legacy mode") - primaryFunc = fallbackFunc - fallback = false - } else if !v.apiClient.SupportsQuotaOnSnapshots() && v.isOnSnapshot() { - logger.Warn().Msg("Quota enforcement is not supported for snapshot-backed volumes on current version of Weka software. Upgrade to latest version of Weka software to enable quota enforcement") - } - err := primaryFunc() + if v.apiClient == nil { + return status.Errorf(codes.FailedPrecondition, "Cannot update capacity for volume %s as it is not bound to API client", v.GetId()) + } + if !v.apiClient.SupportsAuthenticatedMounts() && v.apiClient.Credentials.Organization != "Root" { + return status.Errorf(codes.FailedPrecondition, "Cannot update capacity for volume %s as its underlying filesystem is located in non-default organization and authenticated mounts are not supported by current version of Weka software. Upgrade to latest version of Weka software to enable this feature", v.GetId()) + } + if !v.apiClient.SupportsQuotaOnSnapshots() && v.isOnSnapshot() { + return status.Errorf(codes.FailedPrecondition, "Cannot update capacity for volume %s as quotas on snapshots are not supported by current version of Weka software. Upgrade to latest version of Weka software to enable this feature", v.GetId()) + } + err := v.updateCapacityQuota(ctx, enforceCapacity, capacityLimit) if err == nil { logger.Info().Int64("new_capacity", capacityLimit).Msg("Successfully updated capacity for volume") - } else if fallback { - // it means that fallback is false, and used for updating xattr if quota set failed. - // this is not intended to run Xattr for a second time - logger.Warn().Err(err).Msg("Failed to set quota via API, failing back to xattr") - err := fallbackFunc() - if err != nil { - logger.Error().Err(err).Msg("Failed to set capacity even in failback mode") - } - return err } return err } @@ -610,34 +577,6 @@ func (v *Volume) updateCapacityQuota(ctx context.Context, enforceCapacity *bool, } -func (v *Volume) updateCapacityXattr(ctx context.Context, enforceCapacity *bool, capacityLimit int64) error { - op := "updateCapacityXattr" - ctx, span := otel.Tracer(TracerName).Start(ctx, op) - defer span.End() - ctx = log.With().Str("trace_id", span.SpanContext().TraceID().String()).Str("span_id", span.SpanContext().SpanID().String()).Str("op", op).Logger().WithContext(ctx) - - logger := log.Ctx(ctx).With().Str("volume_id", v.GetId()).Logger() - - if !v.isMounted(ctx) { - err, unmountFunc := v.MountUnderlyingFS(ctx) - if err != nil { - return err - } else { - defer unmountFunc() - } - } - - logger.Trace().Int64("desired_capacity", capacityLimit).Msg("Updating xattrs on volume") - if enforceCapacity != nil && *enforceCapacity { - logger.Warn().Msg("Legacy volume does not support enforce capacity") - } - err := setVolumeProperties(v.GetFullPath(ctx), capacityLimit, v.innerPath) - if err != nil { - logger.Error().Err(err).Msg("Failed to update xattrs on volume, capacity is not set") - } - return err -} - func (v *Volume) Trash(ctx context.Context) error { if v.requiresGc() { return v.server.getMounter().getGarbageCollector().triggerGcVolume(ctx, v) @@ -777,24 +716,6 @@ func (v *Volume) getSizeFromQuota(ctx context.Context) (uint64, error) { return 0, errors.New("could not fetch quota from API") } -// getSizeFromXattr returns volume size from extended attributes, mostly fallback for very old pre-API Weka clusters -func (v *Volume) getSizeFromXattr(ctx context.Context) (uint64, error) { - - err, unmount := v.MountUnderlyingFS(ctx) - defer unmount() - if err != nil { - return 0, err - } - - if capacityString, err := xattr.Get(v.GetFullPath(ctx), xattrCapacity); err == nil { - if capacity, err := strconv.ParseInt(string(capacityString), 10, 64); err == nil { - return uint64(capacity), nil - } - return 0, ErrBadXattrOnVolume - } - return 0, ErrNoXattrOnVolume -} - // getFilesystemObj returns the Weka filesystem object func (v *Volume) getFilesystemObj(ctx context.Context) (*apiclient.FileSystem, error) { if v.apiClient == nil { @@ -824,8 +745,8 @@ func (v *Volume) getSnapshotObj(ctx context.Context) (*apiclient.Snapshot, error return snapObj, nil // no snapshot found } -// MountUnderlyingFS creates a mount using the volume mount options (plus specifically xattr true/false) and increases refcount to its path -// returns UmnountFunc that can be executed to decrese refCount / unmount +// MountUnderlyingFS creates a mount using the volume mount options and increases refcount to its path +// returns UmnountFunc that can be executed to decrease refCount / unmount // NOTE: it always mounts only the filesystem directly. Any navigation inside should be done on the mount func (v *Volume) MountUnderlyingFS(ctx context.Context) (error, UnmountFunc) { op := "MountUnderlyingFS" @@ -1613,15 +1534,8 @@ func (v *Volume) CreateSnapshot(ctx context.Context, name string) (*Snapshot, er // CanBeOperated returns true if the object can be CRUDed (either a legacy stateless volume or volume with API client bound func (v *Volume) CanBeOperated() error { - if v.isOnSnapshot() || v.isFilesystem() { - if v.apiClient == nil && !v.server.isInDevMode() { - return errors.New("Could not obtain a valid API secret configuration for operation") - } - - if !v.apiClient.SupportsFilesystemAsVolume() { - return errors.New(fmt.Sprintf("volume of type Filesystem is not supported on current version of Weka cluster. A version %s and up is required ", - apiclient.MinimumSupportedWekaVersions.FilesystemAsVolume)) - } + if v.apiClient == nil { + return errors.New("Could not obtain a valid API secret configuration for operation") } return nil } diff --git a/pkg/wekafs/wekafs.go b/pkg/wekafs/wekafs.go index cab2a4bc..80fd1a41 100644 --- a/pkg/wekafs/wekafs.go +++ b/pkg/wekafs/wekafs.go @@ -61,7 +61,6 @@ var ( type ApiStore struct { sync.Mutex apis map[uint32]*apiclient.ApiClient - legacySecrets *map[string]string allowInsecureHttps bool Hostname string } @@ -181,47 +180,17 @@ func (api *ApiStore) fromCredentials(ctx context.Context, credentials apiclient. return newClient, nil } -func (api *ApiStore) GetDefaultSecrets() (*map[string]string, error) { - err := pathIsDirectory(LegacySecretPath) - if err != nil { - return nil, errors.New("no legacy secret exists") - } - KEYS := []string{"scheme", "endpoints", "organization", "username", "password"} - ret := make(map[string]string) - for _, k := range KEYS { - filePath := fmt.Sprintf("%s/%s", LegacySecretPath, k) - if _, err := os.Stat(filePath); os.IsNotExist(err) { - return nil, errors.New(fmt.Sprintf("Missing key %s in legacy secret configuration", k)) - } - contents, err := os.ReadFile(filePath) - if err != nil { - return nil, errors.New(fmt.Sprintf("Could not read key %s from legacy secret configuration", k)) - } - ret[k] = string(contents) - } - return &ret, nil -} - func (api *ApiStore) GetClientFromSecrets(ctx context.Context, secrets map[string]string) (*apiclient.ApiClient, error) { logger := log.Ctx(ctx) if len(secrets) == 0 { - if api.legacySecrets != nil { - logger.Trace().Msg("No explicit API service for request, using legacySecrets") - secrets = *api.legacySecrets - } else { - logger.Trace().Msg("No API service for request, switching to legacy mode") - return nil, nil - } + logger.Error().Msg("Failed to initialize API client, since no secrets were provided") + return nil, errors.New("no secrets provided") } client, err := api.fromSecrets(ctx, secrets, api.Hostname) if err != nil { logger.Error().Err(err).Msg("Failed to initialize API client from secret, cannot proceed") return nil, err } - if client == nil { - logger.Trace().Msg("API service was not found for request, switching to legacy mode") - return nil, nil - } logger.Trace().Msg("Successfully initialized API backend for request") return client, nil } @@ -233,13 +202,6 @@ func NewApiStore(allowInsecureHttps bool, hostname string) *ApiStore { allowInsecureHttps: allowInsecureHttps, Hostname: hostname, } - secrets, err := s.GetDefaultSecrets() - if err != nil { - log.Trace().Msg("No global API secret defined") - } else { - log.Info().Msg("Initialized API with global API secret") - s.legacySecrets = secrets - } return s } @@ -320,8 +282,6 @@ const ( VolumeTypeUNKNOWN VolumeType = "AMBIGUOUS_VOLUME_TYPE" VolumeTypeEmpty VolumeType = "" - LegacySecretPath = "/legacy-volume-access" - CsiModeNode CsiPluginMode = "node" CsiModeController CsiPluginMode = "controller" CsiModeAll CsiPluginMode = "all" diff --git a/tests/csi-sanity/ga_docker_run_sanity.sh b/tests/csi-sanity/ga_docker_run_sanity.sh index de8eddd9..4020b07f 100755 --- a/tests/csi-sanity/ga_docker_run_sanity.sh +++ b/tests/csi-sanity/ga_docker_run_sanity.sh @@ -9,23 +9,6 @@ cleanup() { rm -rf /tmp/csi-test-staging } -# ---------------------- LEGACY DIR VOLUME NO API BINDING (NO SNAPSHOT SUPPORT) ---------------------- -legacy_sanity() { - echo "LEGACY SANITY STARTED" - cleanup - csi-sanity -csi.stagingdir /tmp/csi-test-staging \ - --csi.controllerendpoint /tmp/weka-csi-test/controller-no-snaps.sock \ - --csi.endpoint /tmp/weka-csi-test/node-no-snaps.sock \ - -csi.mountdir=/tmp/weka-csi-test/sanity-workspace \ - -ginkgo.vv \ - -ginkgo.poll-progress-after 3s \ - -ginkgo.seed 0 \ - -ginkgo.skip="NodeExpandVolume" \ - -ginkgo.skip="NodeStageVolume" \ - -ginkgo.skip="NodeUnstageVolume" \ - -csi.testvolumeparameters /test/wekafs-dirv1.yaml -} - # ---------------------- DIR VOLUME WITH API BINDING EXCLUDING SNAPSHOTS ---------------------- directory_volume_no_snapshots() { echo "DIRECTORY VOLUME NO SNAPSHOTS STARTED" From d794e013e91b3979567422ba0dbaaadd58f46c41 Mon Sep 17 00:00:00 2001 From: Sergey Berezansky Date: Tue, 28 Jan 2025 11:28:04 +0200 Subject: [PATCH 3/5] chore(CSI-314): rename legacy volume to directory volume internally --- .../controllerserver-deployment.yaml | 2 +- charts/csi-wekafsplugin/values.yaml | 4 +- cmd/wekafsplugin/main.go | 4 +- pkg/wekafs/driverconfig.go | 94 +++++++++---------- pkg/wekafs/volumeconstructors.go | 4 +- .../docker-compose-nfs-snapshotcaps.yaml | 4 +- .../docker-compose-nosnapshotcaps.yaml | 4 +- .../docker-compose-snapshotcaps.yaml | 4 +- tests/csi-sanity/docker-compose.yaml | 12 +-- 9 files changed, 66 insertions(+), 66 deletions(-) diff --git a/charts/csi-wekafsplugin/templates/controllerserver-deployment.yaml b/charts/csi-wekafsplugin/templates/controllerserver-deployment.yaml index 90b5d40f..97f5820a 100755 --- a/charts/csi-wekafsplugin/templates/controllerserver-deployment.yaml +++ b/charts/csi-wekafsplugin/templates/controllerserver-deployment.yaml @@ -72,7 +72,7 @@ spec: - "--allowautofsexpansion" {{- end }} {{- if .Values.pluginConfig.allowedOperations.snapshotDirectoryVolumes }} - - "--allowsnapshotsoflegacyvolumes" + - "--allowsnapshotsofdirectoryvolumes" {{- end }} {{- if .Values.pluginConfig.allowedOperations.snapshotVolumesWithoutQuotaEnforcement }} - "--alwaysallowsnapshotvolumes" diff --git a/charts/csi-wekafsplugin/values.yaml b/charts/csi-wekafsplugin/values.yaml index 14c4b8c5..da2abe7b 100644 --- a/charts/csi-wekafsplugin/values.yaml +++ b/charts/csi-wekafsplugin/values.yaml @@ -159,8 +159,8 @@ pluginConfig: # e.g. in case a required volume capacity exceeds the size of filesystem. # Note: the filesystem is not expanded automatically when a new directory-backed volume is provisioned autoExpandFilesystems: true - # -- Create snapshots of legacy (dir/v1) volumes. By default disabled. - # Note: when enabled, for every legacy volume snapshot, a full filesystem snapshot will be created (wasteful) + # -- Create snapshots of directory-backed (dir/v1) volumes. By default disabled. + # Note: when enabled, every snapshot of a directory-backed volume creates a full filesystem snapshot (wasteful) snapshotDirectoryVolumes: false # -- Allow creation of snapshot-backed volumes even on unsupported Weka cluster versions, off by default # Note: On versions of Weka < v4.2 snapshot-backed volume capacity cannot be enforced diff --git a/cmd/wekafsplugin/main.go b/cmd/wekafsplugin/main.go index eb7e90a6..99edf20b 100644 --- a/cmd/wekafsplugin/main.go +++ b/cmd/wekafsplugin/main.go @@ -72,7 +72,7 @@ var ( seedSnapshotPrefix = flag.String("seedsnapshotprefix", "csisnp-seed-", "Prefix for empty (seed) snapshot to create on newly provisioned filesystem") allowAutoFsExpansion = flag.Bool("allowautofsexpansion", false, "Allow expansion of filesystems used as CSI volumes") allowAutoFsCreation = flag.Bool("allowautofscreation", false, "Allow provisioning of CSI volumes as new Weka filesystems") - allowSnapshotsOfLegacyVolumes = flag.Bool("allowsnapshotsoflegacyvolumes", false, "Allow provisioning of CSI volumes or snapshots from legacy volumes") + allowSnapshotsOfDirectoryVolumes = flag.Bool("allowsnapshotsofdirectoryvolumes", false, "Allow provisioning of CSI volumes or snapshots from legacy volumes") suppressSnapshotsCapability = flag.Bool("suppresssnapshotcapability", false, "Do not expose CREATE_DELETE_SNAPSHOT, for testing purposes only") suppressVolumeCloneCapability = flag.Bool("suppressrvolumeclonecapability", false, "Do not expose CLONE_VOLUME, for testing purposes only") enableMetrics = flag.Bool("enablemetrics", false, "Enable Prometheus metrics endpoint") @@ -208,7 +208,7 @@ func handle() { *debugPath, *allowAutoFsCreation, *allowAutoFsExpansion, - *allowSnapshotsOfLegacyVolumes, + *allowSnapshotsOfDirectoryVolumes, *suppressSnapshotsCapability, *suppressVolumeCloneCapability, *allowInsecureHttps, diff --git a/pkg/wekafs/driverconfig.go b/pkg/wekafs/driverconfig.go index 8fab74bd..6d59438f 100644 --- a/pkg/wekafs/driverconfig.go +++ b/pkg/wekafs/driverconfig.go @@ -17,29 +17,29 @@ func (i *MutuallyExclusiveMountOptsStrings) Set(value string) error { } type DriverConfig struct { - DynamicVolPath string - VolumePrefix string - SnapshotPrefix string - SeedSnapshotPrefix string - allowAutoFsCreation bool - allowAutoFsExpansion bool - allowSnapshotsOfLegacyVolumes bool - advertiseSnapshotSupport bool - advertiseVolumeCloneSupport bool - debugPath string - allowInsecureHttps bool - alwaysAllowSnapshotVolumes bool - mutuallyExclusiveOptions []mutuallyExclusiveMountOptionSet - maxConcurrencyPerOp map[string]int64 - grpcRequestTimeout time.Duration - allowProtocolContainers bool - allowNfsFailback bool - useNfs bool - interfaceGroupName string - clientGroupName string - nfsProtocolVersion string - csiVersion string - skipGarbageCollection bool + DynamicVolPath string + VolumePrefix string + SnapshotPrefix string + SeedSnapshotPrefix string + allowAutoFsCreation bool + allowAutoFsExpansion bool + allowSnapshotsOfDirectoryVolumes bool + advertiseSnapshotSupport bool + advertiseVolumeCloneSupport bool + debugPath string + allowInsecureHttps bool + alwaysAllowSnapshotVolumes bool + mutuallyExclusiveOptions []mutuallyExclusiveMountOptionSet + maxConcurrencyPerOp map[string]int64 + grpcRequestTimeout time.Duration + allowProtocolContainers bool + allowNfsFailback bool + useNfs bool + interfaceGroupName string + clientGroupName string + nfsProtocolVersion string + csiVersion string + skipGarbageCollection bool } func (dc *DriverConfig) Log() { @@ -66,7 +66,7 @@ func (dc *DriverConfig) Log() { } func NewDriverConfig(dynamicVolPath, VolumePrefix, SnapshotPrefix, SeedSnapshotPrefix, debugPath string, - allowAutoFsCreation, allowAutoFsExpansion, allowSnapshotsOfLegacyVolumes bool, + allowAutoFsCreation, allowAutoFsExpansion, allowSnapshotsOfDirectoryVolumes bool, suppressnapshotSupport, suppressVolumeCloneSupport, allowInsecureHttps, alwaysAllowSnapshotVolumes bool, mutuallyExclusiveMountOptions MutuallyExclusiveMountOptsStrings, maxCreateVolumeReqs, maxDeleteVolumeReqs, maxExpandVolumeReqs, maxCreateSnapshotReqs, maxDeleteSnapshotReqs, maxNodePublishVolumeReqs, maxNodeUnpublishVolumeReqs int64, @@ -99,29 +99,29 @@ func NewDriverConfig(dynamicVolPath, VolumePrefix, SnapshotPrefix, SeedSnapshotP concurrency["NodeUnpublishVolume"] = maxNodeUnpublishVolumeReqs return &DriverConfig{ - DynamicVolPath: dynamicVolPath, - VolumePrefix: VolumePrefix, - SnapshotPrefix: SnapshotPrefix, - SeedSnapshotPrefix: SeedSnapshotPrefix, - allowAutoFsCreation: allowAutoFsCreation, - allowAutoFsExpansion: allowAutoFsExpansion, - allowSnapshotsOfLegacyVolumes: allowSnapshotsOfLegacyVolumes, - advertiseSnapshotSupport: !suppressnapshotSupport, - advertiseVolumeCloneSupport: !suppressVolumeCloneSupport, - debugPath: debugPath, - allowInsecureHttps: allowInsecureHttps, - alwaysAllowSnapshotVolumes: alwaysAllowSnapshotVolumes, - mutuallyExclusiveOptions: MutuallyExclusiveMountOptions, - maxConcurrencyPerOp: concurrency, - grpcRequestTimeout: grpcRequestTimeout, - allowProtocolContainers: allowProtocolContainers, - allowNfsFailback: allowNfsFailback, - useNfs: useNfs, - interfaceGroupName: interfaceGroupName, - clientGroupName: clientGroupName, - nfsProtocolVersion: nfsProtocolVersion, - csiVersion: version, - skipGarbageCollection: skipGarbageCollection, + DynamicVolPath: dynamicVolPath, + VolumePrefix: VolumePrefix, + SnapshotPrefix: SnapshotPrefix, + SeedSnapshotPrefix: SeedSnapshotPrefix, + allowAutoFsCreation: allowAutoFsCreation, + allowAutoFsExpansion: allowAutoFsExpansion, + allowSnapshotsOfDirectoryVolumes: allowSnapshotsOfDirectoryVolumes, + advertiseSnapshotSupport: !suppressnapshotSupport, + advertiseVolumeCloneSupport: !suppressVolumeCloneSupport, + debugPath: debugPath, + allowInsecureHttps: allowInsecureHttps, + alwaysAllowSnapshotVolumes: alwaysAllowSnapshotVolumes, + mutuallyExclusiveOptions: MutuallyExclusiveMountOptions, + maxConcurrencyPerOp: concurrency, + grpcRequestTimeout: grpcRequestTimeout, + allowProtocolContainers: allowProtocolContainers, + allowNfsFailback: allowNfsFailback, + useNfs: useNfs, + interfaceGroupName: interfaceGroupName, + clientGroupName: clientGroupName, + nfsProtocolVersion: nfsProtocolVersion, + csiVersion: version, + skipGarbageCollection: skipGarbageCollection, } } diff --git a/pkg/wekafs/volumeconstructors.go b/pkg/wekafs/volumeconstructors.go index c469bc80..6fa1a571 100644 --- a/pkg/wekafs/volumeconstructors.go +++ b/pkg/wekafs/volumeconstructors.go @@ -193,7 +193,7 @@ func NewVolumeForCreateFromSnapshotRequest(ctx context.Context, req *csi.CreateV } - if sourceSnap.hasInnerPath() && !server.getConfig().allowSnapshotsOfLegacyVolumes { + if sourceSnap.hasInnerPath() && !server.getConfig().allowSnapshotsOfDirectoryVolumes { // block creation of snapshots from legacy volumes, as it wastes space return nil, status.Errorf(codes.FailedPrecondition, "Creation of snapshots is prohibited on directory-backed CSI volumes. Refer to Weka CSI plugin documentation") } @@ -277,7 +277,7 @@ func NewVolumeForCloneVolumeRequest(ctx context.Context, req *csi.CreateVolumeRe if err != nil { return nil, status.Errorf(codes.NotFound, "Failed to validate source volume ID %s", sourceVolId) } - if sourceVol.hasInnerPath() && !server.getConfig().allowSnapshotsOfLegacyVolumes { + if sourceVol.hasInnerPath() && !server.getConfig().allowSnapshotsOfDirectoryVolumes { // block cloning of snapshots from legacy volumes, as it wastes space return nil, status.Errorf(codes.FailedPrecondition, "Cloning is not supported for Legacy CSI volumes") } diff --git a/tests/csi-sanity/docker-compose-nfs-snapshotcaps.yaml b/tests/csi-sanity/docker-compose-nfs-snapshotcaps.yaml index eaaedd93..e46d5509 100644 --- a/tests/csi-sanity/docker-compose-nfs-snapshotcaps.yaml +++ b/tests/csi-sanity/docker-compose-nfs-snapshotcaps.yaml @@ -3,7 +3,7 @@ version: '3.8' services: plugin_controller: image: sanity - command: wekafsplugin -nodeid 1 -v 6 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller.sock -metricsport=9091 --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -alwaysallowsnapshotvolumes -usenfs -interfacegroupname=NFS + command: wekafsplugin -nodeid 1 -v 6 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller.sock -metricsport=9091 --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -alwaysallowsnapshotvolumes -usenfs -interfacegroupname=NFS volumes: - test-volume:/tmp/weka-csi-test privileged: true @@ -16,7 +16,7 @@ services: interval: 3s plugin_node: image: sanity - command: wekafsplugin -nodeid 1 -v 6 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock -metricsport=9092 --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -alwaysallowsnapshotvolumes -usenfs -interfacegroupname=NFS + command: wekafsplugin -nodeid 1 -v 6 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock -metricsport=9092 --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -alwaysallowsnapshotvolumes -usenfs -interfacegroupname=NFS volumes: - test-volume:/tmp/weka-csi-test privileged: true diff --git a/tests/csi-sanity/docker-compose-nosnapshotcaps.yaml b/tests/csi-sanity/docker-compose-nosnapshotcaps.yaml index 004442d1..68e98319 100644 --- a/tests/csi-sanity/docker-compose-nosnapshotcaps.yaml +++ b/tests/csi-sanity/docker-compose-nosnapshotcaps.yaml @@ -3,7 +3,7 @@ version: '3.8' services: plugin_controller_no_snaps: image: sanity - command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9091 --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes + command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9091 --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes volumes: - test-volume:/tmp/weka-csi-test privileged: true @@ -17,7 +17,7 @@ services: plugin_node_no_snaps: image: sanity - command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9092 --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes + command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9092 --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes volumes: - test-volume:/tmp/weka-csi-test privileged: true diff --git a/tests/csi-sanity/docker-compose-snapshotcaps.yaml b/tests/csi-sanity/docker-compose-snapshotcaps.yaml index c0ab0298..0f132eb7 100644 --- a/tests/csi-sanity/docker-compose-snapshotcaps.yaml +++ b/tests/csi-sanity/docker-compose-snapshotcaps.yaml @@ -3,7 +3,7 @@ version: '3.8' services: plugin_controller: image: sanity - command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9091 --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -alwaysallowsnapshotvolumes + command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9091 --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -alwaysallowsnapshotvolumes volumes: - test-volume:/tmp/weka-csi-test privileged: true @@ -16,7 +16,7 @@ services: interval: 3s plugin_node: image: sanity - command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9092 --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -alwaysallowsnapshotvolumes + command: wekafsplugin -nodeid 1 -v ${PLUGIN_VERBOSITY} --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock --debugpath=/tmp/weka-csi-test/filesystems -metricsport=9092 --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -alwaysallowsnapshotvolumes volumes: - test-volume:/tmp/weka-csi-test privileged: true diff --git a/tests/csi-sanity/docker-compose.yaml b/tests/csi-sanity/docker-compose.yaml index 7c5f8d10..35bf87d8 100644 --- a/tests/csi-sanity/docker-compose.yaml +++ b/tests/csi-sanity/docker-compose.yaml @@ -3,7 +3,7 @@ version: '3' services: plugin_controller: build: . - command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -alwaysallowsnapshotvolumes + command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -alwaysallowsnapshotvolumes volumes: - test-volume:/tmp/weka-csi-test privileged: true @@ -11,7 +11,7 @@ services: - "9001:9090" plugin_node: build: . - command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -alwaysallowsnapshotvolumes + command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -alwaysallowsnapshotvolumes volumes: - test-volume:/tmp/weka-csi-test privileged: true @@ -19,7 +19,7 @@ services: - "9002:9090" plugin_controller_no_snaps: build: . - command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes + command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes volumes: - test-volume:/tmp/weka-csi-test privileged: true @@ -27,7 +27,7 @@ services: - "9003:9090" plugin_node_no_snaps: build: . - command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes + command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node-no-snaps.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -suppresssnapshotcapability -suppressrvolumeclonecapability -alwaysallowsnapshotvolumes volumes: - test-volume:/tmp/weka-csi-test privileged: true @@ -35,7 +35,7 @@ services: - "9004:9090" plugin_controller_nfs: build: . - command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller-nfs.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -alwaysallowsnapshotvolumes -usenfs + command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/controller-nfs.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=controller -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -alwaysallowsnapshotvolumes -usenfs volumes: - test-volume:/tmp/weka-csi-test privileged: true @@ -43,7 +43,7 @@ services: - "9005:9090" plugin_node_nfs: build: . - command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsoflegacyvolumes -alwaysallowsnapshotvolumes -usenfs + command: wekafsplugin -nodeid 1 -v 9 --allowinsecurehttps --endpoint=unix://tmp/weka-csi-test/node.sock --debugpath=/tmp/weka-csi-test/filesystems --csimode=node -enablemetrics -allowautofscreation -allowautofsexpansion -allowsnapshotsofdirectoryvolumes -alwaysallowsnapshotvolumes -usenfs volumes: - test-volume:/tmp/weka-csi-test privileged: true From 7caa12b94fa66d0c6540287ca7d57ea1498f2438 Mon Sep 17 00:00:00 2001 From: Sergey Berezansky Date: Tue, 28 Jan 2025 11:49:20 +0200 Subject: [PATCH 4/5] chore(CSI-314): remove non-nfs sanity as they are supposed to fail now --- .github/workflows/sanity.yaml | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/.github/workflows/sanity.yaml b/.github/workflows/sanity.yaml index 8466cfaf..5a08c761 100644 --- a/.github/workflows/sanity.yaml +++ b/.github/workflows/sanity.yaml @@ -40,18 +40,8 @@ jobs: load: true - directory_volume_and_snapshots: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }} - runs-on: self-hosted - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - run: docker-compose -f tests/csi-sanity/docker-compose-snapshotcaps.yaml up $COMPOSE_DEFAULTS - env: - SANITY_FUNCTION: directory_volume_and_snapshots - directory_volume_and_snapshots_nfs: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }} - needs: directory_volume_and_snapshots runs-on: self-hosted steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 @@ -59,19 +49,9 @@ jobs: env: SANITY_FUNCTION: directory_volume_and_snapshots_nfs - snaphot_volumes_with_2nd_level_shapshots: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }} - needs: directory_volume_and_snapshots_nfs - runs-on: self-hosted - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - run: docker-compose -f tests/csi-sanity/docker-compose-snapshotcaps.yaml up $COMPOSE_DEFAULTS - env: - SANITY_FUNCTION: snaphot_volumes_with_2nd_level_shapshots - snaphot_volumes_with_2nd_level_shapshots_nfs: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }} - needs: snaphot_volumes_with_2nd_level_shapshots + needs: directory_volume_and_snapshots_nfs runs-on: self-hosted steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 @@ -79,19 +59,9 @@ jobs: env: SANITY_FUNCTION: snaphot_volumes_with_2nd_level_shapshots_nfs - filesystem_volumes: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }} - needs: snaphot_volumes_with_2nd_level_shapshots_nfs - runs-on: self-hosted - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - run: docker-compose -f tests/csi-sanity/docker-compose-snapshotcaps.yaml up $COMPOSE_DEFAULTS - env: - SANITY_FUNCTION: filesystem_volumes - filesystem_volumes_nfs: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-tests') }} - needs: filesystem_volumes + needs: snaphot_volumes_with_2nd_level_shapshots_nfs runs-on: self-hosted steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 From 0afffa4685f630166b18f174e1459814e7c221b5 Mon Sep 17 00:00:00 2001 From: Sergey Berezansky Date: Tue, 28 Jan 2025 13:02:51 +0200 Subject: [PATCH 5/5] chore(CSI-314): fix compatibility_test.go --- pkg/wekafs/apiclient/compatibility_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/wekafs/apiclient/compatibility_test.go b/pkg/wekafs/apiclient/compatibility_test.go index 4ceb6502..1e4b0e5c 100644 --- a/pkg/wekafs/apiclient/compatibility_test.go +++ b/pkg/wekafs/apiclient/compatibility_test.go @@ -69,7 +69,6 @@ func TestWekaCompatibilityMap_fillIn(t *testing.T) { DirectoryAsCSIVolume: true, FilesystemAsCSIVolume: true, QuotaOnDirectoryVolume: true, - QuotaSetOnNonEmptyVolume: true, QuotaOnSnapshot: true, MountFilesystemsUsingAuthToken: true, CreateNewFilesystemFromSnapshot: true,