@@ -14,6 +14,47 @@ Pre-requisite for KinD clusters: please add in your local `/etc/hosts` file `127
14
14
make deploy -e IMG=quay.io/project-codeflare/codeflare-operator:v1.1.0
15
15
make setup-e2e
16
16
```
17
+
18
+ - ** (Optional)** - Create and add ` sdk-user ` with limited permissions to the cluster to run through the e2e tests:
19
+ ```
20
+ # Get KinD certificates
21
+ docker cp kind-control-plane:/etc/kubernetes/pki/ca.crt .
22
+ docker cp kind-control-plane:/etc/kubernetes/pki/ca.key .
23
+
24
+ # Generate certificates for new user
25
+ openssl genrsa -out user.key 2048
26
+ openssl req -new -key user.key -out user.csr -subj '/CN=sdk-user/O=tenant'
27
+ openssl x509 -req -in user.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out user.crt -days 360
28
+
29
+ # Add generated certificated to KinD context
30
+ user_crt=$(base64 --wrap=0 user.crt)
31
+ user_key=$(base64 --wrap=0 user.key)
32
+ yq eval -i ".contexts += {\"context\": {\"cluster\": \"kind-kind\", \"user\": \"sdk-user\"}, \"name\": \"sdk-user\"}" $HOME/.kube/config
33
+ yq eval -i ".users += {\"name\": \"sdk-user\", \"user\": {\"client-certificate-data\": \"$user_crt\", \"client-key-data\": \"$user_key\"}}" $HOME/.kube/config
34
+ cat $HOME/.kube/config
35
+
36
+ # Cleanup
37
+ rm ca.crt
38
+ rm ca.srl
39
+ rm ca.key
40
+ rm user.crt
41
+ rm user.key
42
+ rm user.csr
43
+
44
+ # Add RBAC permissions to sdk-user
45
+ kubectl create clusterrole list-ingresses --verb=get,list --resource=ingresses
46
+ kubectl create clusterrolebinding sdk-user-list-ingresses --clusterrole=list-ingresses --user=sdk-user
47
+ kubectl create clusterrole appwrapper-creator --verb=get,list,create,delete,patch --resource=appwrappers
48
+ kubectl create clusterrolebinding sdk-user-appwrapper-creator --clusterrole=appwrapper-creator --user=sdk-user
49
+ kubectl create clusterrole namespace-creator --verb=get,list,create,delete,patch --resource=namespaces
50
+ kubectl create clusterrolebinding sdk-user-namespace-creator --clusterrole=namespace-creator --user=sdk-user
51
+ kubectl create clusterrole list-rayclusters --verb=get,list --resource=rayclusters
52
+ kubectl create clusterrolebinding sdk-user-list-rayclusters --clusterrole=list-rayclusters --user=sdk-user
53
+ kubectl config use-context sdk-user
54
+
55
+ ```
56
+
57
+
17
58
- Test Phase:
18
59
- Once we have the codeflare-operator and kuberay-operator running and ready, we can run the e2e test on the codeflare-sdk repository:
19
60
```
0 commit comments