|
39 | 39 | spec: |
40 | 40 | description: NodeForceDrainSpec defines the desired state of NodeForceDrain |
41 | 41 | properties: |
| 42 | + namespaceSelector: |
| 43 | + description: |- |
| 44 | + NamespaceSelector is a selector to select which namespaces to drain |
| 45 | + An empty selector matches all namespaces. |
| 46 | + properties: |
| 47 | + matchExpressions: |
| 48 | + description: matchExpressions is a list of label selector requirements. |
| 49 | + The requirements are ANDed. |
| 50 | + items: |
| 51 | + description: |- |
| 52 | + A label selector requirement is a selector that contains values, a key, and an operator that |
| 53 | + relates the key and values. |
| 54 | + properties: |
| 55 | + key: |
| 56 | + description: key is the label key that the selector applies |
| 57 | + to. |
| 58 | + type: string |
| 59 | + operator: |
| 60 | + description: |- |
| 61 | + operator represents a key's relationship to a set of values. |
| 62 | + Valid operators are In, NotIn, Exists and DoesNotExist. |
| 63 | + type: string |
| 64 | + values: |
| 65 | + description: |- |
| 66 | + values is an array of string values. If the operator is In or NotIn, |
| 67 | + the values array must be non-empty. If the operator is Exists or DoesNotExist, |
| 68 | + the values array must be empty. This array is replaced during a strategic |
| 69 | + merge patch. |
| 70 | + items: |
| 71 | + type: string |
| 72 | + type: array |
| 73 | + x-kubernetes-list-type: atomic |
| 74 | + required: |
| 75 | + - key |
| 76 | + - operator |
| 77 | + type: object |
| 78 | + type: array |
| 79 | + x-kubernetes-list-type: atomic |
| 80 | + matchLabels: |
| 81 | + additionalProperties: |
| 82 | + type: string |
| 83 | + description: |- |
| 84 | + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels |
| 85 | + map is equivalent to an element of matchExpressions, whose key field is "key", the |
| 86 | + operator is "In", and the values array contains only "value". The requirements are ANDed. |
| 87 | + type: object |
| 88 | + type: object |
| 89 | + x-kubernetes-map-type: atomic |
42 | 90 | nodeDrainGracePeriod: |
43 | 91 | description: |- |
44 | 92 | NodeDrainGracePeriod is the duration until the controller starts to delete pods on the node. |
|
50 | 98 | nodeSelector: |
51 | 99 | description: |- |
52 | 100 | NodeSelector is a selector to select which nodes to drain |
53 | | - A nil selector matches no nodes, while an empty selector matches all nodes. |
| 101 | + An empty selector matches all nodes. |
54 | 102 | properties: |
55 | 103 | matchExpressions: |
56 | 104 | description: matchExpressions is a list of label selector requirements. |
@@ -106,6 +154,22 @@ spec: |
106 | 154 | Such pods do block the reboot of the node and the node will stay in a `NotReady` state for extended periods. |
107 | 155 | A zero value disables the force delete. |
108 | 156 | type: string |
| 157 | + podJQSelector: |
| 158 | + description: |- |
| 159 | + PodJQSelector is a selector to select which pods to drain. |
| 160 | + The selector is a JQ selector that should return a stream of one or more booleans. |
| 161 | + If any of the booleans are true, the pod will be drained. |
| 162 | + An empty stream will not drain the pod. |
| 163 | + Any non-boolean value will be ignored but will not halt the program. |
| 164 | + Under the hood https://github.com/itchyny/gojq is used which is mostly compatible |
| 165 | + with https://jqlang.org/manual/ but has some small limitations and might lag a bit behind upstream. |
| 166 | + If the program is halted - due to error or explicit `halt` - before any boolean is returned, the pod will not be drained. |
| 167 | + If the program is halted - due to error or explicit `halt` - after a truthy boolean is returned, the pod will be drained. |
| 168 | + Examples: |
| 169 | + .metadata.namespace | test("-dev$") |
| 170 | + .spec.containers[] | .image | test("oktodrain") |
| 171 | + [.spec.containers[] | .image | test("oktodrain")] | all |
| 172 | + type: string |
109 | 173 | required: |
110 | 174 | - nodeDrainGracePeriod |
111 | 175 | - nodeSelector |
|
0 commit comments