Skip to content

Commit 3a4eaf9

Browse files
committed
Added support to label/annotate nodes
1 parent 370b78e commit 3a4eaf9

9 files changed

Lines changed: 142 additions & 23 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- if not (eq .Values.enabled "plumbing") }}
2+
{{- range $node := .Values.clusterGroup.nodes }}
3+
apiVersion: v1
4+
kind: Node
5+
metadata:
6+
{{- range $k, $v := $node }}
7+
name: {{ $k }}
8+
labels:
9+
argocd.argoproj.io/managed-by: {{ $.Values.global.pattern }}-{{ $.Values.clusterGroup.name }}
10+
{{- if $v.labels }}
11+
{{- range $key, $value := $v.labels }}
12+
{{ $key }}: {{ $value | default "" | quote }}
13+
{{- end }}
14+
{{- end }}
15+
16+
{{- if $v.annotations }}
17+
annotations:
18+
{{- range $key, $value := $v.annotations }}
19+
{{ $key }}: {{ $value | default "" | quote }}
20+
{{- end }}
21+
{{- end }}{{- /* if $v.annotations */}}
22+
{{- end }}{{- /* range $k, $v := $node */}}
23+
---
24+
{{- end -}}
25+
{{- end -}}

clustergroup/values.schema.json

Lines changed: 59 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,20 @@
271271
"$ref": "#/definitions/Namespaces"
272272
}
273273
},
274+
"nodes": {
275+
"anyOf": [
276+
{
277+
"type": "array"
278+
},
279+
{
280+
"type": "object"
281+
}
282+
],
283+
"description": "Description of those nodes which ArgoCD will control the labels and/or annotations.",
284+
"items": {
285+
"$ref": "#/definitions/Nodes"
286+
}
287+
},
274288
"indexImages": {
275289
"anyOf": [
276290
{
@@ -389,28 +403,51 @@
389403
"type": "string"
390404
}
391405
],
392-
"description": "Description of the applications that will be created in the ArgoCD instances. The Application CRD is the Kubernetes resource object representing a deployed application instance in an environment. Two ways of defining applications: Using a list or using a dictionary.",
393-
"additionalProperties": true,
394-
"properties": {
395-
"name": {
396-
"type": "string",
397-
"description": "Name of the namespace."
398-
},
399-
"labels": {
400-
"type": "array",
401-
"items": {
402-
"$ref": "#/definitions/NameValue"
403-
}
404-
},
405-
"annotations": {
406-
"type": "array",
407-
"items": {
408-
"$ref": "#/definitions/NameValue"
409-
}
410-
}
406+
"description": "Description of the applications that will be created in the ArgoCD instances. The Application CRD is the Kubernetes resource object representing a deployed application instance in an environment. Two ways of defining applications: Using a list or using a dictionary.",
407+
"additionalProperties": true,
408+
"properties": {
409+
"name": {
410+
"type": "string",
411+
"description": "Name of the namespace."
412+
},
413+
"labels": {
414+
"type": "array",
415+
"items": {
416+
"$ref": "#/definitions/NameValue"
417+
}
418+
},
419+
"annotations": {
420+
"type": "array",
421+
"items": {
422+
"$ref": "#/definitions/NameValue"
411423
}
424+
}
425+
}
412426
},
413-
"NameValue": {
427+
"Nodes": {
428+
"type": "object",
429+
"description": "Description of those nodes which ArgoCD will control the labels and/or annotations.",
430+
"additionalProperties": true,
431+
"properties": {
432+
"name": {
433+
"type": "string",
434+
"description": "Name of the node."
435+
},
436+
"labels": {
437+
"type": "array",
438+
"items": {
439+
"$ref": "#/definitions/NameValue"
440+
}
441+
},
442+
"annotations": {
443+
"type": "array",
444+
"items": {
445+
"$ref": "#/definitions/NameValue"
446+
}
447+
}
448+
}
449+
},
450+
"NameValue": {
414451
"type": "object",
415452
"description": "Description of the applications that will be created in the ArgoCD instances. The Application CRD is the Kubernetes resource object representing a deployed application instance in an environment. Two ways of defining applications: Using a list or using a dictionary.",
416453
"additionalProperties": true,
@@ -423,8 +460,8 @@
423460
"type": "string",
424461
"description": "Name of the namespace."
425462
}
426-
}
427-
},
463+
}
464+
},
428465
"Applications": {
429466
"type": "object",
430467
"description": "Description of the applications that will be created in the ArgoCD instances. The Application CRD is the Kubernetes resource object representing a deployed application instance in an environment. Two ways of defining applications: Using a list or using a dictionary.",

clustergroup/values.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ global:
1010
installPlanApproval: Automatic
1111
applicationRetryLimit: 20
1212

13-
1413
enabled: "all"
1514

1615
# Note that sometimes changing helm values might require a hard refresh (https://github.com/helm/helm/issues/3486)
@@ -73,6 +72,12 @@ clusterGroup:
7372
# - OpenShift
7473
#
7574
# - open-cluster-management
75+
#
76+
nodes: []
77+
# nodes:
78+
# - m-m00.mycluster.domain.tld:
79+
# labels:
80+
# cluster.ocs.openshift.io/openshift-storage: ""
7681
#
7782
subscriptions: {}
7883
# - name: advanced-cluster-management

examples/values-example.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ clusterGroup:
5050
- include-default-og:
5151
operatorGroup: true
5252

53+
nodes:
54+
- m-m00.cluster.example.tld:
55+
labels:
56+
cluster.ocs.openshift.io/openshift-storage: ""
57+
- m-m01.cluster.example.tld:
58+
labels:
59+
cluster.ocs.openshift.io/openshift-storage: ""
60+
- m-m02.cluster.example.tld:
61+
labels:
62+
cluster.ocs.openshift.io/openshift-storage: ""
63+
5364
operatorgroupExcludes:
5465
- exclude-og
5566

tests/clustergroup-industrial-edge-factory.expected.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ data:
152152
- manuela-stormshift-machine-sensor
153153
- manuela-stormshift-messaging
154154
- manuela-factory-ml-workspace
155+
nodes: []
155156
operatorgroupExcludes:
156157
- manuela-factory-ml-workspace
157158
projects:

tests/clustergroup-industrial-edge-hub.expected.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ data:
291291
- manuela-data-lake
292292
- staging
293293
- vault
294+
nodes: []
294295
operatorgroupExcludes:
295296
- manuela-ml-workspace
296297
projects:

tests/clustergroup-medical-diagnosis-hub.expected.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ data:
270270
- staging
271271
- vault
272272
- golang-external-secrets
273+
nodes: []
273274
projects:
274275
- hub
275276
- medical-diagnosis

tests/clustergroup-naked.expected.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ data:
7373
managedClusterGroups: {}
7474
name: example
7575
namespaces: []
76+
nodes: []
7677
projects: []
7778
sharedValueFiles: []
7879
subscriptions: {}

tests/clustergroup-normal.expected.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@ data:
234234
operatorGroup: false
235235
- include-default-og:
236236
operatorGroup: true
237+
nodes:
238+
- m-m00.cluster.example.tld:
239+
labels:
240+
cluster.ocs.openshift.io/openshift-storage: ""
241+
- m-m01.cluster.example.tld:
242+
labels:
243+
cluster.ocs.openshift.io/openshift-storage: ""
244+
- m-m02.cluster.example.tld:
245+
labels:
246+
cluster.ocs.openshift.io/openshift-storage: ""
237247
operatorgroupExcludes:
238248
- exclude-og
239249
projects:
@@ -1174,6 +1184,33 @@ spec:
11741184
location: ApplicationMenu
11751185
text: 'Example ArgoCD'
11761186
---
1187+
# Source: clustergroup/templates/core/nodes.yaml
1188+
apiVersion: v1
1189+
kind: Node
1190+
metadata:
1191+
name: m-m00.cluster.example.tld
1192+
labels:
1193+
argocd.argoproj.io/managed-by: mypattern-example
1194+
cluster.ocs.openshift.io/openshift-storage: ""
1195+
---
1196+
# Source: clustergroup/templates/core/nodes.yaml
1197+
apiVersion: v1
1198+
kind: Node
1199+
metadata:
1200+
name: m-m01.cluster.example.tld
1201+
labels:
1202+
argocd.argoproj.io/managed-by: mypattern-example
1203+
cluster.ocs.openshift.io/openshift-storage: ""
1204+
---
1205+
# Source: clustergroup/templates/core/nodes.yaml
1206+
apiVersion: v1
1207+
kind: Node
1208+
metadata:
1209+
name: m-m02.cluster.example.tld
1210+
labels:
1211+
argocd.argoproj.io/managed-by: mypattern-example
1212+
cluster.ocs.openshift.io/openshift-storage: ""
1213+
---
11771214
# Source: clustergroup/templates/core/operatorgroup.yaml
11781215
---
11791216
apiVersion: operators.coreos.com/v1

0 commit comments

Comments
 (0)