@@ -21,6 +21,8 @@ set -eu -o pipefail
2121PROJECT_ROOT=" $( git rev-parse --show-toplevel) "
2222declare -r PROJECT_ROOT
2323declare -r KUBECONFIG_ROOT_DIR=${KUBECONFIG_ROOT_DIR:- $PROJECT_ROOT / .kube}
24+ declare -r KUBE_PROM_DIR=" $PROJECT_ROOT /tmp/kube-prometheus"
25+ declare -r DASHBOARD_DIR=" $KUBE_PROM_DIR /grafana-dashboards"
2426# shellcheck source=lib/utils.sh
2527source " $PROJECT_ROOT /lib/utils.sh"
2628
@@ -58,6 +60,17 @@ verify_cluster() {
5860 rollout_status " $res " " $NAMESPACE "
5961 done
6062
63+ # verify kubeconf for ec2_hosted_runner usage
64+ info " Verifying cluster status for CI usage"
65+ cp .kube/config /tmp/kubeconfig
66+ export KUBECONFIG=" /tmp/kubeconfig"
67+ run kubectl cluster-info || die " failed to get the cluster-info"
68+
69+ # check k8s system pod is there...
70+ [[ $( kubectl get pods --all-namespaces | wc -l) == 0 ]] &&
71+ die " it seems k8s cluster is not started"
72+
73+ run_yq
6174 ok " Cluster is up and running"
6275}
6376
@@ -67,6 +80,15 @@ containerruntime() {
6780 docker info || true
6881}
6982
83+
84+ run_yq (){
85+ f=" $DASHBOARD_DIR /grafana-dashboards/kepler-exporter-configmap.yaml" \
86+ yq -i e ' .items += [load(env(f))]' " $KUBE_PROM_DIR " /manifests/grafana-dashboardDefinitions.yaml;
87+ yq -i e ' .spec.template.spec.containers.0.volumeMounts += [ {"mountPath": "/grafana-dashboard-definitions/0/kepler-exporter", "name": "grafana-dashboard-kepler-exporter", "readOnly": false} ]' " $KUBE_PROM_DIR " /manifests/grafana-deployment.yaml
88+ yq -i e ' .spec.template.spec.volumes += [ {"configMap": {"name": "grafana-dashboard-kepler-exporter"}, "name": "grafana-dashboard-kepler-exporter"} ]' " $KUBE_PROM_DIR " /manifests/grafana-deployment.yaml;
89+ ok " Dashboard setup complete"
90+ }
91+
7092main () {
7193 # verify the deployment of cluster
7294 case $1 in
0 commit comments