diff --git a/k8s/setup_calico.yml b/k8s/setup_calico.yml index 315981c..26a5f7e 100644 --- a/k8s/setup_calico.yml +++ b/k8s/setup_calico.yml @@ -25,5 +25,9 @@ - "kubectl apply -f $HOME/calico/custom-resources.yaml" args: creates: $HOME/calico/custom-resources.yaml + - name: Check if Metrics API is installed + shell: "kubectl get pods -n kube-system | grep metrics | wc -l" + register: METRICS_COUNT - name: Setup Metrics API - shell: "kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability.yaml" \ No newline at end of file + shell: "kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability.yaml" + when: METRICS_COUNT.stdout|int < 1 \ No newline at end of file