Skip to content

Commit b5e1c94

Browse files
committed
feat: csidriver object api version v1
1 parent 1166c19 commit b5e1c94

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ test-style: setup
5555
@echo "==> Running static validations and linters <=="
5656
# Setting timeout to 5m as deafult is 1m
5757
golangci-lint run --timeout=5m
58+
# Run helm lint tests
59+
helm lint --strict charts/secrets-store-csi-driver
60+
helm lint --strict manifest_staging/charts/secrets-store-csi-driver
61+
5862
sanity-test:
5963
go test -v ./test/sanity
6064
build: setup
@@ -70,6 +74,7 @@ clean:
7074
setup: clean
7175
@echo "Setup..."
7276
$Q go env
77+
$(MAKE) install-helm
7378

7479
ifndef HAS_GOLANGCI
7580
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.30.0
@@ -126,7 +131,7 @@ endif
126131

127132
.PHONY: install-helm
128133
install-helm:
129-
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
134+
helm version --short | grep -q v3 || (curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash)
130135

131136
.PHONY: e2e-teardown
132137
e2e-teardown:

manifest_staging/charts/secrets-store-csi-driver/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,14 @@ labels:
3232
app: {{ template "sscd.name" . }}
3333
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
3434
{{- end -}}
35+
36+
{{/*
37+
Return the appropriate apiVersion for CSIDriver.
38+
*/}}
39+
{{- define "csidriver.apiVersion" -}}
40+
{{- if semverCompare ">=1.18-0" .Capabilities.KubeVersion.Version }}
41+
{{- print "storage.k8s.io/v1" -}}
42+
{{- else -}}
43+
{{- print "storage.k8s.io/v1beta1" -}}
44+
{{- end -}}
45+
{{- end -}}

manifest_staging/charts/secrets-store-csi-driver/templates/csidriver.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: storage.k8s.io/v1beta1
1+
apiVersion: {{ template "csidriver.apiVersion" . }}
22
kind: CSIDriver
33
metadata:
44
name: secrets-store.csi.k8s.io

0 commit comments

Comments
 (0)