Skip to content

Commit 76e2840

Browse files
committed
Add Orchestrator Gitops operator script and refactoring
1 parent a04184e commit 76e2840

2 files changed

Lines changed: 72 additions & 1 deletion

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
#
3+
# GitOps/Pipeline Infrastructure Setup Script
4+
#
5+
6+
set -e
7+
8+
action="${1:-apply}" # Default action is 'apply'
9+
10+
11+
gitops_pipelines() {
12+
kubectl "$action" -f - <<EOF
13+
apiVersion: v1
14+
kind: Namespace
15+
metadata:
16+
name: orchestrator-gitops
17+
---
18+
apiVersion: operators.coreos.com/v1
19+
kind: OperatorGroup
20+
metadata:
21+
name: orchestrator-gitops-group
22+
namespace: orchestrator-gitops
23+
spec:
24+
---
25+
apiVersion: operators.coreos.com/v1alpha1
26+
kind: Subscription
27+
metadata:
28+
name: orchestrator-gitops-operator
29+
namespace: orchestrator-gitops
30+
spec:
31+
channel: latest
32+
installPlanApproval: Automatic
33+
name: openshift-gitops-operator
34+
source: redhat-operators
35+
sourceNamespace: openshift-marketplace
36+
---
37+
apiVersion: operators.coreos.com/v1alpha1
38+
kind: Subscription
39+
metadata:
40+
name: openshift-pipelines-operator-rh
41+
namespace: orchestrator-gitops
42+
spec:
43+
channel: pipelines-1.17
44+
installPlanApproval: Automatic
45+
name: openshift-pipelines-operator-rh
46+
source: redhat-operators
47+
sourceNamespace: openshift-marketplace
48+
EOF
49+
}
50+
51+
# execution
52+
53+
if [ "$action" == "apply" ]; then
54+
gitops_pipelines
55+
elif [ "$action" == "delete" ]; then
56+
gitops_pipelines
57+
else
58+
echo "Action '$action' is not supported. Use 'apply' (default) or 'delete'."
59+
exit 1
60+
fi

config/profile/rhdh/plugin-infra/gitops-infra.sh renamed to config/profile/rhdh/plugin-infra/gitops/resources.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
#!/bin/bash
22
#
3-
# GitOps Infrastructure Setup Script for Orchestrator with RHDH
3+
# GitOps/Pipeline Resources Setup Script for Orchestrator with RHDH
44
#
55

66
set -e
77

88
action="${1:-apply}" # Default action is 'apply'
99

10+
orchestrator_gitops_namespace() {
11+
kubectl "$action" -f - <<EOF
12+
apiVersion: v1
13+
kind: Namespace
14+
metadata:
15+
name: orchestrator-gitops
16+
EOF
17+
}
18+
1019
argoCD() {
1120
kubectl "$action" -f - <<'EOF'
1221
apiVersion: argoproj.io/v1alpha1
@@ -447,10 +456,12 @@ EOF
447456
# execution
448457

449458
if [ "$action" == "apply" ]; then
459+
orchestrator_gitops_namespace
450460
argoCD
451461
tekton_tasks
452462
tekton_pipeline
453463
elif [ "$action" == "delete" ]; then
464+
orchestrator_gitops_namespace
454465
argoCD
455466
tekton_tasks
456467
tekton_pipeline

0 commit comments

Comments
 (0)