Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Restart Kube State Metrics after install to ensure all CRDs exist on …
Browse files Browse the repository at this point in the history
…startup
  • Loading branch information
david-martin committed Jan 22, 2024
1 parent 97db615 commit d3a26b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .deployUtils
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,15 @@ deployPrometheusForFederation() {
fi
}

restartKSM() {
clusterName=${1}
kubectl config use-context kind-${clusterName}

# Restarts the metrics to make sure all resources exists before ksm starts.
# https://github.com/kubernetes/kube-state-metrics/issues/2142
kubectl delete pods -n monitoring -l app.kubernetes.io/name=kube-state-metrics
}

installAPIDashboards() {
local PROMETHEUS_FOR_FEDERATION_API_DASHBOARDS_KUSTOMIZATION_DIR="$2"
local PROMETHEUS_FOR_FEDERATION_API_DASHBOARDS_GRAFANA_PATCH="$3"
Expand Down
2 changes: 2 additions & 0 deletions quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ configureGatekeeper ${KIND_CLUSTER_CONTROL_PLANE}

setupDemoResources ${KIND_CLUSTER_CONTROL_PLANE}

restartKSM ${KIND_CLUSTER_CONTROL_PLANE}

if [[ -n "${API_WORKLOAD_CLUSTERS_COUNT}" ]]; then
for ((i = 1; i <= ${API_WORKLOAD_CLUSTERS_COUNT}; i++)); do
Expand All @@ -122,6 +123,7 @@ if [[ -n "${API_WORKLOAD_CLUSTERS_COUNT}" ]]; then
configureManagedAddon ${KIND_CLUSTER_CONTROL_PLANE} ${KIND_CLUSTER_WORKLOAD}-${i}
configureClusterAsIngress ${KIND_CLUSTER_CONTROL_PLANE} ${KIND_CLUSTER_WORKLOAD}-${i}
deployPrometheusForFederation ${KIND_CLUSTER_WORKLOAD}-${i} ${PROMETHEUS_FOR_FEDERATION_DIR}?ref=${MGC_BRANCH}
restartKSM ${KIND_CLUSTER_WORKLOAD}-${i}
done
fi

Expand Down

0 comments on commit d3a26b7

Please sign in to comment.