Skip to content

Commit

Permalink
Add test case for OpenShift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
simu committed Aug 25, 2023
1 parent 2003538 commit 8b393fe
Show file tree
Hide file tree
Showing 16 changed files with 626 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"name": "csi-cloudscale",
"slug": "csi-cloudscale",
"parameter_key": "csi_cloudscale",
"test_cases": "defaults",
"test_cases": "defaults openshift4",
"add_lib": "n",
"add_pp": "n",
"add_golden": "y",
"add_matrix": "n",
"add_matrix": "y",
"add_go_unit": "n",
"copyright_holder": "VSHN AG <[email protected]>",
"copyright_year": "2021",
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
args: 'check'
test:
runs-on: ubuntu-latest
strategy:
matrix:
instance:
- defaults
- openshift4
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
Expand All @@ -37,9 +42,14 @@ jobs:
with:
path: ${{ env.COMPONENT_NAME }}
- name: Compile component
run: make test
run: make test -e instance=${{ matrix.instance }}
golden:
runs-on: ubuntu-latest
strategy:
matrix:
instance:
- defaults
- openshift4
defaults:
run:
working-directory: ${{ env.COMPONENT_NAME }}
Expand All @@ -48,4 +58,4 @@ jobs:
with:
path: ${{ env.COMPONENT_NAME }}
- name: Golden diff
run: make golden-diff
run: make golden-diff -e instance=${{ matrix.instance }}
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ golden-diff: commodore_args += -f tests/$(instance).yml
golden-diff: clean .compile ## Diff compile output against the reference version. Review output and run `make gen-golden golden-diff` if this target fails.
@git diff --exit-code --minimal --no-index -- tests/golden/$(instance) compiled/

.PHONY: golden-diff-all
golden-diff-all: recursive_target=golden-diff
golden-diff-all: $(test_instances) ## Run golden-diff for all instances. Note: this doesn't work when running make with multiple parallel jobs (-j != 1).

.PHONY: gen-golden-all
gen-golden-all: recursive_target=gen-golden
gen-golden-all: $(test_instances) ## Run gen-golden for all instances. Note: this doesn't work when running make with multiple parallel jobs (-j != 1).

.PHONY: lint_kubent_all
lint_kubent_all: recursive_target=lint_kubent
lint_kubent_all: $(test_instances) ## Lint deprecated Kubernetes API versions for all golden test instances. Will exit on first error. Note: this doesn't work when running make with multiple parallel jobs (-j != 1).

.PHONY: $(test_instances)
$(test_instances):
$(MAKE) $(recursive_target) -e instance=$(basename $(@F))

.PHONY: clean
clean: ## Clean the project
rm -rf .cache compiled dependencies vendor helmcharts jsonnetfile*.json || true
1 change: 1 addition & 0 deletions Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= defaults
test_instances = tests/defaults.yml tests/openshift4.yml
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"postUpgradeTasks": {
"commands": [
"make gen-golden"
"make gen-golden-all"
],
"fileFilters": [ "tests/golden/**" ],
"executionMode": "update"
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Namespace
metadata:
annotations:
openshift.io/node-selector: ''
labels:
name: syn-csi-cloudscale
name: syn-csi-cloudscale
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: storage.k8s.io/v1
kind: CSIDriver
metadata:
name: csi.cloudscale.ch
spec:
attachRequired: true
podInfoOnMount: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: csi-cloudscale-node
spec:
selector:
matchLabels:
app: csi-cloudscale-node
template:
metadata:
labels:
app: csi-cloudscale-node
role: csi-cloudscale
spec:
containers:
- args:
- --v=5
- --csi-address=$(ADDRESS)
- --kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)
env:
- name: ADDRESS
value: /csi/csi.sock
- name: DRIVER_REG_SOCK_PATH
value: /var/lib/kubelet/plugins/csi.cloudscale.ch/csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.5.1
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- rm -rf /registration/csi.cloudscale.ch /registration/csi.cloudscale.ch-reg.sock
name: csi-node-driver-registrar
resources:
requests:
cpu: 20m
memory: 32Mi
volumeMounts:
- mountPath: /csi/
name: plugin-dir
- mountPath: /registration/
name: registration-dir
- args:
- --endpoint=$(CSI_ENDPOINT)
- --url=$(CLOUDSCALE_API_URL)
env:
- name: CSI_ENDPOINT
value: unix:///csi/csi.sock
- name: CLOUDSCALE_API_URL
value: https://api.cloudscale.ch/
- name: CLOUDSCALE_MAX_CSI_VOLUMES_PER_NODE
value: '125'
- name: CLOUDSCALE_ACCESS_TOKEN
valueFrom:
secretKeyRef:
key: access-token
name: cloudscale
image: quay.io/cloudscalech/cloudscale-csi-plugin:v3.5.0
imagePullPolicy: IfNotPresent
name: csi-cloudscale-plugin
resources:
requests:
cpu: 20m
memory: 32Mi
securityContext:
allowPrivilegeEscalation: true
capabilities:
add:
- SYS_ADMIN
privileged: true
volumeMounts:
- mountPath: /csi
name: plugin-dir
- mountPath: /var/lib/kubelet
mountPropagation: Bidirectional
name: pods-mount-dir
- mountPath: /dev
name: device-dir
- mountPath: /tmp
name: tmpfs
hostNetwork: true
priorityClassName: system-node-critical
serviceAccount: csi-cloudscale-node-sa
volumes:
- hostPath:
path: /var/lib/kubelet/plugins_registry/
type: DirectoryOrCreate
name: registration-dir
- hostPath:
path: /var/lib/kubelet/plugins/csi.cloudscale.ch
type: DirectoryOrCreate
name: plugin-dir
- hostPath:
path: /var/lib/kubelet
type: Directory
name: pods-mount-dir
- hostPath:
path: /dev
name: device-dir
- emptyDir:
medium: Memory
name: tmpfs
Loading

0 comments on commit 8b393fe

Please sign in to comment.