34
34
35
35
PoolConfigNode struct {
36
36
Roles PoolConfigNodeValueMap `yaml:"roles"`
37
+ JsonPatches []k8s.JsonPatchObject `yaml:"jsonPatches"`
37
38
ConfigSource * PoolConfigNodeConfigSource `yaml:"configSource"`
38
39
Labels PoolConfigNodeValueMap `yaml:"labels"`
39
40
Annotations PoolConfigNodeValueMap `yaml:"annotations"`
@@ -145,6 +146,7 @@ func (p *PoolConfig) IsMatchingNode(logger *zap.SugaredLogger, node *corev1.Node
145
146
func (p * PoolConfig ) CreateJsonPatchSet (node * corev1.Node ) (patchSet * k8s.JsonPatchSet ) {
146
147
patchSet = k8s .NewJsonPatchSet ()
147
148
149
+ // node roles
148
150
for roleName , roleValue := range p .Node .Roles .Entries () {
149
151
label := fmt .Sprintf ("node-role.kubernetes.io/%s" , roleName )
150
152
if roleValue != nil {
@@ -162,6 +164,7 @@ func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPa
162
164
}
163
165
}
164
166
167
+ // node config source
165
168
if p .Node .ConfigSource != nil {
166
169
patchSet .Add (k8s.JsonPatchObject {
167
170
Op : "replace" ,
@@ -170,6 +173,7 @@ func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPa
170
173
})
171
174
}
172
175
176
+ // node labels
173
177
for labelName , labelValue := range p .Node .Labels .Entries () {
174
178
if labelValue != nil {
175
179
value := * labelValue
@@ -186,6 +190,7 @@ func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPa
186
190
}
187
191
}
188
192
193
+ // node annotations
189
194
for annotationName , annotationValue := range p .Node .Annotations .Entries () {
190
195
if annotationValue != nil {
191
196
value := * annotationValue
@@ -202,5 +207,10 @@ func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPa
202
207
}
203
208
}
204
209
210
+ // custom patches
211
+ for _ , patch := range p .Node .JsonPatches {
212
+ patchSet .Add (patch )
213
+ }
214
+
205
215
return
206
216
}
0 commit comments