@@ -7,7 +7,7 @@ addressInSubnet() {
77
88# fn <key> <addresses>
99updatePeers () {
10- peers=" $( yq4 " .commons * .clusters.${cluster} | .networkPolicies.${1} | .[].cidr" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) "
10+ peers=" $( yq " .commons * .clusters.${cluster} | .networkPolicies.${1} | .[].cidr" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) "
1111
1212 local -a update
1313
@@ -22,14 +22,14 @@ updatePeers() {
2222 update+=(" ${address} /32" )
2323 done
2424
25- old=" $( yq4 -oj -I0 ' [split(" ") | sort | .[] | {"cidr": .}]' <<< " $peers" ) "
26- new=" $( yq4 -oj -I0 ' [split(" ") | sort | unique | .[] | {"cidr": .}]' <<< " ${update[*]}" ) "
25+ old=" $( yq -oj -I0 ' [split(" ") | sort | .[] | {"cidr": .}]' <<< " $peers" ) "
26+ new=" $( yq -oj -I0 ' [split(" ") | sort | unique | .[] | {"cidr": .}]' <<< " ${update[*]}" ) "
2727
28- if ! diff -u3 --color --label " current .commons * .clusters.${cluster} | .${1} " <( yq4 -P <<< " $old" ) --label " update .cluster.${cluster} .${1} " <( yq4 -P <<< " $new" ) ; then
28+ if ! diff -u3 --color --label " current .commons * .clusters.${cluster} | .${1} " <( yq -P <<< " $old" ) --label " update .cluster.${cluster} .${1} " <( yq -P <<< " $new" ) ; then
2929 echo -n " apply update? [Y/n]: "
3030 read -r reply
3131 if [[ " ${reply} " =~ ^(Y| y| )$ ]]; then
32- yq4 -i " .clusters.${cluster} .networkPolicies.${1} = ${new} " " ${CK8S_CONFIG_PATH} /rook/values.yaml"
32+ yq -i " .clusters.${cluster} .networkPolicies.${1} = ${new} " " ${CK8S_CONFIG_PATH} /rook/values.yaml"
3333 fi
3434 else
3535 echo " - ${cluster} /networkPolicies/${1} : up to date"
@@ -42,7 +42,7 @@ if [[ -z "${CK8S_CONFIG_PATH:-}" ]]; then
4242elif [[ -z " ${1:- } " ]]; then
4343 echo " err: missing cluster name" >&2
4444 exit
45- elif [[ " $( yq4 " .clusters | keys | [\" ${1} \" ] - . | length" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " == " 1" ]]; then
45+ elif [[ " $( yq " .clusters | keys | [\" ${1} \" ] - . | length" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " == " 1" ]]; then
4646 echo " err: invalid cluster name" >&2
4747 exit
4848fi
5656fi
5757
5858apiserverAddresses=" $(
59- kubectl get no -lnode-role.kubernetes.io/control-plane= -oyaml | yq4 ' [
59+ kubectl get no -lnode-role.kubernetes.io/control-plane= -oyaml | yq ' [
6060 .items[] | [
6161 .status.addresses[] | select(.type == "InternalIP") | .address
6262 ] + (
6363 .metadata.annotations | [."projectcalico.org/IPv4IPIPTunnelAddr", ."projectcalico.org/IPv4WireguardInterfaceAddr"]) | .[]] | sort | .[]'
6464) "
6565
6666nodeAddresses=" $(
67- kubectl get no -oyaml | yq4 ' [
67+ kubectl get no -oyaml | yq ' [
6868 .items[] | [
6969 .status.addresses[] | select(.type == "InternalIP") | .address
7070 ] + (
@@ -97,12 +97,12 @@ pspcrds=(
9797 k8spspvolumetypes.constraints.gatekeeper.sh
9898)
9999
100- if [[ " $( yq4 " .commons * .clusters.${cluster} | .podSecurityPolicies.enabled" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " != " true" ]]; then
100+ if [[ " $( yq " .commons * .clusters.${cluster} | .podSecurityPolicies.enabled" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " != " true" ]]; then
101101 if kubectl get crds " ${pspcrds[@]} " & > /dev/null; then
102102 echo -n " - enable Gatekeeper podsecuritypolicies? [Y/n]: "
103103 read -r reply
104104 if [[ " ${reply} " =~ ^(Y| y| )$ ]]; then
105- yq4 -i " .clusters.${cluster} .podSecurityPolicies.enabled = true" " ${CK8S_CONFIG_PATH} /rook/values.yaml"
105+ yq -i " .clusters.${cluster} .podSecurityPolicies.enabled = true" " ${CK8S_CONFIG_PATH} /rook/values.yaml"
106106 fi
107107 else
108108 echo " - warning: Gatekeeper constraints not available"
@@ -112,13 +112,13 @@ else
112112fi
113113
114114echo " checking service monitors..."
115- if [[ " $( yq4 " .commons * .clusters.${cluster} | .monitoring.installServiceMonitors" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " != " true" ]]; then
115+ if [[ " $( yq " .commons * .clusters.${cluster} | .monitoring.installServiceMonitors" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " != " true" ]]; then
116116 if kubectl get crd prometheuses.monitoring.coreos.com & > /dev/null; then
117117 if [[ -n " $( kubectl get po -A -l app.kubernetes.io/name=prometheus 2> /dev/null) " ]]; then
118118 echo -n " - install Prometheus service monitors? [Y/n]: "
119119 read -r reply
120120 if [[ " ${reply} " =~ ^(Y| y| )$ ]]; then
121- yq4 -i " .clusters.${cluster} .monitoring.installServiceMonitors = true" " ${CK8S_CONFIG_PATH} /rook/values.yaml"
121+ yq -i " .clusters.${cluster} .monitoring.installServiceMonitors = true" " ${CK8S_CONFIG_PATH} /rook/values.yaml"
122122 fi
123123 else
124124 echo " - note: Prometheus not available"
@@ -131,12 +131,12 @@ else
131131fi
132132
133133echo " checking dashboards..."
134- if [[ " $( yq4 " .commons * .clusters.${cluster} | .monitoring.installGrafanaDashboards" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " != " true" ]]; then
134+ if [[ " $( yq " .commons * .clusters.${cluster} | .monitoring.installGrafanaDashboards" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " != " true" ]]; then
135135 if [[ -n " $( kubectl get po -A -l app.kubernetes.io/name=grafana 2> /dev/null) " ]]; then
136136 echo -n " - install Grafana dashboards? [Y/n]: "
137137 read -r reply
138138 if [[ " ${reply} " =~ ^(Y| y| )$ ]]; then
139- yq4 -i " .clusters.${cluster} .monitoring.installGrafanaDashboards = true" " ${CK8S_CONFIG_PATH} /rook/values.yaml"
139+ yq -i " .clusters.${cluster} .monitoring.installGrafanaDashboards = true" " ${CK8S_CONFIG_PATH} /rook/values.yaml"
140140 fi
141141 else
142142 echo " - note: Grafana not available"
@@ -146,13 +146,13 @@ else
146146fi
147147
148148echo " checking rules..."
149- if [[ " $( yq4 " .commons * .clusters.${cluster} | .monitoring.installPrometheusRules" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " != " true" ]]; then
149+ if [[ " $( yq " .commons * .clusters.${cluster} | .monitoring.installPrometheusRules" " ${CK8S_CONFIG_PATH} /rook/values.yaml" ) " != " true" ]]; then
150150 if kubectl get crd prometheusrules.monitoring.coreos.com & > /dev/null; then
151151 if [[ -n " $( kubectl get po -A -l app.kubernetes.io/name=thanos 2> /dev/null) " ]]; then
152152 echo -n " - install Prometheus rules? [Y/n]: "
153153 read -r reply
154154 if [[ " ${reply} " =~ ^(Y| y| )$ ]]; then
155- yq4 -i " .clusters.${cluster} .monitoring.installPrometheusRules = true" " ${CK8S_CONFIG_PATH} /rook/values.yaml"
155+ yq -i " .clusters.${cluster} .monitoring.installPrometheusRules = true" " ${CK8S_CONFIG_PATH} /rook/values.yaml"
156156 fi
157157 else
158158 echo " - note: Thanos not available"
0 commit comments