Skip to content

Commit f0e542b

Browse files
committed
Use namespaced admin user for e2e test execution
1 parent bc6afe8 commit f0e542b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/e2e_tests.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ jobs:
7676
make deploy -e IMG="${IMG}" -e ENV="e2e"
7777
kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager
7878
79+
- name: Add user to KinD
80+
uses: ./common/github-actions/kind-add-user
81+
with:
82+
user-name: test-user
83+
84+
- name: Configure RBAC for test user to use namespaced admin role
85+
run: |
86+
kubectl create clusterrole namespace-creator --verb=get,list,create,delete,patch --resource=namespaces
87+
kubectl create clusterrolebinding sdk-user-namespace-creator --clusterrole=namespace-creator --user=test-user
88+
kubectl create clusterrolebinding test-user-namespaced-admin --clusterrole=admin --user=test-user
89+
90+
- name: Switch to test-user for test execution
91+
run: kubectl config use-context test-user
92+
7993
- name: Run e2e tests
8094
run: |
8195
export CODEFLARE_TEST_TIMEOUT_SHORT=3m
@@ -88,6 +102,10 @@ jobs:
88102
set -euo pipefail
89103
go test -timeout 60m -v -skip "^Test.*Cpu$" ./test/e2e -json 2>&1 | tee ${CODEFLARE_TEST_OUTPUT_DIR}/gotest.log | gotestfmt
90104
105+
- name: Switch to kind-cluster context to print logs
106+
if: always() && steps.deploy.outcome == 'success'
107+
run: kubectl config use-context kind-cluster
108+
91109
- name: Print CodeFlare operator logs
92110
if: always() && steps.deploy.outcome == 'success'
93111
run: |

0 commit comments

Comments
 (0)