File tree 4 files changed +42
-1
lines changed
4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -156,9 +156,20 @@ build: fmt vet ## Build manager binary.
156
156
-o bin/manager main.go
157
157
158
158
.PHONY : run
159
- run : manifests fmt vet # # Run a controller from your host.
159
+ run : crds-check manifests fmt vet # # Run a controller from your host.
160
160
go run ./main.go
161
161
162
+ .PHONY : crds-check
163
+ crds-check :
164
+ @{ \
165
+ kubectl get crds | grep ' rayclusters.ray.io' > /dev/null && \
166
+ kubectl get crds | grep ' rayjobs.ray.io' > /dev/null && \
167
+ kubectl get crds | grep ' rayservices.ray.io' > /dev/null; \
168
+ } || { \
169
+ echo " One or more required KubeRay CRDs are missing." ; \
170
+ exit 1; \
171
+ }
172
+
162
173
.PHONY : image-build
163
174
image-build : test-unit # # Build container image with the manager.
164
175
podman build -t ${IMG} .
Original file line number Diff line number Diff line change 24
24
spec :
25
25
securityContext :
26
26
runAsNonRoot : true
27
+ initContainers :
28
+ - name : check-ray-crds
29
+ securityContext :
30
+ runAsUser : 1000
31
+ allowPrivilegeEscalation : false
32
+ capabilities :
33
+ drop :
34
+ - " ALL"
35
+ image : alpine/k8s:1.27.11
36
+ command :
37
+ - sh
38
+ - -c
39
+ - |
40
+ set -e
41
+ CRDS="rayclusters.ray.io rayjobs.ray.io rayservices.ray.io"
42
+ for crd in $CRDS; do
43
+ echo "Checking for $crd"
44
+ until kubectl get crd $crd; do
45
+ echo "$crd not available yet, retrying in 10 seconds..."
46
+ sleep 10
47
+ done
48
+ done
49
+ echo "All required CRDs are available."
27
50
# TODO(user): For common cases that do not require escalating privileges
28
51
# it is recommended to ensure that all your Pods/Containers are restrictive.
29
52
# More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ metadata:
5
5
creationTimestamp : null
6
6
name : manager-role
7
7
rules :
8
+ - apiGroups :
9
+ - apiextensions.k8s.io
10
+ resources :
11
+ - customresourcedefinitions
12
+ verbs :
13
+ - get
8
14
- apiGroups :
9
15
- " "
10
16
resources :
Original file line number Diff line number Diff line change 78
78
// +kubebuilder:rbac:groups=core,resources=services,verbs=patch;delete;get
79
79
// +kubebuilder:rbac:groups=core,resources=serviceaccounts,verbs=patch;delete;get
80
80
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=clusterrolebindings,verbs=patch;delete;get
81
+ // +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get
81
82
82
83
// Reconcile is part of the main kubernetes reconciliation loop which aims to
83
84
// move the current state of the cluster closer to the desired state.
You can’t perform that action at this time.
0 commit comments