Skip to content

Commit 925164f

Browse files
shengnuoshivamerla
authored andcommitted
Bind volcano-scheduler ServiceAccount to hostmount-anyuid SCC
Signed-off-by: Sheng Lin <[email protected]>
1 parent ca3bf0f commit 925164f

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

test/e2e/nemo-dependencies/customizer/tasks/uninstall.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
ignore_errors: true
1414

1515
- name: Delete Volcano Kubernetes resources
16-
shell: kubectl get {{ item }} | egrep 'volcano|mlflow' | awk '{print $1}' | xargs kubectl delete {{ item }}
16+
shell: kubectl get {{ item }} -n {{ namespace }} | egrep 'volcano|mlflow' | awk '{print $1}' | xargs kubectl delete {{ item }} -n {{ namespace }}
1717
loop:
1818
- crd
19+
- serviceaccount
1920
- clusterrole
2021
- clusterrolebinding
2122
- mutatingwebhookconfiguration

test/e2e/nemo-dependencies/customizer/tasks/volcano.yaml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,40 @@
66
- name: Update Helm repositories cache
77
command: helm repo update
88

9+
- name: Get Kube API resources
10+
command: kubectl api-resources --verbs=list --namespaced -o name
11+
register: api_resources
12+
13+
- name: Check if the current cluster is OpenShift
14+
set_fact:
15+
is_openshift: "{{ 'routes.route.openshift.io' in api_resources.stdout_lines }}"
16+
17+
- name: OpenShift - Prepare RBAC to use hostmount-anyuid SCC
18+
ansible.builtin.template:
19+
src: volcano-oc-rbac.yaml.j2
20+
dest: volcano-oc-rbac.yaml
21+
when: is_openshift
22+
23+
- name: OpenShift - apply RBAC to use hostmount-anyuid SCC
24+
command: kubectl apply -f volcano-oc-rbac.yaml
25+
when: is_openshift
26+
927
- name: Install Volcano Helm chart in Kubernetes cluster
1028
shell: |
1129
helm upgrade --install {{ volcano.helm_repo_name }} {{ volcano.chart_name }} \
1230
--namespace {{ namespace }} \
1331
--version {{ volcano.chart_version }}
1432
15-
- name: Wait for Volcano pods to be created (timeout = 300s)
16-
shell: |
17-
timeout 300s bash -c 'until kubectl get pods -n {{ namespace }} | grep -q volcano; do sleep 1; done'
18-
register: wait_result
33+
- name: Wait for Volcano deployments to be available
34+
command: kubectl rollout status deployment/{{ item }} -n {{ namespace }} --timeout=300s
35+
loop:
36+
- volcano-scheduler
37+
- volcano-admission
38+
- volcano-controllers
39+
register: rollout_status
40+
retries: 5
41+
delay: 10
42+
until: rollout_status.rc == 0
1943

2044
- name: Run Volcano Job if validation is enabled
2145
block:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: Role
3+
metadata:
4+
name: scc-hostmount-anyuid
5+
namespace: {{ namespace }}
6+
rules:
7+
- apiGroups: ['security.openshift.io']
8+
resources: ['securitycontextconstraints']
9+
verbs: ['use']
10+
resourceNames: ['hostmount-anyuid']
11+
12+
---
13+
14+
apiVersion: rbac.authorization.k8s.io/v1
15+
kind: RoleBinding
16+
metadata:
17+
name: volcano-scc-hostmount-anyuid-binding
18+
namespace: {{ namespace }}
19+
subjects:
20+
- kind: ServiceAccount
21+
name: volcano-scheduler
22+
namespace: {{ namespace }}
23+
roleRef:
24+
kind: Role
25+
name: scc-hostmount-anyuid
26+
apiGroup: rbac.authorization.k8s.io

0 commit comments

Comments
 (0)