File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,10 +8,9 @@ This is suitable for scenarios where you want to reserve node resources without
88* Extremely lightweight and ** non-intrusive** to business containers
99
1010## Examples
11- 1 . Apply CRDs and RBAC
11+ 1 . Apply RBAC
1212``` bash
13- $ kubectl apply -f ./manifests/crds
14- $ kubectl apply -f ./manifests/rbac.yaml
13+ $ kubectl apply -f ./examples/rbac.yaml
1514```
1615
17162 . ** Apply Pod**
@@ -28,19 +27,18 @@ apiVersion: v1
2827kind : Pod
2928metadata :
3029 name : test-pod
30+ annotations :
31+ pod-running-control.io/break : ' true'
3132spec :
3233 initContainers :
3334 - name : running-control
3435 image : ghcr.io/iceber/pod-running-control:latest
35- env :
36- - name : POD_RUNNING_GATE_NAMESPACE
37- valueFrom :
38- fieldRef :
39- fieldPath : metadata.namespace
40- - name : POD_RUNNING_GATE_NAME
41- valueFrom :
42- fieldRef :
43- fieldPath : metadata.name
36+ args :
37+ - " --gate-gvr=pods.v1."
38+ - " --gate-namespace=default"
39+ - " --gate-name=test-pod"
40+ - |
41+ --gate-expression=!has(object.metadata.annotations) || !('pod-running-control.io/break' in object.metadata.annotations) || object.metadata.annotations['pod-running-control.io/break'] != 'true'
4442 containers :
4543 - name : nginx
4644 image : nginx:1.14.2
Original file line number Diff line number Diff line change 1+ apiVersion : rbac.authorization.k8s.io/v1
2+ kind : Role
3+ metadata :
4+ name : pod-running-control
5+ rules :
6+ - apiGroups : ['']
7+ resources : ['pods']
8+ verbs : ["watch", "list"]
9+
10+ ---
11+ apiVersion : rbac.authorization.k8s.io/v1
12+ kind : RoleBinding
13+ metadata :
14+ name : pod-running-control
15+ roleRef :
16+ apiGroup : rbac.authorization.k8s.io
17+ kind : Role
18+ name : pod-running-control
19+ subjects :
20+ - kind : ServiceAccount
21+ name : default
22+ ---
23+ apiVersion : v1
24+ kind : Pod
25+ metadata :
26+ name : test-pod
27+ annotations :
28+ pod-running-control.io/break : ' true'
29+ spec :
30+ initContainers :
31+ - name : running-control
32+ image : ghcr.io/iceber/pod-running-control:latest
33+ args :
34+ - " --gate-gvr=pods.v1."
35+ - " --gate-namespace=$(POD_RUNNING_GATE_NAMESPACE)"
36+ - " --gate-name=$(POD_RUNNING_GATE_NAME)"
37+ - |
38+ --gate-expression=!has(object.metadata.annotations) || !('pod-running-control.io/break' in object.metadata.annotations) || object.metadata.annotations['pod-running-control.io/break'] != 'true'
39+ env :
40+ - name : POD_RUNNING_GATE_NAMESPACE
41+ valueFrom :
42+ fieldRef :
43+ fieldPath : metadata.namespace
44+ - name : POD_RUNNING_GATE_NAME
45+ valueFrom :
46+ fieldRef :
47+ fieldPath : metadata.name
48+ containers :
49+ - name : nginx
50+ image : nginx:1.14.2
51+ ports :
52+ - containerPort : 80
Original file line number Diff line number Diff line change 1+ apiVersion : rbac.authorization.k8s.io/v1
2+ kind : Role
3+ metadata :
4+ name : pod-running-control
5+ rules :
6+ - apiGroups : ['']
7+ resources : ['pods']
8+ verbs : ["watch", "list"]
9+
10+ ---
11+ apiVersion : rbac.authorization.k8s.io/v1
12+ kind : RoleBinding
13+ metadata :
14+ name : pod-running-control
15+ roleRef :
16+ apiGroup : rbac.authorization.k8s.io
17+ kind : Role
18+ name : pod-running-control
19+ subjects :
20+ - kind : ServiceAccount
21+ name : default
You can’t perform that action at this time.
0 commit comments