Skip to content

Commit

Permalink
fix(helm): configure version for snapshot api (#361)
Browse files Browse the repository at this point in the history
On some managed K8s clusters like OpenShift or GKE that ship with
their own default CSI Drivers, the controllers will end up creating
v1beta1 objects. An issue like the following was noticed when running
cstor charts on GKE 1.19.

```
 unable to recognize "": no matches for kind "VolumeSnapshotClass" in
 version "snapshot.storage.k8s.io/v1"
```

This commit uses the helm .Capabilities to check the version available
in the cluster and install the class accordingly. As the .Capabilities
might return false when using with template command, v1 is kept for false
(or default) case.

Signed-off-by: kmova <kiran.mova@mayadata.io>
  • Loading branch information
kmova authored Jul 16, 2021
1 parent 6951358 commit 3cef351
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deploy/helm/charts/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: CStor-Operator helm chart for Kubernetes
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 2.11.0
version: 2.11.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 2.11.0
Expand Down
1 change: 0 additions & 1 deletion deploy/helm/charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,3 @@ helm install openebs-cstor openebs-cstor/cstor --namespace openebs --create-name
| serviceAccount.csiController.name | string | `"openebs-cstor-csi-controller-sa"` | CSI Controller ServiceAccount name |
| serviceAccount.csiNode.create | bool | `true` | Enable CSI Node ServiceAccount |
| serviceAccount.csiNode.name | string | `"openebs-cstor-csi-node-sa"` | CSI Node ServiceAccount name |

8 changes: 6 additions & 2 deletions deploy/helm/charts/templates/snapshot-class.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
kind: VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1
apiVersion: {{ if .Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1beta1" -}}
snapshot.storage.k8s.io/v1beta1
{{- else -}}
snapshot.storage.k8s.io/v1
{{- end }}
metadata:
name: csi-cstor-snapshotclass
annotations:
snapshot.storage.kubernetes.io/is-default-class: "true"
driver: cstor.csi.openebs.io
deletionPolicy: Delete
deletionPolicy: Delete

0 comments on commit 3cef351

Please sign in to comment.