Skip to content

Commit 66101f9

Browse files
committed
Update tests after common rebase
1 parent 9ac57f7 commit 66101f9

20 files changed

Lines changed: 3018 additions & 608 deletions

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
# Source: acm/templates/policies/application-policies.yaml
66
# TODO: Also create a GitOpsCluster.apps.open-cluster-management.io
77
---
8+
# Source: acm/templates/policies/private-repo-policies.yaml
9+
# We copy the vp-private-repo-credentials from the "openshift-gitops" namespace
10+
# to the "open-cluster-management" via the "private-hub-policy"
11+
#
12+
# Then we copy the secret from the "open-cluster-management" namespace to the
13+
# managed clusters "openshift-gitops" instance
14+
#
15+
# And we also copy the same secret to the namespaced argo's namespace
16+
---
817
# Source: acm/templates/multiclusterhub.yaml
918
apiVersion: operator.open-cluster-management.io/v1
1019
kind: MultiClusterHub

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
# Source: acm/templates/policies/acm-hub-ca-policy.yaml
33
# This pushes out the HUB's Certificate Authorities on to the imported clusters
44
---
5+
# Source: acm/templates/policies/private-repo-policies.yaml
6+
# We copy the vp-private-repo-credentials from the "openshift-gitops" namespace
7+
# to the "open-cluster-management" via the "private-hub-policy"
8+
#
9+
# Then we copy the secret from the "open-cluster-management" namespace to the
10+
# managed clusters "openshift-gitops" instance
11+
#
12+
# And we also copy the same secret to the namespaced argo's namespace
13+
---
514
# Source: acm/templates/multiclusterhub.yaml
615
apiVersion: operator.open-cluster-management.io/v1
716
kind: MultiClusterHub

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
# Source: acm/templates/policies/acm-hub-ca-policy.yaml
33
# This pushes out the HUB's Certificate Authorities on to the imported clusters
44
---
5+
# Source: acm/templates/policies/private-repo-policies.yaml
6+
# We copy the vp-private-repo-credentials from the "openshift-gitops" namespace
7+
# to the "open-cluster-management" via the "private-hub-policy"
8+
#
9+
# Then we copy the secret from the "open-cluster-management" namespace to the
10+
# managed clusters "openshift-gitops" instance
11+
#
12+
# And we also copy the same secret to the namespaced argo's namespace
13+
---
514
# Source: acm/templates/multiclusterhub.yaml
615
apiVersion: operator.open-cluster-management.io/v1
716
kind: MultiClusterHub

tests/common-acm-naked.expected.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
# Source: acm/templates/policies/application-policies.yaml
66
# TODO: Also create a GitOpsCluster.apps.open-cluster-management.io
77
---
8+
# Source: acm/templates/policies/private-repo-policies.yaml
9+
# We copy the vp-private-repo-credentials from the "openshift-gitops" namespace
10+
# to the "open-cluster-management" via the "private-hub-policy"
11+
#
12+
# Then we copy the secret from the "open-cluster-management" namespace to the
13+
# managed clusters "openshift-gitops" instance
14+
#
15+
# And we also copy the same secret to the namespaced argo's namespace
16+
---
817
# Source: acm/templates/multiclusterhub.yaml
918
apiVersion: operator.open-cluster-management.io/v1
1019
kind: MultiClusterHub

tests/common-acm-normal.expected.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ type: Opaque
2222
# Source: acm/templates/policies/acm-hub-ca-policy.yaml
2323
# This pushes out the HUB's Certificate Authorities on to the imported clusters
2424
---
25+
# Source: acm/templates/policies/private-repo-policies.yaml
26+
# We copy the vp-private-repo-credentials from the "openshift-gitops" namespace
27+
# to the "open-cluster-management" via the "private-hub-policy"
28+
#
29+
# Then we copy the secret from the "open-cluster-management" namespace to the
30+
# managed clusters "openshift-gitops" instance
31+
#
32+
# And we also copy the same secret to the namespaced argo's namespace
33+
---
2534
# Source: acm/templates/provision/clusterpool.yaml
2635
apiVersion: hive.openshift.io/v1
2736
kind: ClusterClaim

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

Lines changed: 117 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,43 @@ data:
8383
namespace: manuela-factory-ml-workspace
8484
path: charts/datacenter/opendatahub
8585
project: factory
86+
argoCD:
87+
configManagementPlugins:
88+
- image: quay.io/hybridcloudpatterns/utility-container:latest
89+
name: helm-with-kustomize
90+
pluginArgs:
91+
- --loglevel=debug
92+
pluginConfig: |
93+
apiVersion: argoproj.io/v1alpha1
94+
kind: ConfigManagementPlugin
95+
metadata:
96+
name: helm-with-kustomize
97+
spec:
98+
preserveFileMode: true
99+
init:
100+
command: ["/bin/sh", "-c"]
101+
args: ["helm dependency build"]
102+
generate:
103+
command: ["/bin/bash", "-c"]
104+
args: ["helm template . --name-template ${ARGOCD_APP_NAME:0:52}
105+
-f $(git rev-parse --show-toplevel)/values-global.yaml
106+
-f $(git rev-parse --show-toplevel)/values-factory.yaml
107+
--set global.repoURL=$ARGOCD_APP_SOURCE_REPO_URL
108+
--set global.targetRevision=$ARGOCD_APP_SOURCE_TARGET_REVISION
109+
--set global.namespace=$ARGOCD_APP_NAMESPACE
110+
--set global.pattern=mypattern
111+
--set global.clusterDomain=region.example.com
112+
--set global.hubClusterDomain=apps.hub.example.com
113+
--set global.localClusterDomain=apps.region.example.com
114+
--set clusterGroup.name=factory
115+
--post-renderer ./kustomize"]
116+
initContainers: []
86117
imperative:
87118
activeDeadlineSeconds: 3600
88119
clusterRoleName: imperative-cluster-role
89120
clusterRoleYaml: ""
90121
cronJobName: imperative-cronjob
91-
image: registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest
122+
image: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel9:latest
92123
imagePullPolicy: Always
93124
insecureUnsealVaultInsideClusterSchedule: '*/5 * * * *'
94125
jobName: imperative-job
@@ -180,6 +211,38 @@ data:
180211
kind: ClusterSecretStore
181212
name: vault-backend
182213
---
214+
# Source: clustergroup/templates/plumbing/argocd-cmp-plugin-cms.yaml
215+
kind: ConfigMap
216+
apiVersion: v1
217+
metadata:
218+
name: "argocd-cmp-helm-with-kustomize"
219+
namespace: mypattern-factory
220+
data:
221+
"plugin.yaml": |
222+
apiVersion: argoproj.io/v1alpha1
223+
kind: ConfigManagementPlugin
224+
metadata:
225+
name: helm-with-kustomize
226+
spec:
227+
preserveFileMode: true
228+
init:
229+
command: ["/bin/sh", "-c"]
230+
args: ["helm dependency build"]
231+
generate:
232+
command: ["/bin/bash", "-c"]
233+
args: ["helm template . --name-template ${ARGOCD_APP_NAME:0:52}
234+
-f $(git rev-parse --show-toplevel)/values-global.yaml
235+
-f $(git rev-parse --show-toplevel)/values-factory.yaml
236+
--set global.repoURL=$ARGOCD_APP_SOURCE_REPO_URL
237+
--set global.targetRevision=$ARGOCD_APP_SOURCE_TARGET_REVISION
238+
--set global.namespace=$ARGOCD_APP_NAMESPACE
239+
--set global.pattern=mypattern
240+
--set global.clusterDomain=region.example.com
241+
--set global.hubClusterDomain=apps.hub.example.com
242+
--set global.localClusterDomain=apps.region.example.com
243+
--set clusterGroup.name=factory
244+
--post-renderer ./kustomize"]
245+
---
183246
# Source: clustergroup/templates/imperative/clusterrole.yaml
184247
apiVersion: rbac.authorization.k8s.io/v1
185248
kind: ClusterRole
@@ -304,20 +367,41 @@ spec:
304367
# git init happens in /git/repo so that we can set the folder to 0770 permissions
305368
# reason for that is ansible refuses to create temporary folders in there
306369
- name: git-init
307-
image: registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest
370+
image: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel9:latest
308371
imagePullPolicy: Always
309372
env:
310373
- name: HOME
311374
value: /git/home
312375
command:
313376
- 'sh'
314377
- '-c'
315-
- "mkdir /git/{repo,home};git clone --single-branch --branch main --depth 1 -- https://github.com/pattern-clone/mypattern /git/repo;chmod 0770 /git/{repo,home}"
378+
- >-
379+
if ! oc get secrets -n openshift-gitops vp-private-repo-credentials &> /dev/null; then
380+
URL="https://github.com/pattern-clone/mypattern";
381+
else
382+
if ! oc get secrets -n openshift-gitops vp-private-repo-credentials -o go-template='{{index .data.sshPrivateKey | base64decode}}' &>/dev/null; then
383+
U="$(oc get secret -n openshift-gitops vp-private-repo-credentials -o go-template='{{index .data.username | base64decode }}')";
384+
P="$(oc get secret -n openshift-gitops vp-private-repo-credentials -o go-template='{{index .data.password | base64decode }}')";
385+
URL=$(echo https://github.com/pattern-clone/mypattern | sed -E "s/(https?:\/\/)/\1${U}:${P}@/");
386+
echo "USER/PASS: ${URL}";
387+
else
388+
S="$(oc get secret -n openshift-gitops vp-private-repo-credentials -o go-template='{{index .data.sshPrivateKey | base64decode }}')";
389+
mkdir -p --mode 0700 "${HOME}/.ssh";
390+
echo "${S}" > "${HOME}/.ssh/id_rsa";
391+
chmod 0600 "${HOME}/.ssh/id_rsa";
392+
URL=$(echo https://github.com/pattern-clone/mypattern | sed -E "s/(https?:\/\/)/\1git@/");
393+
git config --global core.sshCommand "ssh -i "${HOME}/.ssh/id_rsa" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no";
394+
echo "SSH: ${URL}";
395+
fi;
396+
fi;
397+
mkdir /git/{repo,home};
398+
git clone --single-branch --branch main --depth 1 -- "${URL}" /git/repo;
399+
chmod 0770 /git/{repo,home};
316400
volumeMounts:
317401
- name: git
318402
mountPath: "/git"
319403
- name: test
320-
image: registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest
404+
image: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel9:latest
321405
imagePullPolicy: Always
322406
env:
323407
- name: HOME
@@ -340,7 +424,7 @@ spec:
340424
subPath: values.yaml
341425
containers:
342426
- name: "done"
343-
image: registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest
427+
image: registry.redhat.io/ansible-automation-platform-24/ee-supported-rhel9:latest
344428
imagePullPolicy: Always
345429
command:
346430
- 'sh'
@@ -454,6 +538,8 @@ spec:
454538
value: apps.hub.example.com
455539
- name: global.localClusterDomain
456540
value: apps.region.example.com
541+
- name: global.privateRepo
542+
value:
457543
syncPolicy:
458544
automated: {}
459545
retry:
@@ -496,36 +582,6 @@ spec:
496582
return hs
497583
498584
applicationInstanceLabelKey: argocd.argoproj.io/instance
499-
# Not the greatest way to pass git/quay info to sub-applications, but it will do until
500-
# we can support helmChart with kustomize
501-
# The other option is to pass them in as environment variables eg. BLUEPRINT_VERSION
502-
configManagementPlugins: |
503-
- name: kustomize-version
504-
generate:
505-
command: ["sh", "-c"]
506-
args: ["kustomize version 1>&2 && exit 1"]
507-
- name: kustomize-with-helm
508-
generate:
509-
command: ["kustomize"]
510-
args: ["build", "--enable-helm"]
511-
- name: helm-with-kustomize
512-
init:
513-
command: ["/bin/sh", "-c"]
514-
args: ["helm dependency build"]
515-
generate:
516-
command: ["/bin/bash", "-c"]
517-
args: ["helm template . --name-template ${ARGOCD_APP_NAME:0:52}
518-
-f $(git rev-parse --show-toplevel)/values-global.yaml
519-
-f $(git rev-parse --show-toplevel)/values-factory.yaml
520-
--set global.repoURL=$ARGOCD_APP_SOURCE_REPO_URL
521-
--set global.targetRevision=$ARGOCD_APP_SOURCE_TARGET_REVISION
522-
--set global.namespace=$ARGOCD_APP_NAMESPACE
523-
--set global.pattern=mypattern
524-
--set global.clusterDomain=region.example.com
525-
--set global.hubClusterDomain=apps.hub.example.com
526-
--set global.localClusterDomain=apps.region.example.com
527-
--set clusterGroup.name=factory
528-
--post-renderer ./kustomize"]
529585
applicationSet:
530586
resources:
531587
limits:
@@ -558,6 +614,32 @@ spec:
558614
rbac:
559615
defaultPolicy: role:admin
560616
repo:
617+
sidecarContainers:
618+
- name: helm-with-kustomize
619+
command: [/var/run/argocd/argocd-cmp-server]
620+
args: [
621+
"--loglevel=debug"
622+
]
623+
image: quay.io/hybridcloudpatterns/utility-container:latest
624+
imagePullPolicy: Always
625+
securityContext:
626+
runAsNonRoot: true
627+
volumeMounts:
628+
- mountPath: /var/run/argocd
629+
name: var-files
630+
- mountPath: /home/argocd/cmp-server/plugins
631+
name: plugins
632+
- mountPath: /tmp
633+
name: cmp-tmp
634+
- mountPath: /home/argocd/cmp-server/config/plugin.yaml
635+
subPath: plugin.yaml
636+
name: helm-with-kustomize
637+
volumes:
638+
- emptyDir: {}
639+
name: cmp-tmp
640+
- configMap:
641+
name: "argocd-cmp-helm-with-kustomize"
642+
name: helm-with-kustomize
561643
resources:
562644
limits:
563645
cpu: "1"

0 commit comments

Comments
 (0)