summaryrefslogtreecommitdiff
path: root/roles/kubernetes/addons/metrics-server/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/kubernetes/addons/metrics-server/tasks')
-rw-r--r--roles/kubernetes/addons/metrics-server/tasks/main.yml11
1 files changed, 8 insertions, 3 deletions
diff --git a/roles/kubernetes/addons/metrics-server/tasks/main.yml b/roles/kubernetes/addons/metrics-server/tasks/main.yml
index 5236e4e3..87c57346 100644
--- a/roles/kubernetes/addons/metrics-server/tasks/main.yml
+++ b/roles/kubernetes/addons/metrics-server/tasks/main.yml
@@ -9,8 +9,13 @@
src: "components.{{ kubernetes_metrics_server_version }}.yml.j2"
dest: /etc/kubernetes/addons/metrics-server/config.yml
- ## TODO: move to server-side apply (GA since 1.22)
+- name: check if metrics-server is already installed
+ check_mode: no
+ command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -f /etc/kubernetes/addons/metrics-server/config.yml
+ failed_when: false
+ changed_when: false
+ register: kube_metrics_server_diff_result
+
- name: install metrics-server onto the cluster
+ when: kube_metrics_server_diff_result.rc != 0
command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/addons/metrics-server/config.yml
- register: kube_metrics_server_apply_result
- changed_when: (kube_metrics_server_apply_result.stdout_lines | reject("regex", " unchanged$") | list | length) > 0