From 2010f39b42e3cf5c98a51a7989e948b889547a12 Mon Sep 17 00:00:00 2001 From: Vincent Schwarzer Date: Wed, 1 Mar 2017 13:54:26 +0100 Subject: [PATCH] Changes based on feedback from Review. --- roles/download/defaults/main.yml | 25 +++++++++++++++++++ .../kubernetes-apps/heapster/default/main.yml | 12 +++++++++ roles/kubernetes-apps/heapster/meta/main.yml | 8 ++++++ roles/kubernetes-apps/heapster/tasks/main.yml | 24 ++++++++++-------- ...-deployment.yaml => grafana-deploy.yml.j2} | 4 +-- ...rafana-service.yaml => grafana-svc.yml.j2} | 2 +- ...deployment.yaml => heapster-deploy.yml.j2} | 4 +-- ...pster-service.yaml => heapster-svc.yml.j2} | 2 +- ...deployment.yaml => influxdb-deploy.yml.j2} | 4 +-- ...luxdb-service.yaml => influxdb-svc.yml.j2} | 2 +- 10 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 roles/kubernetes-apps/heapster/meta/main.yml rename roles/kubernetes-apps/heapster/templates/{grafana-deployment.yaml => grafana-deploy.yml.j2} (92%) rename roles/kubernetes-apps/heapster/templates/{grafana-service.yaml => grafana-svc.yml.j2} (94%) rename roles/kubernetes-apps/heapster/templates/{heapster-deployment.yaml => heapster-deploy.yml.j2} (79%) rename roles/kubernetes-apps/heapster/templates/{heapster-service.yaml => heapster-svc.yml.j2} (91%) rename roles/kubernetes-apps/heapster/templates/{influxdb-deployment.yaml => influxdb-deploy.yml.j2} (78%) rename roles/kubernetes-apps/heapster/templates/{influxdb-service.yaml => influxdb-svc.yml.j2} (91%) diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml index e64845460..87cd566ef 100644 --- a/roles/download/defaults/main.yml +++ b/roles/download/defaults/main.yml @@ -91,6 +91,16 @@ fluentd_image_tag: "{{ fluentd_version }}" kibana_version: "v4.6.1" kibana_image_repo: "gcr.io/google_containers/kibana" kibana_image_tag: "{{ kibana_version }}" +grafana_version: "v4.0.2" +grafana_image_repo: "gcr.io/google_containers/heapster-grafana-amd64" +grafana_image_tag: "{{ grafana_version }}" +heapster_version: "v1.3.0-beta.1" +heapster_image_repo: "gcr.io/google_containers/heapster-amd64" +heapster_image_tag: "{{ heapster_version }}" +influxdb_version: "v1.1.1" +influxdb_image_repo: "gcr.io/google_containers/heapster-influxdb-amd64" +influxdb_image_tag: "{{ influxdb_version }}" + helm_version: "v2.2.2" helm_image_repo: "lachlanevenson/k8s-helm" @@ -238,6 +248,21 @@ downloads: repo: "{{ tiller_image_repo }}" tag: "{{ tiller_image_tag }}" sha256: "{{ tiller_digest_checksum|default(None) }}" + grafana: + container: true + repo: "{{ grafana_image_repo }}" + tag: "{{ grafana_image_tag }}" + sha256: "{{ grafana_digest_checksum|default(None) }}" + heapster: + container: true + repo: "{{ heapster_image_repo }}" + tag: "{{ heapster_image_tag }}" + sha256: "{{ heapster_digest_checksum|default(None) }}" + influxdb: + container: true + repo: "{{ influxdb_image_repo }}" + tag: "{{ influxdb_image_tag }}" + sha256: "{{ influxdb_digest_checksum|default(None) }}" download: container: "{{ file.container|default('false') }}" diff --git a/roles/kubernetes-apps/heapster/default/main.yml b/roles/kubernetes-apps/heapster/default/main.yml index 6dc88d0d8..3c840ec4a 100644 --- a/roles/kubernetes-apps/heapster/default/main.yml +++ b/roles/kubernetes-apps/heapster/default/main.yml @@ -1,2 +1,14 @@ --- heapster_namespace: kube-system + +grafana_version: "v4.0.2" +grafana_image_repo: "gcr.io/google_containers/heapster-grafana-amd64" +grafana_image_tag: "{{ grafana_version }}" + +heapster_version: "v1.3.0-beta.1" +heapster_image_repo: "gcr.io/google_containers/heapster-amd64" +heapster_image_tag: "{{ heapster_version }}" + +influxdb_version: "v1.1.1" +influxdb_image_repo: "gcr.io/google_containers/heapster-influxdb-amd64" +influxdb_image_tag: "{{ influxdb_version }}" diff --git a/roles/kubernetes-apps/heapster/meta/main.yml b/roles/kubernetes-apps/heapster/meta/main.yml new file mode 100644 index 000000000..a7e0e9137 --- /dev/null +++ b/roles/kubernetes-apps/heapster/meta/main.yml @@ -0,0 +1,8 @@ +--- +dependencies: + - role: download + file: "{{ downloads.grafana }}" + - role: download + file: "{{ downloads.heapster }}" + - role: download + file: "{{ downloads.influxdb }}" diff --git a/roles/kubernetes-apps/heapster/tasks/main.yml b/roles/kubernetes-apps/heapster/tasks/main.yml index fa8278a1b..a8e590fc8 100644 --- a/roles/kubernetes-apps/heapster/tasks/main.yml +++ b/roles/kubernetes-apps/heapster/tasks/main.yml @@ -1,17 +1,19 @@ --- -- name: Heapster | Lay Down Heaspter Templates - template: src={{item.file}} dest={{kube_config_dir}}/{{item.file}} +- name: Heapster | Lay Down Heapster Templates + template: + src={{item.file}} + dest={{kube_config_dir}}/{{item.file}} with_items: - - {file: grafana-deployment.yaml, type: deployment, name: monitoring-grafana} - - {file: grafana-service.yaml, type: svc, name: monitoring-grafana} - - {file: heapster-deployment.yaml, type: deployment, name: heapster} - - {file: heapster-service.yaml, type: svc, name: heapster} - - {file: influxdb-deployment.yaml, type: deployment, name: monitoring-influxdb} - - {file: influxdb-service.yaml, type: svc, name: monitoring-influxdb} - register: manifests + - {file: grafana-deploy.yml, type: deployment, name: monitoring-grafana} + - {file: grafana-svc.yml, type: svc, name: monitoring-grafana} + - {file: heapster-deploy.yml, type: deployment, name: heapster} + - {file: heapster-svc.yml, type: svc, name: heapster} + - {file: influxdb-deploy.yml, type: deployment, name: monitoring-influxdb} + - {file: influxdb-svc.yml, type: svc, name: monitoring-influxdb} + register: heapster_deploy_manifests when: inventory_hostname == groups['kube-master'][0] -- name: Heapster| Start Resources +- name: Heapster | Start Resources kube: name: "{{item.item.name}}" namespace: "{{heapster_namespace}}" @@ -19,5 +21,5 @@ resource: "{{item.item.type}}" filename: "{{kube_config_dir}}/{{item.item.file}}" state: "{{item.changed | ternary('latest','present') }}" - with_items: "{{ manifests.results }}" + with_items: "{{ heapster_deploy_manifests.changed }}" when: inventory_hostname == groups['kube-master'][0] diff --git a/roles/kubernetes-apps/heapster/templates/grafana-deployment.yaml b/roles/kubernetes-apps/heapster/templates/grafana-deploy.yml.j2 similarity index 92% rename from roles/kubernetes-apps/heapster/templates/grafana-deployment.yaml rename to roles/kubernetes-apps/heapster/templates/grafana-deploy.yml.j2 index fffa92151..f39e97f67 100644 --- a/roles/kubernetes-apps/heapster/templates/grafana-deployment.yaml +++ b/roles/kubernetes-apps/heapster/templates/grafana-deploy.yml.j2 @@ -2,7 +2,7 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: name: monitoring-grafana - namespace: kube-system + namespace: "{{ heapster_namespace }}" spec: replicas: 1 template: @@ -13,7 +13,7 @@ spec: spec: containers: - name: grafana - image: gcr.io/google_containers/heapster-grafana-amd64:v4.0.2 + image: "{{ grafana_image_repo }}:{{ grafana_image_tag }}" ports: - containerPort: 3000 protocol: TCP diff --git a/roles/kubernetes-apps/heapster/templates/grafana-service.yaml b/roles/kubernetes-apps/heapster/templates/grafana-svc.yml.j2 similarity index 94% rename from roles/kubernetes-apps/heapster/templates/grafana-service.yaml rename to roles/kubernetes-apps/heapster/templates/grafana-svc.yml.j2 index 2f14612dd..d7082c590 100644 --- a/roles/kubernetes-apps/heapster/templates/grafana-service.yaml +++ b/roles/kubernetes-apps/heapster/templates/grafana-svc.yml.j2 @@ -7,7 +7,7 @@ metadata: kubernetes.io/cluster-service: 'true' kubernetes.io/name: monitoring-grafana name: monitoring-grafana - namespace: kube-system + namespace: "{{ heapster_namespace }}" spec: # In a production setup, we recommend accessing Grafana through an external Loadbalancer # or through a public IP. diff --git a/roles/kubernetes-apps/heapster/templates/heapster-deployment.yaml b/roles/kubernetes-apps/heapster/templates/heapster-deploy.yml.j2 similarity index 79% rename from roles/kubernetes-apps/heapster/templates/heapster-deployment.yaml rename to roles/kubernetes-apps/heapster/templates/heapster-deploy.yml.j2 index 78f7478f6..8c5c69d9e 100644 --- a/roles/kubernetes-apps/heapster/templates/heapster-deployment.yaml +++ b/roles/kubernetes-apps/heapster/templates/heapster-deploy.yml.j2 @@ -2,7 +2,7 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: name: heapster - namespace: kube-system + namespace: "{{ heapster_namespace }}" spec: replicas: 1 template: @@ -13,7 +13,7 @@ spec: spec: containers: - name: heapster - image: gcr.io/google_containers/heapster-amd64:v1.3.0-beta.1 + image: "{{ heapster_image_repo }}:{{ heapster_image_tag }}" imagePullPolicy: IfNotPresent command: - /heapster diff --git a/roles/kubernetes-apps/heapster/templates/heapster-service.yaml b/roles/kubernetes-apps/heapster/templates/heapster-svc.yml.j2 similarity index 91% rename from roles/kubernetes-apps/heapster/templates/heapster-service.yaml rename to roles/kubernetes-apps/heapster/templates/heapster-svc.yml.j2 index 097d8ee05..8f1151602 100644 --- a/roles/kubernetes-apps/heapster/templates/heapster-service.yaml +++ b/roles/kubernetes-apps/heapster/templates/heapster-svc.yml.j2 @@ -8,7 +8,7 @@ metadata: kubernetes.io/cluster-service: 'true' kubernetes.io/name: Heapster name: heapster - namespace: kube-system + namespace: "{{ heapster_namespace }}" spec: ports: - port: 80 diff --git a/roles/kubernetes-apps/heapster/templates/influxdb-deployment.yaml b/roles/kubernetes-apps/heapster/templates/influxdb-deploy.yml.j2 similarity index 78% rename from roles/kubernetes-apps/heapster/templates/influxdb-deployment.yaml rename to roles/kubernetes-apps/heapster/templates/influxdb-deploy.yml.j2 index bb6bd2b35..318ad43c2 100644 --- a/roles/kubernetes-apps/heapster/templates/influxdb-deployment.yaml +++ b/roles/kubernetes-apps/heapster/templates/influxdb-deploy.yml.j2 @@ -2,7 +2,7 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: name: monitoring-influxdb - namespace: kube-system + namespace: "{{ heapster_namespace }}" spec: replicas: 1 template: @@ -13,7 +13,7 @@ spec: spec: containers: - name: influxdb - image: gcr.io/google_containers/heapster-influxdb-amd64:v1.1.1 + image: "{{ influxdb_image_repo }}:{{ influxdb_image_tag }}" volumeMounts: - mountPath: /data name: influxdb-storage diff --git a/roles/kubernetes-apps/heapster/templates/influxdb-service.yaml b/roles/kubernetes-apps/heapster/templates/influxdb-svc.yml.j2 similarity index 91% rename from roles/kubernetes-apps/heapster/templates/influxdb-service.yaml rename to roles/kubernetes-apps/heapster/templates/influxdb-svc.yml.j2 index 6b5689d53..e0e17c894 100644 --- a/roles/kubernetes-apps/heapster/templates/influxdb-service.yaml +++ b/roles/kubernetes-apps/heapster/templates/influxdb-svc.yml.j2 @@ -8,7 +8,7 @@ metadata: kubernetes.io/cluster-service: 'true' kubernetes.io/name: monitoring-influxdb name: monitoring-influxdb - namespace: kube-system + namespace: "{{ heapster_namespace }}" spec: ports: - port: 8086