Commit 00f38b8 1 parent a2aa8e4 commit 00f38b8 Copy full SHA for 00f38b8
File tree 2 files changed +40
-20
lines changed
templates/config/kubernetes/bootstrap/apps/hooks
2 files changed +40
-20
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- wait_for_cilium_crds () {
4
- local crds=(
3
+ set -euo pipefail
4
+
5
+ function wait_for_crds() {
6
+ local -r crds=(
5
7
" ciliuml2announcementpolicies.cilium.io"
6
8
" ciliumbgppeeringpolicies.cilium.io"
7
9
" ciliumloadbalancerippools.cilium.io"
8
10
)
9
11
10
12
for crd in " ${crds[@]} " ; do
11
13
until kubectl get crd " $crd " & > /dev/null; do
14
+ echo " Waiting for CRD '${crd} '..."
12
15
sleep 5
13
16
done
14
17
done
15
18
}
16
19
17
- apply_cilium_config () {
18
- kubectl apply \
20
+ function apply_config() {
21
+ echo " Checking if Cilium config needs to be applied..."
22
+ if kubectl diff \
19
23
--namespace=kube-system \
20
- --server-side \
21
- --field-manager=kustomize-controller \
22
24
--kustomize \
23
- " ${KUBERNETES_DIR} /apps/kube-system/cilium/config"
25
+ " ${KUBERNETES_DIR} /apps/kube-system/cilium/config" & > /dev/null;
26
+ then
27
+ echo " Cilium config is up to date. Skipping..."
28
+ else
29
+ echo " Applying Cilium config..."
30
+ kubectl apply \
31
+ --namespace=kube-system \
32
+ --server-side \
33
+ --field-manager=kustomize-controller \
34
+ --kustomize \
35
+ " ${KUBERNETES_DIR} /apps/kube-system/cilium/config"
36
+ fi
24
37
}
25
38
26
- main () {
27
- wait_for_cilium_crds
28
- apply_cilium_config
39
+ function main() {
40
+ wait_for_crds
41
+ apply_config
29
42
}
30
43
31
- main
44
+ main " $@ "
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ set -euo pipefail
4
+
3
5
# renovate: datasource=github-releases depName=prometheus-operator/prometheus-operator
4
6
PROMETHEUS_OPERATOR_VERSION=" v0.80.0"
5
7
6
- apply_prometheus_operator_crds () {
7
- local crds=(
8
+ function apply_crds () {
9
+ local -r crds=(
8
10
" alertmanagerconfigs"
9
11
" alertmanagers"
10
12
" podmonitors"
@@ -18,15 +20,20 @@ apply_prometheus_operator_crds() {
18
20
)
19
21
20
22
for crd in " ${crds[@]} " ; do
21
- kubectl apply \
22
- --server-side \
23
- --filename \
24
- " https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/${PROMETHEUS_OPERATOR_VERSION} /example/prometheus-operator-crd/monitoring.coreos.com_${crd} .yaml"
23
+ if kubectl get crd " ${crd} .monitoring.coreos.com" & > /dev/null; then
24
+ echo " The CRD '${crd} ' already exists. Skipping..."
25
+ else
26
+ echo " Applying CRD '${crd} '..."
27
+ kubectl apply \
28
+ --server-side \
29
+ --filename \
30
+ " https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/${PROMETHEUS_OPERATOR_VERSION} /example/prometheus-operator-crd/monitoring.coreos.com_${crd} .yaml"
31
+ fi
25
32
done
26
33
}
27
34
28
- main () {
29
- apply_prometheus_operator_crds
35
+ function main() {
36
+ apply_crds
30
37
}
31
38
32
- main
39
+ main " $@ "
You can’t perform that action at this time.
0 commit comments