Skip to content

Commit 896d830

Browse files
authored
Merge pull request #120 from mbaldessari/common-automatic-update
common automatic update
2 parents 62e7f50 + 14649b3 commit 896d830

15 files changed

+197
-36
lines changed
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 -}}

common/clustergroup/values.schema.json

Lines changed: 59 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,20 @@
283283
"$ref": "#/definitions/Namespaces"
284284
}
285285
},
286+
"nodes": {
287+
"anyOf": [
288+
{
289+
"type": "array"
290+
},
291+
{
292+
"type": "object"
293+
}
294+
],
295+
"description": "Description of those nodes which ArgoCD will control the labels and/or annotations.",
296+
"items": {
297+
"$ref": "#/definitions/Nodes"
298+
}
299+
},
286300
"indexImages": {
287301
"anyOf": [
288302
{
@@ -401,28 +415,51 @@
401415
"type": "string"
402416
}
403417
],
404-
"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.",
405-
"additionalProperties": true,
406-
"properties": {
407-
"name": {
408-
"type": "string",
409-
"description": "Name of the namespace."
410-
},
411-
"labels": {
412-
"type": "array",
413-
"items": {
414-
"$ref": "#/definitions/NameValue"
415-
}
416-
},
417-
"annotations": {
418-
"type": "array",
419-
"items": {
420-
"$ref": "#/definitions/NameValue"
421-
}
422-
}
418+
"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.",
419+
"additionalProperties": true,
420+
"properties": {
421+
"name": {
422+
"type": "string",
423+
"description": "Name of the namespace."
424+
},
425+
"labels": {
426+
"type": "array",
427+
"items": {
428+
"$ref": "#/definitions/NameValue"
429+
}
430+
},
431+
"annotations": {
432+
"type": "array",
433+
"items": {
434+
"$ref": "#/definitions/NameValue"
423435
}
436+
}
437+
}
424438
},
425-
"NameValue": {
439+
"Nodes": {
440+
"type": "object",
441+
"description": "Description of those nodes which ArgoCD will control the labels and/or annotations.",
442+
"additionalProperties": true,
443+
"properties": {
444+
"name": {
445+
"type": "string",
446+
"description": "Name of the node."
447+
},
448+
"labels": {
449+
"type": "array",
450+
"items": {
451+
"$ref": "#/definitions/NameValue"
452+
}
453+
},
454+
"annotations": {
455+
"type": "array",
456+
"items": {
457+
"$ref": "#/definitions/NameValue"
458+
}
459+
}
460+
}
461+
},
462+
"NameValue": {
426463
"type": "object",
427464
"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.",
428465
"additionalProperties": true,
@@ -435,8 +472,8 @@
435472
"type": "string",
436473
"description": "Name of the namespace."
437474
}
438-
}
439-
},
475+
}
476+
},
440477
"Applications": {
441478
"type": "object",
442479
"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.",

common/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)
@@ -106,6 +105,12 @@ clusterGroup:
106105
# - OpenShift
107106
#
108107
# - open-cluster-management
108+
#
109+
nodes: []
110+
# nodes:
111+
# - m-m00.mycluster.domain.tld:
112+
# labels:
113+
# cluster.ocs.openshift.io/openshift-storage: ""
109114
#
110115
subscriptions: {}
111116
# - name: advanced-cluster-management

common/examples/values-example.yaml

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

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

common/scripts/pattern-util.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,20 @@ if [ -n "$KUBECONFIG" ]; then
4949
fi
5050
fi
5151

52-
# Use /etc/pki by default and try a couple of fallbacks if it does not exist
53-
if [ -d /etc/pki ]; then
54-
PKI_HOST_MOUNT="/etc/pki"
55-
elif [ -d /etc/ssl ]; then
56-
PKI_HOST_MOUNT="/etc/ssl"
52+
# Detect if we use podman machine. If we do not then we bind mount local host ssl folders
53+
# if we are using podman machine then we do not bind mount anything (for now!)
54+
REMOTE_PODMAN=$(podman system connection list -q | wc -l)
55+
if [ $REMOTE_PODMAN -eq 0 ]; then # If we are not using podman machine we check the hosts folders
56+
# Use /etc/pki by default and try a couple of fallbacks if it does not exist
57+
if [ -d /etc/pki ]; then
58+
PKI_HOST_MOUNT_ARGS="-v /etc/pki:/etc/pki:ro"
59+
elif [ -d /etc/ssl ]; then
60+
PKI_HOST_MOUNT_ARGS="-v /etc/ssl:/etc/ssl:ro"
61+
else
62+
PKI_HOST_MOUNT_ARGS="-v /usr/share/ca-certificates:/usr/share/ca-certificates:ro"
63+
fi
5764
else
58-
PKI_HOST_MOUNT="/usr/share/ca-certificates"
65+
PKI_HOST_MOUNT_ARGS=""
5966
fi
6067

6168
# Copy Kubeconfig from current environment. The utilities will pick up ~/.kube/config if set so it's not mandatory
@@ -67,13 +74,7 @@ podman run -it --rm --pull=newer \
6774
-e EXTRA_HELM_OPTS \
6875
-e EXTRA_PLAYBOOK_OPTS \
6976
-e KUBECONFIG \
70-
-e K8S_AUTH_HOST \
71-
-e K8S_AUTH_VERIFY_SSL \
72-
-e K8S_AUTH_SSL_CA_CERT \
73-
-e K8S_AUTH_USERNAME \
74-
-e K8S_AUTH_PASSWORD \
75-
-e K8S_AUTH_TOKEN \
76-
-v "${PKI_HOST_MOUNT}":/etc/pki:ro \
77+
${PKI_HOST_MOUNT_ARGS} \
7778
-v "${HOME}":"${HOME}" \
7879
-v "${HOME}":/pattern-home \
7980
${PODMAN_ARGS} \

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ data:
179179
- manuela-stormshift-machine-sensor
180180
- manuela-stormshift-messaging
181181
- manuela-factory-ml-workspace
182+
nodes: []
182183
operatorgroupExcludes:
183184
- manuela-factory-ml-workspace
184185
projects:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ data:
318318
- manuela-data-lake
319319
- staging
320320
- vault
321+
nodes: []
321322
operatorgroupExcludes:
322323
- manuela-ml-workspace
323324
projects:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ data:
297297
- staging
298298
- vault
299299
- golang-external-secrets
300+
nodes: []
300301
projects:
301302
- hub
302303
- medical-diagnosis

common/tests/clustergroup-naked.expected.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ data:
100100
managedClusterGroups: {}
101101
name: example
102102
namespaces: []
103+
nodes: []
103104
projects: []
104105
sharedValueFiles: []
105106
subscriptions: {}

common/tests/clustergroup-normal.expected.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,16 @@ data:
278278
operatorGroup: false
279279
- include-default-og:
280280
operatorGroup: true
281+
nodes:
282+
- m-m00.cluster.example.tld:
283+
labels:
284+
cluster.ocs.openshift.io/openshift-storage: ""
285+
- m-m01.cluster.example.tld:
286+
labels:
287+
cluster.ocs.openshift.io/openshift-storage: ""
288+
- m-m02.cluster.example.tld:
289+
labels:
290+
cluster.ocs.openshift.io/openshift-storage: ""
281291
operatorgroupExcludes:
282292
- exclude-og
283293
projects:
@@ -1376,6 +1386,33 @@ spec:
13761386
location: ApplicationMenu
13771387
text: 'Example ArgoCD'
13781388
---
1389+
# Source: clustergroup/templates/core/nodes.yaml
1390+
apiVersion: v1
1391+
kind: Node
1392+
metadata:
1393+
name: m-m00.cluster.example.tld
1394+
labels:
1395+
argocd.argoproj.io/managed-by: mypattern-example
1396+
cluster.ocs.openshift.io/openshift-storage: ""
1397+
---
1398+
# Source: clustergroup/templates/core/nodes.yaml
1399+
apiVersion: v1
1400+
kind: Node
1401+
metadata:
1402+
name: m-m01.cluster.example.tld
1403+
labels:
1404+
argocd.argoproj.io/managed-by: mypattern-example
1405+
cluster.ocs.openshift.io/openshift-storage: ""
1406+
---
1407+
# Source: clustergroup/templates/core/nodes.yaml
1408+
apiVersion: v1
1409+
kind: Node
1410+
metadata:
1411+
name: m-m02.cluster.example.tld
1412+
labels:
1413+
argocd.argoproj.io/managed-by: mypattern-example
1414+
cluster.ocs.openshift.io/openshift-storage: ""
1415+
---
13791416
# Source: clustergroup/templates/core/operatorgroup.yaml
13801417
---
13811418
apiVersion: operators.coreos.com/v1

0 commit comments

Comments
 (0)