3434
3535 PoolConfigNode struct {
3636 Roles PoolConfigNodeValueMap `yaml:"roles"`
37+ JsonPatches []k8s.JsonPatchObject `yaml:"jsonPatches"`
3738 ConfigSource * PoolConfigNodeConfigSource `yaml:"configSource"`
3839 Labels PoolConfigNodeValueMap `yaml:"labels"`
3940 Annotations PoolConfigNodeValueMap `yaml:"annotations"`
@@ -145,6 +146,7 @@ func (p *PoolConfig) IsMatchingNode(logger *zap.SugaredLogger, node *corev1.Node
145146func (p * PoolConfig ) CreateJsonPatchSet (node * corev1.Node ) (patchSet * k8s.JsonPatchSet ) {
146147 patchSet = k8s .NewJsonPatchSet ()
147148
149+ // node roles
148150 for roleName , roleValue := range p .Node .Roles .Entries () {
149151 label := fmt .Sprintf ("node-role.kubernetes.io/%s" , roleName )
150152 if roleValue != nil {
@@ -162,6 +164,7 @@ func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPa
162164 }
163165 }
164166
167+ // node config source
165168 if p .Node .ConfigSource != nil {
166169 patchSet .Add (k8s.JsonPatchObject {
167170 Op : "replace" ,
@@ -170,6 +173,7 @@ func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPa
170173 })
171174 }
172175
176+ // node labels
173177 for labelName , labelValue := range p .Node .Labels .Entries () {
174178 if labelValue != nil {
175179 value := * labelValue
@@ -186,6 +190,7 @@ func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPa
186190 }
187191 }
188192
193+ // node annotations
189194 for annotationName , annotationValue := range p .Node .Annotations .Entries () {
190195 if annotationValue != nil {
191196 value := * annotationValue
@@ -202,5 +207,10 @@ func (p *PoolConfig) CreateJsonPatchSet(node *corev1.Node) (patchSet *k8s.JsonPa
202207 }
203208 }
204209
210+ // custom patches
211+ for _ , patch := range p .Node .JsonPatches {
212+ patchSet .Add (patch )
213+ }
214+
205215 return
206216}
0 commit comments