Skip to content

Commit 314f4a9

Browse files
[#18] feat: allow tolerations (#19)
* feat: allow tolerations to be specified in overcommit and overcommitclass * feat: add tolerations to helm chart * fix: use correct tolerations for validating webhook * feat: allow users to specify nodeSelector map * feat: add nodeSelector configuration to helm chart * feat: add nodeSelector and tolerations updates in Overcommit reconciler - Implemented logic to update nodeSelector and tolerations in Overcommit reconciler for deployments. - Added utility functions for tolerations comparison. - Created tests for tolerations equality. - Added example YAML files for validating nodeSelector and tolerations. * feat: update version to 1.1.0 in Makefile, Chart.yaml, values.yaml, and catalog_source.yaml * Chore: run make bundle for new release * chore: add SPDX license headers to YAML files and ensure newline at end of file * feat: remove empty nodeSelector and tolerations fields from OvercommitClass setup --------- Co-authored-by: Enrique Andrés Villar <[email protected]>
1 parent 122ac9e commit 314f4a9

File tree

52 files changed

+2339
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2339
-12
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# To re-generate a bundle for another specific version without changing the standard setup, you can:
99
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
1010
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
11-
VERSION ?= 1.0.3
11+
VERSION ?= 1.1.0
1212
# Image URL to use all building/pushing image targets
1313
IMG ?= ghcr.io/inditextech/k8s-overcommit-operator:$(VERSION)
1414
# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.

api/v1alphav1/overcommit_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package v1alphav1
77

88
import (
9+
corev1 "k8s.io/api/core/v1"
910
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1011
)
1112

@@ -24,6 +25,10 @@ type OvercommitSpec struct {
2425
Labels map[string]string `json:"labels,omitempty"`
2526
// +kubebuilder:validation:Optional
2627
Annotations map[string]string `json:"annotations,omitempty"`
28+
// +kubebuilder:validation:Optional
29+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
30+
// +kubebuilder:validation:Optional
31+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
2732
}
2833

2934
// OvercommitStatus defines the observed state of Overcommit

api/v1alphav1/overcommitclass_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package v1alphav1
77

88
import (
9+
corev1 "k8s.io/api/core/v1"
910
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1011
"k8s.io/apimachinery/pkg/types"
1112
)
@@ -32,6 +33,10 @@ type OvercommitClassSpec struct {
3233
IsDefault bool `json:"isDefault,omitempty"`
3334
Labels map[string]string `json:"labels,omitempty"`
3435
Annotations map[string]string `json:"annotations,omitempty"`
36+
// +kubebuilder:validation:Optional
37+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
38+
// +kubebuilder:validation:Optional
39+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
3540
}
3641

3742
type ResourceStatus struct {

api/v1alphav1/zz_generated.deepcopy.go

Lines changed: 32 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/k8s-overcommit.clusterserviceversion.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ metadata:
3030
}
3131
]
3232
capabilities: Basic Install
33-
createdAt: "2025-10-06T10:56:30Z"
33+
createdAt: "2025-10-06T15:18:15Z"
3434
operators.operatorframework.io/builder: operator-sdk-v1.40.0
3535
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
36-
name: k8s-overcommit.v1.0.3
36+
name: k8s-overcommit.v1.1.0
3737
namespace: placeholder
3838
spec:
3939
apiservicedefinitions: {}
@@ -221,7 +221,7 @@ spec:
221221
valueFrom:
222222
fieldRef:
223223
fieldPath: metadata.namespace
224-
image: ghcr.io/inditextech/k8s-overcommit-operator:1.0.3
224+
image: ghcr.io/inditextech/k8s-overcommit-operator:1.1.0
225225
livenessProbe:
226226
httpGet:
227227
path: /healthz
@@ -313,4 +313,4 @@ spec:
313313
minKubeVersion: 1.22.0
314314
provider:
315315
name: inditexTech
316-
version: 1.0.3
316+
version: 1.1.0

bundle/manifests/overcommit.inditex.dev_overcommitclasses.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,48 @@ spec:
7676
maximum: 1
7777
minimum: 0.0001
7878
type: number
79+
nodeSelector:
80+
additionalProperties:
81+
type: string
82+
type: object
83+
tolerations:
84+
items:
85+
description: |-
86+
The pod this Toleration is attached to tolerates any taint that matches
87+
the triple <key,value,effect> using the matching operator <operator>.
88+
properties:
89+
effect:
90+
description: |-
91+
Effect indicates the taint effect to match. Empty means match all taint effects.
92+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
93+
type: string
94+
key:
95+
description: |-
96+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
97+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
98+
type: string
99+
operator:
100+
description: |-
101+
Operator represents a key's relationship to the value.
102+
Valid operators are Exists and Equal. Defaults to Equal.
103+
Exists is equivalent to wildcard for value, so that a pod can
104+
tolerate all taints of a particular category.
105+
type: string
106+
tolerationSeconds:
107+
description: |-
108+
TolerationSeconds represents the period of time the toleration (which must be
109+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
110+
it is not set, which means tolerate the taint forever (do not evict). Zero and
111+
negative values will be treated as 0 (evict immediately) by the system.
112+
format: int64
113+
type: integer
114+
value:
115+
description: |-
116+
Value is the taint value the toleration matches to.
117+
If the operator is Exists, the value should be empty, otherwise just a regular string.
118+
type: string
119+
type: object
120+
type: array
79121
required:
80122
- cpuOvercommit
81123
- excludedNamespaces

bundle/manifests/overcommit.inditex.dev_overcommits.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,51 @@ spec:
5252
additionalProperties:
5353
type: string
5454
type: object
55+
nodeSelector:
56+
additionalProperties:
57+
type: string
58+
type: object
5559
overcommitLabel:
5660
minLength: 1
5761
type: string
62+
tolerations:
63+
items:
64+
description: |-
65+
The pod this Toleration is attached to tolerates any taint that matches
66+
the triple <key,value,effect> using the matching operator <operator>.
67+
properties:
68+
effect:
69+
description: |-
70+
Effect indicates the taint effect to match. Empty means match all taint effects.
71+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
72+
type: string
73+
key:
74+
description: |-
75+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
76+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
77+
type: string
78+
operator:
79+
description: |-
80+
Operator represents a key's relationship to the value.
81+
Valid operators are Exists and Equal. Defaults to Equal.
82+
Exists is equivalent to wildcard for value, so that a pod can
83+
tolerate all taints of a particular category.
84+
type: string
85+
tolerationSeconds:
86+
description: |-
87+
TolerationSeconds represents the period of time the toleration (which must be
88+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
89+
it is not set, which means tolerate the taint forever (do not evict). Zero and
90+
negative values will be treated as 0 (evict immediately) by the system.
91+
format: int64
92+
type: integer
93+
value:
94+
description: |-
95+
Value is the taint value the toleration matches to.
96+
If the operator is Exists, the value should be empty, otherwise just a regular string.
97+
type: string
98+
type: object
99+
type: array
58100
required:
59101
- overcommitLabel
60102
type: object

chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name: k8s-overcommit-operator
99
description: K8s overcommit operator Helm chart for deploying the overcommit operator
1010
type: application
1111
version: "1.0.0"
12-
appVersion: "1.0.3"
12+
appVersion: "1.1.0"
1313
maintainers:
1414
- name: Enrique Andrés Villar
1515

chart/crds/overcommit.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,51 @@ spec:
5757
additionalProperties:
5858
type: string
5959
type: object
60+
nodeSelector:
61+
additionalProperties:
62+
type: string
63+
type: object
6064
overcommitLabel:
6165
minLength: 1
6266
type: string
67+
tolerations:
68+
items:
69+
description: |-
70+
The pod this Toleration is attached to tolerates any taint that matches
71+
the triple <key,value,effect> using the matching operator <operator>.
72+
properties:
73+
effect:
74+
description: |-
75+
Effect indicates the taint effect to match. Empty means match all taint effects.
76+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
77+
type: string
78+
key:
79+
description: |-
80+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
81+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
82+
type: string
83+
operator:
84+
description: |-
85+
Operator represents a key's relationship to the value.
86+
Valid operators are Exists and Equal. Defaults to Equal.
87+
Exists is equivalent to wildcard for value, so that a pod can
88+
tolerate all taints of a particular category.
89+
type: string
90+
tolerationSeconds:
91+
description: |-
92+
TolerationSeconds represents the period of time the toleration (which must be
93+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
94+
it is not set, which means tolerate the taint forever (do not evict). Zero and
95+
negative values will be treated as 0 (evict immediately) by the system.
96+
format: int64
97+
type: integer
98+
value:
99+
description: |-
100+
Value is the taint value the toleration matches to.
101+
If the operator is Exists, the value should be empty, otherwise just a regular string.
102+
type: string
103+
type: object
104+
type: array
63105
required:
64106
- overcommitLabel
65107
type: object

chart/crds/overcommitClass.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,48 @@ spec:
8181
maximum: 1
8282
minimum: 0.0001
8383
type: number
84+
nodeSelector:
85+
additionalProperties:
86+
type: string
87+
type: object
88+
tolerations:
89+
items:
90+
description: |-
91+
The pod this Toleration is attached to tolerates any taint that matches
92+
the triple <key,value,effect> using the matching operator <operator>.
93+
properties:
94+
effect:
95+
description: |-
96+
Effect indicates the taint effect to match. Empty means match all taint effects.
97+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
98+
type: string
99+
key:
100+
description: |-
101+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
102+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
103+
type: string
104+
operator:
105+
description: |-
106+
Operator represents a key's relationship to the value.
107+
Valid operators are Exists and Equal. Defaults to Equal.
108+
Exists is equivalent to wildcard for value, so that a pod can
109+
tolerate all taints of a particular category.
110+
type: string
111+
tolerationSeconds:
112+
description: |-
113+
TolerationSeconds represents the period of time the toleration (which must be
114+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
115+
it is not set, which means tolerate the taint forever (do not evict). Zero and
116+
negative values will be treated as 0 (evict immediately) by the system.
117+
format: int64
118+
type: integer
119+
value:
120+
description: |-
121+
Value is the taint value the toleration matches to.
122+
If the operator is Exists, the value should be empty, otherwise just a regular string.
123+
type: string
124+
type: object
125+
type: array
84126
required:
85127
- cpuOvercommit
86128
- excludedNamespaces

0 commit comments

Comments
 (0)