diff options
author | ewolinetz <ewolinet@redhat.com> | 2017-05-24 11:10:00 -0500 |
---|---|---|
committer | ewolinetz <ewolinet@redhat.com> | 2017-05-26 17:21:50 -0500 |
commit | 44227c5bf81d6e95882ed96179eebc5d7900d423 (patch) | |
tree | 7dd7cea85b6defbc82b773fc09f38ced9a76237e /roles/openshift_metrics | |
parent | 8c57b7f62f6351d03c1e28d7cff88279fc16f88a (diff) | |
download | openshift-44227c5bf81d6e95882ed96179eebc5d7900d423.tar.gz openshift-44227c5bf81d6e95882ed96179eebc5d7900d423.tar.bz2 openshift-44227c5bf81d6e95882ed96179eebc5d7900d423.tar.xz openshift-44227c5bf81d6e95882ed96179eebc5d7900d423.zip |
Allowing openshift_metrics to specify PV selectors and allow way to define selectors when creating pv
Diffstat (limited to 'roles/openshift_metrics')
-rw-r--r-- | roles/openshift_metrics/defaults/main.yaml | 1 | ||||
-rw-r--r-- | roles/openshift_metrics/tasks/install_cassandra.yaml | 4 | ||||
-rw-r--r-- | roles/openshift_metrics/templates/pvc.j2 | 7 |
3 files changed, 11 insertions, 1 deletions
diff --git a/roles/openshift_metrics/defaults/main.yaml b/roles/openshift_metrics/defaults/main.yaml index 1d3db8a1a..467db34c8 100644 --- a/roles/openshift_metrics/defaults/main.yaml +++ b/roles/openshift_metrics/defaults/main.yaml @@ -16,6 +16,7 @@ openshift_metrics_hawkular_nodeselector: "" openshift_metrics_cassandra_replicas: 1 openshift_metrics_cassandra_storage_type: "{{ openshift_hosted_metrics_storage_kind | default('emptydir') }}" openshift_metrics_cassandra_pvc_size: "{{ openshift_hosted_metrics_storage_volume_size | default('10Gi') }}" +openshift_metrics_cassandra_pv_selector: "{{ openshift_hosted_metrics_storage_labels | default(null) }}" openshift_metrics_cassandra_limits_memory: 2G openshift_metrics_cassandra_limits_cpu: null openshift_metrics_cassandra_requests_memory: 1G diff --git a/roles/openshift_metrics/tasks/install_cassandra.yaml b/roles/openshift_metrics/tasks/install_cassandra.yaml index 3b4e8560f..4f760c70c 100644 --- a/roles/openshift_metrics/tasks/install_cassandra.yaml +++ b/roles/openshift_metrics/tasks/install_cassandra.yaml @@ -23,7 +23,7 @@ changed_when: false - set_fact: openshift_metrics_cassandra_pvc_prefix="hawkular-metrics" - when: not openshift_metrics_cassandra_pvc_prefix or openshift_metrics_cassandra_pvc_prefix == '' + when: "not openshift_metrics_cassandra_pvc_prefix or openshift_metrics_cassandra_pvc_prefix == ''" - name: generate hawkular-cassandra persistent volume claims template: @@ -35,6 +35,7 @@ metrics-infra: hawkular-cassandra access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}" size: "{{ openshift_metrics_cassandra_pvc_size }}" + pv_selector: "{{ openshift_metrics_cassandra_pv_selector }}" with_sequence: count={{ openshift_metrics_cassandra_replicas }} when: - openshift_metrics_cassandra_storage_type != 'emptydir' @@ -53,6 +54,7 @@ volume.alpha.kubernetes.io/storage-class: dynamic access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}" size: "{{ openshift_metrics_cassandra_pvc_size }}" + pv_selector: "{{ openshift_metrics_cassandra_pv_selector }}" with_sequence: count={{ openshift_metrics_cassandra_replicas }} when: openshift_metrics_cassandra_storage_type == 'dynamic' changed_when: false diff --git a/roles/openshift_metrics/templates/pvc.j2 b/roles/openshift_metrics/templates/pvc.j2 index c2e56ba21..0b801b33f 100644 --- a/roles/openshift_metrics/templates/pvc.j2 +++ b/roles/openshift_metrics/templates/pvc.j2 @@ -18,6 +18,13 @@ metadata: {% endfor %} {% endif %} spec: +{% if pv_selector is defined and pv_selector is mapping %} + selector: + matchLabels: +{% for key,value in pv_selector.iteritems() %} + {{key}}: {{value}} +{% endfor %} +{% endif %} accessModes: {% for mode in access_modes %} - {{ mode }} |