From 9d0b2eed6f2b897280660949d12e09a3b7993b2b Mon Sep 17 00:00:00 2001 From: Jeff Cantrill Date: Thu, 15 Dec 2016 10:34:58 -0500 Subject: rename variables to be less extraneous (#10) --- roles/openshift_metrics/README.md | 10 ++++++---- roles/openshift_metrics/defaults/main.yaml | 10 ++++++---- roles/openshift_metrics/tasks/install_hawkular.yaml | 21 ++++++++++++--------- roles/openshift_metrics/tasks/main.yaml | 6 +++--- .../templates/hawkular_cassandra_rc.j2 | 4 ++-- roles/openshift_metrics/vars/main.yaml | 2 +- 6 files changed, 30 insertions(+), 23 deletions(-) (limited to 'roles/openshift_metrics') diff --git a/roles/openshift_metrics/README.md b/roles/openshift_metrics/README.md index 092844870..d1b9a79a9 100644 --- a/roles/openshift_metrics/README.md +++ b/roles/openshift_metrics/README.md @@ -33,18 +33,20 @@ For default values, see [`defaults/main.yaml`](defaults/main.yaml). any user will be able to write metrics to the system which can affect performance and use Cassandra disk usage to unpredictably increase. -- `openshift_metrics_hawkular_cassandra_nodes`: The number of Cassandra Nodes to deploy for the +- `openshift_metrics_hawkular_replicas:` The number of replicas for Hawkular metrics. + +- `openshift_metrics_cassandra_nodes`: The number of Cassandra Nodes to deploy for the initial cluster. -- `openshift_metrics_hawkular_cassandra_storage_type`: Use `emptydir` for ephemeral storage (for +- `openshift_metrics_cassandra_storage_type`: Use `emptydir` for ephemeral storage (for testing), `pv` to use persistent volumes (which need to be created before the installation) or `dynamic` for dynamic persistent volumes. -- `openshift_metrics_hawkular_cassandra_pv_prefix`: The name of persistent volume claims created +- `openshift_metrics_cassandra_pv_prefix`: The name of persistent volume claims created for cassandra will be this with a serial number appended to the end, starting from 1. -- `openshift_metrics_hawkular_cassandra_pv_size`: The persistent volume size for each of the +- `openshift_metrics_cassandra_pv_size`: The persistent volume size for each of the Cassandra nodes. - `openshift_metrics_heapster_standalone`: Deploy only heapster, without the Hawkular Metrics and diff --git a/roles/openshift_metrics/defaults/main.yaml b/roles/openshift_metrics/defaults/main.yaml index 7f9a5f36a..4538099a3 100644 --- a/roles/openshift_metrics/defaults/main.yaml +++ b/roles/openshift_metrics/defaults/main.yaml @@ -7,10 +7,12 @@ openshift_metrics_project: openshift-infra openshift_metrics_startup_timeout: 500 openshift_metrics_hawkular_user_write_access: False -openshift_metrics_hawkular_cassandra_nodes: 1 -openshift_metrics_hawkular_cassandra_storage_type: emptydir -openshift_metrics_hawkular_cassandra_pv_prefix: metrics-cassandra -openshift_metrics_hawkular_cassandra_pv_size: 10Gi +openshift_metrics_hawkular_replicas: 1 + +openshift_metrics_cassandra_nodes: 1 +openshift_metrics_cassandra_storage_type: emptydir +openshift_metrics_cassandra_pv_prefix: metrics-cassandra +openshift_metrics_cassandra_pv_size: 10Gi openshift_metrics_certs_dir: "{{ openshift.common.config_base }}/master/metrics" openshift_metrics_heapster_standalone: False diff --git a/roles/openshift_metrics/tasks/install_hawkular.yaml b/roles/openshift_metrics/tasks/install_hawkular.yaml index d7a029fa8..6e503c8c1 100644 --- a/roles/openshift_metrics/tasks/install_hawkular.yaml +++ b/roles/openshift_metrics/tasks/install_hawkular.yaml @@ -10,35 +10,38 @@ vars: node: "{{ item }}" master: "{{ (item == '1')|string|lower }}" - with_sequence: count={{ openshift_metrics_hawkular_cassandra_nodes }} + with_sequence: count={{ openshift_metrics_cassandra_nodes }} + - name: generate hawkular-cassandra persistent volume claims template: src: pvc.j2 dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-pvc{{ item }}.yaml" vars: - obj_name: "{{ openshift_metrics_hawkular_cassandra_pv_prefix }}-{{ item }}" + obj_name: "{{ openshift_metrics_cassandra_pv_prefix }}-{{ item }}" labels: metrics-infra: hawkular-cassandra access_modes: - ReadWriteOnce - size: "{{ openshift_metrics_hawkular_cassandra_pv_size }}" - with_sequence: count={{ openshift_metrics_hawkular_cassandra_nodes }} - when: openshift_metrics_hawkular_cassandra_storage_type == 'pv' + size: "{{ openshift_metrics_cassandra_pv_size }}" + with_sequence: count={{ openshift_metrics_cassandra_nodes }} + when: openshift_metrics_cassandra_storage_type == 'pv' + - name: generate hawkular-cassandra persistent volume claims (dynamic) template: src: pvc.j2 dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-pvc{{ item }}.yaml" vars: - obj_name: "{{ openshift_metrics_hawkular_cassandra_pv_prefix }}-{{ item }}" + obj_name: "{{ openshift_metrics_cassandra_pv_prefix }}-{{ item }}" labels: metrics-infra: hawkular-cassandra annotations: volume.alpha.kubernetes.io/storage-class: dynamic access_modes: - ReadWriteOnce - size: "{{ openshift_metrics_hawkular_cassandra_pv_size }}" - with_sequence: count={{ openshift_metrics_hawkular_cassandra_nodes }} - when: openshift_metrics_hawkular_cassandra_storage_type == 'dynamic' + size: "{{ openshift_metrics_cassandra_pv_size }}" + with_sequence: count={{ openshift_metrics_cassandra_nodes }} + when: openshift_metrics_cassandra_storage_type == 'dynamic' + - name: read hawkular-metrics route destination ca certificate slurp: src={{ openshift_metrics_certs_dir }}/ca.crt register: metrics_route_dest_ca_cert diff --git a/roles/openshift_metrics/tasks/main.yaml b/roles/openshift_metrics/tasks/main.yaml index d4bafdc30..74abd120f 100644 --- a/roles/openshift_metrics/tasks/main.yaml +++ b/roles/openshift_metrics/tasks/main.yaml @@ -3,12 +3,12 @@ fail: msg='the openshift_metrics_hawkular_metrics_hostname variable is required' when: openshift_metrics_hawkular_metrics_hostname is not defined -- name: check the value of openshift_metrics_hawkular_cassandra_storage_type +- name: check the value of openshift_metrics_cassandra_storage_type fail: msg: > - openshift_metrics_hawkular_cassandra_storage_type ({{ openshift_metrics_hawkular_cassandra_storage_type }}) + openshift_metrics_cassandra_storage_type ({{ openshift_metrics_cassandra_storage_type }}) is invalid, must be one of: emptydir, pv, dynamic - when: openshift_metrics_hawkular_cassandra_storage_type not in openshift_metrics_hawkular_cassandra_storage_types + when: openshift_metrics_cassandra_storage_type not in openshift_metrics_cassandra_storage_types - name: Create temp directory for doing work in command: mktemp -td openshift-metrics-ansible-XXXXXX diff --git a/roles/openshift_metrics/templates/hawkular_cassandra_rc.j2 b/roles/openshift_metrics/templates/hawkular_cassandra_rc.j2 index 158d0d1a3..7cea5f040 100644 --- a/roles/openshift_metrics/templates/hawkular_cassandra_rc.j2 +++ b/roles/openshift_metrics/templates/hawkular_cassandra_rc.j2 @@ -85,11 +85,11 @@ spec: terminationGracePeriodSeconds: 1800 volumes: - name: cassandra-data -{% if openshift_metrics_hawkular_cassandra_storage_type == 'emptydir' %} +{% if openshift_metrics_cassandra_storage_type == 'emptydir' %} emptyDir: {} {% else %} persistentVolumeClaim: - claimName: "{{ openshift_metrics_hawkular_cassandra_pv_prefix }}-{{ node }}" + claimName: "{{ openshift_metrics_cassandra_pv_prefix }}-{{ node }}" {% endif %} - name: hawkular-cassandra-secrets secret: diff --git a/roles/openshift_metrics/vars/main.yaml b/roles/openshift_metrics/vars/main.yaml index 25307c23c..de3bb878d 100644 --- a/roles/openshift_metrics/vars/main.yaml +++ b/roles/openshift_metrics/vars/main.yaml @@ -1,4 +1,4 @@ -openshift_metrics_hawkular_cassandra_storage_types: +openshift_metrics_cassandra_storage_types: - emptydir - pv - dynamic -- cgit v1.2.3