This repository has been archived by the owner on May 1, 2024. It is now read-only.
forked from validatedpatterns/multicluster-devsecops
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR for including RegionalDR architecture on the Multicluster-DevSecOps pattern --------- Signed-off-by: Alejandro Villegas <alex.ansi.c@gmail.com> Signed-off-by: Tomer Figenblat <tfigenbl@redhat.com> Co-authored-by: Tomer Figenblat <tfigenbl@redhat.com>
- Loading branch information
Showing
18 changed files
with
778 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
description: A Helm chart to deploy RegionalDR configuration | ||
keywords: | ||
- pattern | ||
name: hub-apps | ||
version: 0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{{- range .Values.regionalDR }} | ||
{{- $clusterset := .name }} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: cluster-labeler | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "0" | ||
#argocd.argoproj.io/hook-delete-policy: HookSucceeded | ||
namespace: regional-dr | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: clusterset-labeler | ||
command: | ||
- /bin/bash | ||
- -c | ||
- | | ||
echo "{{ .primary.name }}" > /tmp/cluster_list | ||
{{- range .secondaries }} | ||
echo "{{ .name }}" >> /tmp/cluster_list | ||
{{- end }} | ||
for cluster in $(cat /tmp/cluster_list); do | ||
echo "Labeling ManagedCluster $cluster to become members of ManagedClusterSet {{ $clusterset }}" | ||
oc label managedCluster $cluster cluster.open-cluster-management.io/clusterset={{ $clusterset }} --overwrite | ||
if [ $? = 0 ] | ||
then | ||
echo "ManagedCluster $cluster successfully assigned to {{ $clusterset }}" | ||
else | ||
echo "Failed to label ManagedCluster" | ||
fi | ||
done | ||
image: registry.redhat.io/openshift4/ose-cli:v4.14 | ||
restartPolicy: OnFailure | ||
serviceAccountName: cluster-labeler | ||
{{- end }} | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: cluster-labeler | ||
namespace: regional-dr | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "-2" | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: cluster-labeler | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "-2" | ||
rules: | ||
- apiGroups: | ||
- "" | ||
- "cluster.open-cluster-management.io" | ||
resources: | ||
- "*" | ||
verbs: | ||
- create | ||
- get | ||
- list | ||
- patch | ||
- update | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: cluster-labeler | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "-2" | ||
subjects: | ||
- kind: ServiceAccount | ||
name: cluster-labeler | ||
namespace: regional-dr | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: cluster-labeler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: enable-odf-plugin | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "0" | ||
argocd.argoproj.io/hook: "PostSync" | ||
#argocd.argoproj.io/hook-delete-policy: HookSucceeded | ||
namespace: openshift-storage | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: enable-odf-plugin | ||
command: | ||
- /bin/bash | ||
- -c | ||
- | | ||
echo "Patching the console to enable MCO console plugin" | ||
oc patch console.operator cluster -n openshift-storage --type json -p '[{"op": "add", "path": "/spec/plugins", "value": ["odf-multicluster-console"]}]' | ||
if [ $? = 0 ] | ||
then | ||
echo "MCO console enabled, patch was applied ok" | ||
else | ||
echo "Failed to patch console" | ||
fi | ||
image: registry.redhat.io/openshift4/ose-cli:v4.7 | ||
restartPolicy: Never | ||
serviceAccountName: patch-sa | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: patch-sa | ||
namespace: openshift-storage | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "-2" | ||
|
||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: patch-sa-role | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "-2" | ||
rules: | ||
- apiGroups: | ||
- "" | ||
- "ocs.openshift.io" | ||
- "operator.openshift.io" | ||
resources: | ||
- consoles | ||
verbs: | ||
- get | ||
- list | ||
- patch | ||
- update | ||
|
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: patch-sa-rolebinding | ||
annotations: | ||
argocd.argoproj.io/sync-wave: "-2" | ||
subjects: | ||
- kind: ServiceAccount | ||
name: patch-sa | ||
namespace: openshift-storage | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: patch-sa-role |
Oops, something went wrong.