-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add NFS dynamic provisioner step for SBR unknown-provisioner tests #83913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
abrugaro
wants to merge
5
commits into
openshift:main
Choose a base branch
from
abrugaro:add-steps-for-unknown-providers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
58287b2
deploy incluster nfs with unknown provisioner
abrugaro 65d293a
Merge branch 'main' of https://github.com/openshift/release into add-…
abrugaro 023bad9
address coderabbit comments
abrugaro a463061
address comments
abrugaro c9e6575
address comments
abrugaro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
ci-operator/step-registry/medik8s/sbr/nfs-dynamic-provisioner/OWNERS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - medik8s-admins | ||
| reviewers: | ||
| - medik8s-admins |
301 changes: 301 additions & 0 deletions
301
...istry/medik8s/sbr/nfs-dynamic-provisioner/medik8s-sbr-nfs-dynamic-provisioner-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,301 @@ | ||
| #!/usr/bin/env bash | ||
| # Deploy an in-cluster NFS dynamic provisioner for SBR unknown-provisioner | ||
| # tests. StorageClass "nfs-sbr-dynamic" uses provisioner "sbr.io/nfs-provisioner" | ||
| # with reclaimPolicy Retain — SBR treats this as an unknown provisioner and | ||
| # triggers its testRWXSupport code path. | ||
| set -euo pipefail | ||
|
|
||
| NS="nfs-sbr-provisioner" | ||
| PROVISIONER_NAME="sbr.io/nfs-provisioner" | ||
| SC_NAME="nfs-sbr-dynamic" | ||
| NFS_IMAGE="quay.io/openshifttest/nfs-provisioner@sha256:f402e6039b3c1e60bf6596d283f3c470ffb0a1e169ceb8ce825e3218cd66c050" | ||
|
|
||
| echo "INFO: Creating namespace ${NS}" | ||
| oc create ns "${NS}" | ||
|
abrugaro marked this conversation as resolved.
Outdated
|
||
|
|
||
| oc label ns "${NS}" --overwrite \ | ||
| security.openshift.io/scc.podSecurityLabelSync=false \ | ||
| pod-security.kubernetes.io/enforce=privileged \ | ||
| pod-security.kubernetes.io/audit=privileged \ | ||
| pod-security.kubernetes.io/warn=privileged | ||
|
|
||
| echo "INFO: Creating RBAC resources" | ||
| oc apply -f - <<EOF | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: nfs-provisioner | ||
| namespace: ${NS} | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: nfs-sbr-provisioner-runner | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["persistentvolumes"] | ||
| verbs: ["get", "list", "watch", "create", "delete"] | ||
| - apiGroups: [""] | ||
| resources: ["persistentvolumeclaims"] | ||
| verbs: ["get", "list", "watch", "update"] | ||
| - apiGroups: ["storage.k8s.io"] | ||
| resources: ["storageclasses"] | ||
| verbs: ["get", "list", "watch"] | ||
| - apiGroups: [""] | ||
| resources: ["events"] | ||
| verbs: ["create", "update", "patch"] | ||
| - apiGroups: [""] | ||
| resources: ["services", "endpoints"] | ||
| verbs: ["get"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: run-nfs-sbr-provisioner | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: nfs-provisioner | ||
| namespace: ${NS} | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: nfs-sbr-provisioner-runner | ||
| apiGroup: rbac.authorization.k8s.io | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: leader-locking-nfs-provisioner | ||
| namespace: ${NS} | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["endpoints"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: leader-locking-nfs-provisioner | ||
| namespace: ${NS} | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: nfs-provisioner | ||
| namespace: ${NS} | ||
| roleRef: | ||
| kind: Role | ||
| name: leader-locking-nfs-provisioner | ||
| apiGroup: rbac.authorization.k8s.io | ||
| EOF | ||
|
|
||
| echo "INFO: Creating SecurityContextConstraints" | ||
| oc apply -f - <<EOF | ||
| allowHostDirVolumePlugin: true | ||
| allowHostIPC: false | ||
| allowHostNetwork: false | ||
| allowHostPID: false | ||
| allowHostPorts: false | ||
| allowPrivilegedContainer: false | ||
| allowedCapabilities: | ||
| - DAC_READ_SEARCH | ||
| - SYS_RESOURCE | ||
| apiVersion: security.openshift.io/v1 | ||
| defaultAddCapabilities: null | ||
| fsGroup: | ||
| type: MustRunAs | ||
| kind: SecurityContextConstraints | ||
| metadata: | ||
| name: nfs-sbr-provisioner | ||
| readOnlyRootFilesystem: false | ||
| requiredDropCapabilities: | ||
| - KILL | ||
| - MKNOD | ||
| - SYS_CHROOT | ||
| runAsUser: | ||
| type: RunAsAny | ||
| seLinuxContext: | ||
| type: MustRunAs | ||
| supplementalGroups: | ||
| type: RunAsAny | ||
| volumes: | ||
| - configMap | ||
| - downwardAPI | ||
| - emptyDir | ||
| - persistentVolumeClaim | ||
| - secret | ||
| - hostPath | ||
| EOF | ||
|
|
||
| oc adm policy add-scc-to-user nfs-sbr-provisioner "system:serviceaccount:${NS}:nfs-provisioner" | ||
| oc adm policy add-scc-to-user privileged "system:serviceaccount:${NS}:nfs-provisioner" | ||
|
abrugaro marked this conversation as resolved.
|
||
|
|
||
| echo "INFO: Creating Service and Deployment" | ||
| oc -n "${NS}" apply -f - <<EOF | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: nfs-provisioner | ||
| labels: | ||
| app: nfs-sbr-provisioner | ||
| spec: | ||
| ports: | ||
| - name: nfs | ||
| port: 2049 | ||
| - name: nfs-udp | ||
| port: 2049 | ||
| protocol: UDP | ||
| - name: nlockmgr | ||
| port: 32803 | ||
| - name: nlockmgr-udp | ||
| port: 32803 | ||
| protocol: UDP | ||
| - name: mountd | ||
| port: 20048 | ||
| - name: mountd-udp | ||
| port: 20048 | ||
| protocol: UDP | ||
| - name: rquotad | ||
| port: 875 | ||
| - name: rquotad-udp | ||
| port: 875 | ||
| protocol: UDP | ||
| - name: rpcbind | ||
| port: 111 | ||
| - name: rpcbind-udp | ||
| port: 111 | ||
| protocol: UDP | ||
| - name: statd | ||
| port: 662 | ||
| - name: statd-udp | ||
| port: 662 | ||
| protocol: UDP | ||
| selector: | ||
| app: nfs-sbr-provisioner | ||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: nfs-provisioner | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| app: nfs-sbr-provisioner | ||
| replicas: 1 | ||
| strategy: | ||
| type: Recreate | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: nfs-sbr-provisioner | ||
| spec: | ||
| serviceAccount: nfs-provisioner | ||
| initContainers: | ||
| - name: init | ||
| image: ${NFS_IMAGE} | ||
| command: ["sh", "-c", "mkdir -p /srv/nfs; chcon -Rt svirt_sandbox_file_t /srv/nfs 2>/dev/null || true; chmod 777 /srv/nfs"] | ||
| volumeMounts: | ||
| - mountPath: /srv | ||
| name: local | ||
| securityContext: | ||
| privileged: true | ||
|
abrugaro marked this conversation as resolved.
|
||
| resources: | ||
| requests: | ||
| cpu: 50m | ||
| memory: 64Mi | ||
| limits: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| containers: | ||
| - name: nfs-provisioner | ||
| image: ${NFS_IMAGE} | ||
| ports: | ||
| - name: nfs | ||
| containerPort: 2049 | ||
| - name: nfs-udp | ||
| containerPort: 2049 | ||
| protocol: UDP | ||
| - name: nlockmgr | ||
| containerPort: 32803 | ||
| - name: nlockmgr-udp | ||
| containerPort: 32803 | ||
| protocol: UDP | ||
| - name: mountd | ||
| containerPort: 20048 | ||
| - name: mountd-udp | ||
| containerPort: 20048 | ||
| protocol: UDP | ||
| - name: rquotad | ||
| containerPort: 875 | ||
| - name: rquotad-udp | ||
| containerPort: 875 | ||
| protocol: UDP | ||
| - name: rpcbind | ||
| containerPort: 111 | ||
| - name: rpcbind-udp | ||
| containerPort: 111 | ||
| protocol: UDP | ||
| - name: statd | ||
| containerPort: 662 | ||
| - name: statd-udp | ||
| containerPort: 662 | ||
| protocol: UDP | ||
| securityContext: | ||
| capabilities: | ||
| add: | ||
| - DAC_READ_SEARCH | ||
| - SYS_RESOURCE | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| limits: | ||
| cpu: 500m | ||
| memory: 512Mi | ||
| args: | ||
| - "-provisioner=${PROVISIONER_NAME}" | ||
| env: | ||
| - name: POD_IP | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: status.podIP | ||
| - name: SERVICE_NAME | ||
| value: nfs-provisioner | ||
| - name: POD_NAMESPACE | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: metadata.namespace | ||
| imagePullPolicy: IfNotPresent | ||
| volumeMounts: | ||
| - name: export-volume | ||
| mountPath: /export | ||
| volumes: | ||
| - name: export-volume | ||
| hostPath: | ||
| path: /srv/nfs | ||
| - name: local | ||
| hostPath: | ||
| path: /srv | ||
| EOF | ||
|
|
||
| echo "INFO: Waiting for NFS provisioner deployment rollout" | ||
| if ! oc -n "${NS}" rollout status deployment/nfs-provisioner --timeout=300s; then | ||
| echo "ERROR: NFS provisioner deployment did not become ready within 5 minutes" | ||
| oc -n "${NS}" get pods -o custom-columns=NAME:.metadata.name,STATUS:.status.phase,RESTARTS:.status.containerStatuses[0].restartCount | ||
| oc -n "${NS}" get events --field-selector reason!=Pulled --sort-by='.lastTimestamp' | tail -20 | ||
| exit 1 | ||
| fi | ||
| echo "INFO: NFS provisioner deployment is ready" | ||
|
|
||
| echo "INFO: Creating StorageClass ${SC_NAME}" | ||
| oc apply -f - <<EOF | ||
| apiVersion: storage.k8s.io/v1 | ||
| kind: StorageClass | ||
| metadata: | ||
| name: ${SC_NAME} | ||
| provisioner: ${PROVISIONER_NAME} | ||
| reclaimPolicy: Retain | ||
| mountOptions: | ||
| - vers=4.1 | ||
| EOF | ||
|
|
||
| echo "INFO: NFS dynamic provisioner deployed successfully" | ||
| oc get sc "${SC_NAME}" | ||
| oc -n "${NS}" get pods | ||
11 changes: 11 additions & 0 deletions
11
...medik8s/sbr/nfs-dynamic-provisioner/medik8s-sbr-nfs-dynamic-provisioner-ref.metadata.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "path": "medik8s/sbr/nfs-dynamic-provisioner/medik8s-sbr-nfs-dynamic-provisioner-ref.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "medik8s-admins" | ||
| ], | ||
| "reviewers": [ | ||
| "medik8s-admins" | ||
| ] | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
...registry/medik8s/sbr/nfs-dynamic-provisioner/medik8s-sbr-nfs-dynamic-provisioner-ref.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ref: | ||
| as: medik8s-sbr-nfs-dynamic-provisioner | ||
| from: cli | ||
| grace_period: 10m | ||
| commands: medik8s-sbr-nfs-dynamic-provisioner-commands.sh | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| memory: 200Mi | ||
| documentation: |- | ||
| Deploys an in-cluster NFS dynamic provisioner for SBR unknown-provisioner | ||
| tests. Creates a StorageClass "nfs-sbr-dynamic" with provisioner | ||
| "sbr.io/nfs-provisioner" and reclaimPolicy Retain, which SBR treats as | ||
| an unknown provisioner and triggers testRWXSupport validation. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config change adds the new
medik8s-sbr-nfs-dynamic-provisionerref to six test variants, but the PR includes no regenerated Prow job files underci-operator/jobs/. Theci/prow/generated-configcheck will fail because it compares committed generated files against fresh output.Fix: Run
make jobsand commit the generated output:make jobs git add ci-operator/jobs/medik8s/system-tests/There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did run
make jobsandmake updateand I don't see anything under these folders, I'll wait to see if the pr checks complain and look into thatThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
make updateis enough :)