@@ -23,7 +23,7 @@ function wait_for_nodes() {
23
23
done
24
24
}
25
25
26
- # The application namespaces are created before applying the resources
26
+ # Namespaces to be applied before the SOPS secrets are installed
27
27
function apply_namespaces() {
28
28
log debug " Applying namespaces"
29
29
@@ -84,6 +84,30 @@ function apply_sops_secrets() {
84
84
done
85
85
}
86
86
87
+ # CRDs to be applied before the helmfile charts are installed
88
+ function apply_crds() {
89
+ log debug " Applying CRDs"
90
+
91
+ local -r crds=(
92
+ # renovate: datasource=github-releases depName=kubernetes-sigs/gateway-api
93
+ https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/experimental-install.yaml
94
+ # renovate: datasource=github-releases depName=prometheus-operator/prometheus-operator
95
+ https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.81.0/stripped-down-crds.yaml
96
+ )
97
+
98
+ for crd in " ${crds[@]} " ; do
99
+ if kubectl diff --filename " ${crd} " & > /dev/null; then
100
+ log info " CRDs are up-to-date" " crd=${crd} "
101
+ continue
102
+ fi
103
+ if kubectl apply --server-side --filename " ${crd} " & > /dev/null; then
104
+ log info " CRDs applied" " crd=${crd} "
105
+ else
106
+ log error " Failed to apply CRDs" " crd=${crd} "
107
+ fi
108
+ done
109
+ }
110
+
87
111
# Apply Helm releases using helmfile
88
112
function apply_helm_releases() {
89
113
log debug " Applying Helm releases with helmfile"
@@ -108,6 +132,7 @@ function main() {
108
132
wait_for_nodes
109
133
apply_namespaces
110
134
apply_sops_secrets
135
+ apply_crds
111
136
apply_helm_releases
112
137
113
138
log info " Congrats! The cluster is bootstrapped and Flux is syncing the Git repository"
0 commit comments