Skip to content

Commit 05d660c

Browse files
committed
Merge remote-tracking branch 'common-upstream/main' into common-automatic-update
2 parents 440085d + b73c413 commit 05d660c

140 files changed

Lines changed: 25629 additions & 5307 deletions

File tree

Some content is hidden

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

common/.ansible-lint

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ skip_list:
1414
exclude_paths:
1515
- ./ansible/playbooks/vault/vault.yaml
1616
- ./ansible/playbooks/iib-ci/iib-ci.yaml
17+
- ./ansible/playbooks/k8s_secrets/k8s_secrets.yml
18+
- ./ansible/playbooks/process_secrets/process_secrets.yml
19+
- ./ansible/playbooks/process_secrets/display_secrets_info.yml
1720
- ./ansible/roles/vault_utils/tests/test.yml

common/.github/workflows/chart-branches.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Checkout Code
3333
uses: actions/checkout@v4
3434

35-
- uses: dorny/paths-filter@v2
35+
- uses: dorny/paths-filter@v3
3636
id: filter
3737
with:
3838
filters: |

common/.github/workflows/linter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
# Full git history is needed to get a proper list of changed files within `super-linter`
3535
fetch-depth: 0
3636
- name: Setup helm
37-
uses: azure/setup-helm@v3
37+
uses: azure/setup-helm@v4
3838
with:
39-
version: 'v3.12.3'
39+
version: 'v3.13.2'
4040

4141

4242
################################

common/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ __pycache__/
55
*.swo
66
values-secret.yaml
77
.*.expected.yaml
8+
.vscode
89
pattern-vault.init
910
pattern-vault.init.bak
1011
super-linter.log

common/Makefile

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
NAME ?= $(shell basename "`pwd`")
2+
23
ifneq ($(origin TARGET_SITE), undefined)
34
TARGET_SITE_OPT=--set main.clusterGroupName=$(TARGET_SITE)
45
endif
@@ -55,11 +56,12 @@ help: ## This help message
5556
show: ## show the starting template without installing it
5657
helm template common/operator-install/ --name-template $(NAME) $(HELM_OPTS)
5758

58-
preview-all:
59+
preview-all: ## (EXPERIMENTAL) Previews all applications on hub and managed clusters
60+
@echo "NOTE: This is just a tentative approximation of rendering all hub and managed clusters templates"
5961
@common/scripts/preview-all.sh $(TARGET_REPO) $(TARGET_BRANCH)
6062

6163
preview-%:
62-
CLUSTERGROUP?=$(shell yq ".main.clusterGroupName" values-global.yaml)
64+
$(eval CLUSTERGROUP ?= $(shell yq ".main.clusterGroupName" values-global.yaml))
6365
@common/scripts/preview.sh $(CLUSTERGROUP) $* $(TARGET_REPO) $(TARGET_BRANCH)
6466

6567
.PHONY: operator-deploy
@@ -77,15 +79,41 @@ uninstall: ## runs helm uninstall
7779
@oc delete csv -n openshift-operators $(CSV)
7880

7981
.PHONY: load-secrets
80-
load-secrets: ## loads the secrets into the vault
82+
load-secrets: ## loads the secrets into the backend determined by values-global setting
83+
common/scripts/process-secrets.sh $(NAME)
84+
85+
.PHONY: legacy-load-secrets
86+
legacy-load-secrets: ## loads the secrets into vault (only)
8187
common/scripts/vault-utils.sh push_secrets $(NAME)
8288

89+
.PHONY: secrets-backend-vault
90+
secrets-backend-vault: ## Edits values files to use default Vault+ESO secrets config
91+
common/scripts/set-secret-backend.sh vault
92+
common/scripts/manage-secret-app.sh vault present
93+
common/scripts/manage-secret-app.sh golang-external-secrets present
94+
common/scripts/manage-secret-namespace.sh validated-patterns-secrets absent
95+
@git diff --exit-code || echo "Secrets backend set to vault, please review changes, commit, and push to activate in the pattern"
96+
97+
.PHONY: secrets-backend-kubernetes
98+
secrets-backend-kubernetes: ## Edits values file to use Kubernetes+ESO secrets config
99+
common/scripts/set-secret-backend.sh kubernetes
100+
common/scripts/manage-secret-namespace.sh validated-patterns-secrets present
101+
common/scripts/manage-secret-app.sh vault absent
102+
common/scripts/manage-secret-app.sh golang-external-secrets present
103+
@git diff --exit-code || echo "Secrets backend set to kubernetes, please review changes, commit, and push to activate in the pattern"
104+
105+
.PHONY: secrets-backend-none
106+
secrets-backend-none: ## Edits values files to remove secrets manager + ESO
107+
common/scripts/set-secret-backend.sh none
108+
common/scripts/manage-secret-app.sh vault absent
109+
common/scripts/manage-secret-app.sh golang-external-secrets absent
110+
common/scripts/manage-secret-namespace.sh validated-patterns-secrets absent
111+
@git diff --exit-code || echo "Secrets backend set to none, please review changes, commit, and push to activate in the pattern"
112+
83113
.PHONY: load-iib
84114
load-iib: ## CI target to install Index Image Bundles
85115
@set -e; if [ x$(INDEX_IMAGES) != x ]; then \
86-
for IIB in $(shell echo $(INDEX_IMAGES) | tr ',' '\n'); do \
87-
INDEX_IMAGE="$${IIB}" ansible-playbook common/ansible/playbooks/iib-ci/iib-ci.yaml; \
88-
done; \
116+
ansible-playbook common/ansible/playbooks/iib-ci/iib-ci.yaml; \
89117
else \
90118
echo "No INDEX_IMAGES defined. Bailing out"; \
91119
exit 1; \
@@ -99,14 +127,9 @@ load-iib: ## CI target to install Index Image Bundles
99127
.PHONY: validate-origin
100128
validate-origin: ## verify the git origin is available
101129
@echo "Checking repository:"
102-
@echo -n " $(TARGET_REPO) - branch $(TARGET_BRANCH): "
103-
@if [ ! -f /run/.containerenv ]; then\
104-
git ls-remote --exit-code --heads $(TARGET_REPO) $(TARGET_BRANCH) >/dev/null &&\
105-
echo "OK" ||\
106-
(echo "NOT FOUND"; exit 1);\
107-
else\
108-
echo "Running inside a container: Skipping git ssh checks";\
109-
fi
130+
@echo -n " $(TARGET_REPO) - branch '$(TARGET_BRANCH)': "
131+
@git ls-remote --exit-code --heads $(TARGET_REPO) $(TARGET_BRANCH) >/dev/null &&\
132+
echo "OK" || (echo "NOT FOUND"; exit 1)
110133

111134
.PHONY: validate-cluster
112135
validate-cluster: ## Do some cluster validations before installing
@@ -130,15 +153,19 @@ validate-schema: ## validates values files against schema in common/clustergroup
130153

131154
.PHONY: validate-prereq
132155
validate-prereq: ## verify pre-requisites
133-
@echo "Checking prerequisites:"
134-
@for t in $(EXECUTABLES); do if ! which $$t > /dev/null 2>&1; then echo "No $$t in PATH"; exit 1; fi; done
135-
@echo " Check for '$(EXECUTABLES)': OK"
136-
@echo -n " Check for python-kubernetes: "
137-
@if ! ansible -m ansible.builtin.command -a "{{ ansible_python_interpreter }} -c 'import kubernetes'" localhost > /dev/null 2>&1; then echo "Not found"; exit 1; fi
138-
@echo "OK"
139-
@echo -n " Check for kubernetes.core collection: "
140-
@if ! ansible-galaxy collection list | grep kubernetes.core > /dev/null 2>&1; then echo "Not found"; exit 1; fi
141-
@echo "OK"
156+
@if [ ! -f /run/.containerenv ]; then\
157+
echo "Checking prerequisites:";\
158+
for t in $(EXECUTABLES); do if ! which $$t > /dev/null 2>&1; then echo "No $$t in PATH"; exit 1; fi; done;\
159+
echo " Check for '$(EXECUTABLES)': OK";\
160+
echo -n " Check for python-kubernetes: ";\
161+
if ! ansible -m ansible.builtin.command -a "{{ ansible_python_interpreter }} -c 'import kubernetes'" localhost > /dev/null 2>&1; then echo "Not found"; exit 1; fi;\
162+
echo "OK";\
163+
echo -n " Check for kubernetes.core collection: ";\
164+
if ! ansible-galaxy collection list | grep kubernetes.core > /dev/null 2>&1; then echo "Not found"; exit 1; fi;\
165+
echo "OK";\
166+
else\
167+
echo "Skipping prerequisites check as we're running inside a container";\
168+
fi
142169

143170
.PHONY: argo-healthcheck
144171
argo-healthcheck: ## Checks if all argo applications are synced

common/acm/templates/_helpers.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Default always defined valueFiles to be included when pushing the cluster wide a
55
- "/values-global.yaml"
66
- "/values-{{ .name }}.yaml"
77
- '/values-{{ `{{ (lookup "config.openshift.io/v1" "Infrastructure" "" "cluster").spec.platformSpec.type }}` }}.yaml'
8-
- '/values-{{ `{{ (lookup "config.openshift.io/v1" "Infrastructure" "" "cluster").spec.platformSpec.type }}` }}-{{ `{{ printf "%d.%d" ((semver (lookup "operator.openshift.io/v1" "OpenShiftControllerManager" "" "cluster").status.version).Major) ((semver (lookup "operator.openshift.io/v1" "OpenShiftControllerManager" "" "cluster").status.version).Minor) }}` }}.yaml'
8+
- '/values-{{ `{{ (lookup "config.openshift.io/v1" "Infrastructure" "" "cluster").spec.platformSpec.type }}` }}-{{ `{{ printf "%d.%d" ((semver (index (lookup "config.openshift.io/v1" "ClusterVersion" "" "version").status.history 0).version).Major) ((semver (index (lookup "config.openshift.io/v1" "ClusterVersion" "" "version").status.history 0).version).Minor) }}` }}.yaml'
99
- '/values-{{ `{{ (lookup "config.openshift.io/v1" "Infrastructure" "" "cluster").spec.platformSpec.type }}` }}-{{ .name }}.yaml'
1010
# We cannot use $.Values.global.clusterVersion because that gets resolved to the
1111
# hub's cluster version, whereas we want to include the spoke cluster version
12-
- '/values-{{ `{{ printf "%d.%d" ((semver (lookup "operator.openshift.io/v1" "OpenShiftControllerManager" "" "cluster").status.version).Major) ((semver (lookup "operator.openshift.io/v1" "OpenShiftControllerManager" "" "cluster").status.version).Minor) }}` }}-{{ .name }}.yaml'
12+
- '/values-{{ `{{ printf "%d.%d" ((semver (index (lookup "config.openshift.io/v1" "ClusterVersion" "" "version").status.history 0).version).Major) ((semver (index (lookup "config.openshift.io/v1" "ClusterVersion" "" "version").status.history 0).version).Minor) }}` }}.yaml'
1313
{{- end }} {{- /*acm.app.policies.valuefiles */}}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
{{- $channel := "" }}
2+
{{- if .Values.acm.mce_operator.channel }}
3+
{{- $channel = printf ",\"channel\": \"%s\"" .Values.acm.mce_operator.channel }}
4+
{{- end }}
15
apiVersion: operator.open-cluster-management.io/v1
26
kind: MultiClusterHub
37
metadata:
48
name: multiclusterhub
59
namespace: open-cluster-management
610
annotations:
711
argocd.argoproj.io/sync-wave: "-1"
8-
{{- if kindIs "map" .Values.clusterGroup.subscriptions }}
9-
installer.open-cluster-management.io/mce-subscription-spec: '{"source": "{{ default "redhat-operators" .Values.clusterGroup.subscriptions.acm.source }}" }'
10-
{{- end }}
12+
installer.open-cluster-management.io/mce-subscription-spec: '{"source": "{{ default "redhat-operators" .Values.acm.mce_operator.source }}" {{- $channel }} }'
1113
spec: {}

common/acm/templates/policies/application-policies.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# TODO: Also create a GitOpsCluster.apps.open-cluster-management.io
2+
{{- $hasInitContainerCapability := and (.Values.global.experimentalCapabilities) (has "initcontainers" (splitList "," .Values.global.experimentalCapabilities)) }}
23
{{- range .Values.clusterGroup.managedClusterGroups }}
34
{{- $group := . }}
45
{{- if not .hostedArgoSites }}
@@ -43,18 +44,15 @@ spec:
4344
helm:
4445
ignoreMissingValueFiles: true
4546
valueFiles:
46-
{{- include "acm.app.policies.valuefiles" . | nindent 24 }}
47+
{{- include "acm.app.policies.valuefiles" . | nindent 22 }}
4748
{{- range $valueFile := $.Values.global.extraValueFiles }}
4849
- {{ $valueFile | quote }}
4950
{{- end }}
50-
{{- range $valueFile := .extraValueFiles }}
51-
- {{ $valueFile | quote }}
52-
{{- end }}
5351
parameters:
5452
- name: global.repoURL
55-
value: $ARGOCD_APP_SOURCE_REPO_URL
53+
value: {{ $.Values.global.repoURL }}
5654
- name: global.targetRevision
57-
value: $ARGOCD_APP_SOURCE_TARGET_REVISION
55+
value: {{ $.Values.global.targetRevision }}
5856
- name: global.namespace
5957
value: $ARGOCD_APP_NAMESPACE
6058
- name: global.pattern
@@ -63,18 +61,18 @@ spec:
6361
value: {{ $.Values.global.hubClusterDomain }}
6462
- name: global.localClusterDomain
6563
value: '{{ `{{ (lookup "config.openshift.io/v1" "Ingress" "" "cluster").spec.domain }}` }}'
66-
# Requires ACM 2.6 or higher
6764
- name: global.clusterDomain
6865
value: '{{ `{{ (lookup "config.openshift.io/v1" "Ingress" "" "cluster").spec.domain | replace "apps." "" }}` }}'
69-
# Requires ACM 2.6 or higher (I could not come up with something less terrible to get maj.min)
7066
- name: global.clusterVersion
71-
value: '{{ `{{ printf "%d.%d" ((semver (lookup "operator.openshift.io/v1" "OpenShiftControllerManager" "" "cluster").status.version).Major) ((semver (lookup "operator.openshift.io/v1" "OpenShiftControllerManager" "" "cluster").status.version).Minor) }}` }}'
67+
value: '{{ `{{ printf "%d.%d" ((semver (index (lookup "config.openshift.io/v1" "ClusterVersion" "" "version").status.history 0).version).Major) ((semver (index (lookup "config.openshift.io/v1" "ClusterVersion" "" "version").status.history 0).version).Minor) }}` }}'
7268
- name: global.localClusterName
7369
value: '{{ `{{ (split "." (lookup "config.openshift.io/v1" "Ingress" "" "cluster").spec.domain)._1 }}` }}'
7470
- name: global.clusterPlatform
7571
value: {{ $.Values.global.clusterPlatform }}
7672
- name: clusterGroup.name
7773
value: {{ $group.name }}
74+
- name: global.experimentalCapabilities
75+
value: {{ $.Values.global.experimentalCapabilities }}
7876
{{- range .helmOverrides }}
7977
- name: {{ .name }}
8078
value: {{ .value | quote }}

0 commit comments

Comments
 (0)