Browse Source

Merge pull request #3558 from ewolinetz/logging_metrics_defaults

Adding some more logging and metrics defaults
Scott Dodson 8 years ago
parent
commit
766128bf66

+ 21 - 8
roles/openshift_logging/defaults/main.yml

@@ -1,11 +1,12 @@
 ---
 openshift_logging_image_prefix: "{{ openshift_hosted_logging_deployer_prefix | default('docker.io/openshift/origin-') }}"
 openshift_logging_image_version: "{{ openshift_hosted_logging_deployer_version | default('latest') }}"
-openshift_logging_use_ops: False
+openshift_logging_use_ops: "{{ openshift_hosted_logging_enable_ops_cluster | default('false') | bool }}"
 openshift_logging_master_url: "https://kubernetes.default.svc.{{ openshift.common.dns_domain }}"
 openshift_logging_master_public_url: "{{ openshift_hosted_logging_master_public_url | default('https://' + openshift.common.public_hostname + ':' + openshift.master.api_port) }}"
 openshift_logging_namespace: logging
 openshift_logging_install_logging: True
+openshift_logging_image_pull_secret: "{{ openshift_hosted_logging_image_pull_secret | default('') }}"
 
 openshift_logging_curator_default_days: 30
 openshift_logging_curator_run_hour: 0
@@ -15,9 +16,11 @@ openshift_logging_curator_script_log_level: INFO
 openshift_logging_curator_log_level: ERROR
 openshift_logging_curator_cpu_limit: 100m
 openshift_logging_curator_memory_limit: null
+openshift_logging_curator_nodeselector: "{{ openshift_hosted_logging_curator_nodeselector | default('') | map_from_pairs }}"
 
 openshift_logging_curator_ops_cpu_limit: 100m
 openshift_logging_curator_ops_memory_limit: null
+openshift_logging_curator_ops_nodeselector: "{{ openshift_hosted_logging_curator_ops_nodeselector | default('') | map_from_pairs }}"
 
 openshift_logging_kibana_hostname: "{{ openshift_hosted_logging_hostname | default('kibana.' + openshift.common.dns_domain) }}"
 openshift_logging_kibana_cpu_limit: null
@@ -28,6 +31,9 @@ openshift_logging_kibana_proxy_memory_limit: null
 openshift_logging_kibana_replica_count: 1
 openshift_logging_kibana_edge_term_policy: Redirect
 
+openshift_logging_kibana_nodeselector: "{{ openshift_hosted_logging_kibana_nodeselector | default('') | map_from_pairs }}"
+openshift_logging_kibana_ops_nodeselector: "{{ openshift_hosted_logging_kibana_ops_nodeselector | default('') | map_from_pairs }}"
+
 #The absolute path on the control node to the cert file to use
 #for the public facing kibana certs
 openshift_logging_kibana_cert: ""
@@ -48,12 +54,13 @@ openshift_logging_kibana_ops_proxy_cpu_limit: null
 openshift_logging_kibana_ops_proxy_memory_limit: null
 openshift_logging_kibana_ops_replica_count: 1
 
-openshift_logging_fluentd_nodeselector: {'logging-infra-fluentd': 'true'}
+openshift_logging_fluentd_nodeselector: "{{ openshift_hosted_logging_fluentd_nodeselector_label | default('logging-infra-fluentd=true') | map_from_pairs }}"
 openshift_logging_fluentd_cpu_limit: 100m
 openshift_logging_fluentd_memory_limit: 512Mi
 openshift_logging_fluentd_es_copy: false
-openshift_logging_fluentd_use_journal: ''
-openshift_logging_fluentd_journal_read_from_head: ''
+openshift_logging_fluentd_use_journal: "{{ openshift_hosted_logging_use_journal | default('') }}"
+openshift_logging_fluentd_journal_source: "{{ openshift_hosted_logging_journal_source | default('') }}"
+openshift_logging_fluentd_journal_read_from_head: "{{ openshift_hosted_logging_journal_read_from_head | default('') }}"
 openshift_logging_fluentd_hosts: ['--all']
 
 openshift_logging_es_host: logging-es
@@ -63,13 +70,14 @@ openshift_logging_es_client_cert: /etc/fluent/keys/cert
 openshift_logging_es_client_key: /etc/fluent/keys/key
 openshift_logging_es_cluster_size: "{{ openshift_hosted_logging_elasticsearch_cluster_size | default(1) }}"
 openshift_logging_es_cpu_limit: null
-openshift_logging_es_memory_limit: 8Gi
+openshift_logging_es_memory_limit: "{{ openshift_hosted_logging_elasticsearch_instance_ram | default('8Gi') }}"
 openshift_logging_es_pv_selector: null
 openshift_logging_es_pvc_dynamic: "{{ openshift_hosted_logging_elasticsearch_pvc_dynamic | default(False) }}"
 openshift_logging_es_pvc_size: "{{ openshift_hosted_logging_elasticsearch_pvc_size | default('') }}"
 openshift_logging_es_pvc_prefix: "{{ openshift_hosted_logging_elasticsearch_pvc_prefix | default('logging-es') }}"
 openshift_logging_es_recover_after_time: 5m
-openshift_logging_es_storage_group: 65534
+openshift_logging_es_storage_group: "{{ openshift_hosted_logging_elasticsearch_storage_group | default('65534') }}"
+openshift_logging_es_nodeselector: "{{ openshift_hosted_logging_elasticsearch_nodeselector | default('') | map_from_pairs }}"
 
 # allow cluster-admin or cluster-reader to view operations index
 openshift_logging_es_ops_allow_cluster_reader: False
@@ -81,13 +89,18 @@ openshift_logging_es_ops_client_cert: /etc/fluent/keys/cert
 openshift_logging_es_ops_client_key: /etc/fluent/keys/key
 openshift_logging_es_ops_cluster_size: "{{ openshift_hosted_logging_elasticsearch_ops_cluster_size | default(1) }}"
 openshift_logging_es_ops_cpu_limit: null
-openshift_logging_es_ops_memory_limit: 8Gi
+openshift_logging_es_ops_memory_limit: "{{ openshift_hosted_logging_elasticsearch_ops_instance_ram | default('8Gi') }}"
 openshift_logging_es_ops_pv_selector: None
 openshift_logging_es_ops_pvc_dynamic: "{{ openshift_hosted_logging_elasticsearch_ops_pvc_dynamic | default(False) }}"
 openshift_logging_es_ops_pvc_size: "{{ openshift_hosted_logging_elasticsearch_ops_pvc_size | default('') }}"
 openshift_logging_es_ops_pvc_prefix: "{{ openshift_hosted_logging_elasticsearch_ops_pvc_prefix | default('logging-es-ops') }}"
 openshift_logging_es_ops_recover_after_time: 5m
-openshift_logging_es_ops_storage_group: 65534
+openshift_logging_es_ops_storage_group: "{{ openshift_hosted_logging_elasticsearch_storage_group | default('65534') }}"
+openshift_logging_es_ops_nodeselector: "{{ openshift_hosted_logging_elasticsearch_ops_nodeselector | default('') | map_from_pairs }}"
+
+# storage related defaults
+openshift_logging_storage_access_modes: "{{ openshift_hosted_logging_storage_access_modes | default('ReadWriteOnce') }}"
+
 
 # following can be uncommented to provide values for configmaps -- take care when providing file contents as it may cause your cluster to not operate correctly
 #es_logging_contents:

+ 8 - 0
roles/openshift_logging/filter_plugins/openshift_logging.py

@@ -25,6 +25,13 @@ def entry_from_named_pair(register_pairs, key):
     raise RuntimeError("There was no entry found in the dict that had an item with a name that matched {}".format(key))
 
 
+def map_from_pairs(source, delim="="):
+    ''' Returns a dict given the source and delim delimited '''
+    if source == '':
+      return dict()
+
+    return dict(source.split(delim) for item in source.split(","))
+
 # pylint: disable=too-few-public-methods
 class FilterModule(object):
     ''' OpenShift Logging Filters '''
@@ -35,4 +42,5 @@ class FilterModule(object):
         return {
             'random_word': random_word,
             'entry_from_named_pair': entry_from_named_pair,
+            'map_from_pairs': map_from_pairs,
         }

+ 3 - 3
roles/openshift_logging/tasks/generate_pvcs.yaml

@@ -6,8 +6,8 @@
     start: "{{es_pvc_names | map('regex_search', es_pvc_prefix+'.*')|select('string')|list|length}}"
   with_sequence: start={{start}} end={{ (start|int > es_cluster_size|int - 1) | ternary(start, es_cluster_size|int - 1)}}
   when:
+    - "{{ es_dc_names|default([]) | length <= es_cluster_size|int }}"
     - es_pvc_size | search('^\d.*')
-    - "{{ es_dc_names|default([]) | length < es_cluster_size|int }}"
   check_mode: no
 
 - name: Generating PersistentVolumeClaims
@@ -16,7 +16,7 @@
     obj_name: "{{claim_name}}"
     size: "{{es_pvc_size}}"
     access_modes:
-      - ReadWriteOnce
+      - "{{ es_access_modes }}"
     pv_selector: "{{es_pv_selector}}"
   with_items:
     - "{{es_pvc_pool | default([])}}"
@@ -36,7 +36,7 @@
       volume.alpha.kubernetes.io/storage-class: "dynamic"
     size: "{{es_pvc_size}}"
     access_modes:
-      - ReadWriteOnce
+      - "{{ es_access_modes }}"
     pv_selector: "{{es_pv_selector}}"
   with_items:
     - "{{es_pvc_pool|default([])}}"

+ 1 - 1
roles/openshift_logging/tasks/install_curator.yaml

@@ -31,7 +31,7 @@
     curator_cpu_limit: "{{openshift_logging_curator_cpu_limit }}"
     curator_memory_limit: "{{openshift_logging_curator_memory_limit }}"
     replicas: "{{curator_replica_count.stdout | default (0)}}"
-    curator_node_selector: "{{openshift_logging_curator_nodeselector | default({}) }}"
+    curator_node_selector: "{{openshift_logging_curator_nodeselector | default({})}}"
   check_mode: no
   changed_when: no
 

+ 4 - 2
roles/openshift_logging/tasks/install_elasticsearch.yaml

@@ -12,6 +12,7 @@
     es_pvc_size: "{{openshift_logging_es_pvc_size}}"
     es_dc_names: "{{openshift_logging_facts.elasticsearch.deploymentconfigs.keys()}}"
     es_cluster_size: "{{openshift_logging_es_cluster_size}}"
+    es_access_modes: "{{ openshift_logging_storage_access_modes }}"
 
 # we should initialize the es_dc_pool with the current keys
 - name: Init pool of DeploymentConfig names for Elasticsearch
@@ -44,7 +45,7 @@
     volume_names: "{{es_pvc_pool | default([])}}"
     pvc_claim: "{{(volume_names | length > item.0) | ternary(volume_names[item.0], None)}}"
     deploy_name: "{{item.1}}"
-    es_node_selector: "{{openshift_logging_es_nodeselector | default({})}}"
+    es_node_selector: "{{openshift_logging_es_nodeselector | default({}) }}"
   with_indexed_items:
     - "{{ es_dc_pool }}"
   check_mode: no
@@ -77,6 +78,7 @@
     es_cluster_size: "{{openshift_logging_es_ops_cluster_size|int}}"
     es_pvc_dynamic: "{{openshift_logging_es_ops_pvc_dynamic | bool}}"
     es_pv_selector: "{{openshift_logging_es_ops_pv_selector}}"
+    es_access_modes: "{{ openshift_logging_storage_access_modes }}"
   when:
     - openshift_logging_use_ops | bool
   check_mode: no
@@ -119,7 +121,7 @@
     es_recover_after_nodes: "{{es_ops_recover_after_nodes}}"
     es_recover_expected_nodes: "{{es_ops_recover_expected_nodes}}"
     openshift_logging_es_recover_after_time: "{{openshift_logging_es_ops_recover_after_time}}"
-    es_node_selector: "{{openshift_logging_es_ops_nodeselector | default({})}}"
+    es_node_selector: "{{openshift_logging_es_ops_nodeselector | default({}) | map_from_pairs }}"
   with_indexed_items:
     - "{{ es_ops_dc_pool | default([]) }}"
   when:

+ 2 - 2
roles/openshift_logging/tasks/install_kibana.yaml

@@ -35,7 +35,7 @@
     kibana_proxy_cpu_limit: "{{openshift_logging_kibana_proxy_cpu_limit }}"
     kibana_proxy_memory_limit: "{{openshift_logging_kibana_proxy_memory_limit }}"
     replicas: "{{kibana_replica_count.stdout | default (0)}}"
-    kibana_node_selector: "{{openshift_logging_kibana_nodeselector | default({}) }}"
+    kibana_node_selector: "{{openshift_logging_kibana_nodeselector | default({})}}"
   check_mode: no
   changed_when: no
 
@@ -54,7 +54,7 @@
     kibana_proxy_cpu_limit: "{{openshift_logging_kibana_ops_proxy_cpu_limit }}"
     kibana_proxy_memory_limit: "{{openshift_logging_kibana_ops_proxy_memory_limit }}"
     replicas: "{{kibana_ops_replica_count.stdout | default (0)}}"
-    kibana_node_selector: "{{openshift_logging_kibana_ops_nodeselector | default({}) }}"
+    kibana_node_selector: "{{openshift_logging_kibana_ops_nodeselector | default({})}}"
   when: openshift_logging_use_ops | bool
   check_mode: no
   changed_when: no

+ 3 - 1
roles/openshift_logging/tasks/install_logging.yaml

@@ -76,7 +76,9 @@
   register: link_pull_secret
   loop_control:
     loop_var: sa_account
-  when: openshift_logging_image_pull_secret is defined
+  when:
+  - openshift_logging_image_pull_secret is defined
+  - openshift_logging_image_pull_secret != ''
   failed_when: link_pull_secret.rc != 0
 
 - name: Scaling up cluster

+ 1 - 1
roles/openshift_logging/templates/fluentd.j2

@@ -119,7 +119,7 @@ spec:
         - name: "USE_JOURNAL"
           value: "{{openshift_logging_fluentd_use_journal|lower}}"
         - name: "JOURNAL_SOURCE"
-          value: "{{fluentd_journal_source | default('')}}"
+          value: "{{openshift_logging_fluentd_journal_source | default('')}}"
         - name: "JOURNAL_READ_FROM_HEAD"
           value: "{{openshift_logging_fluentd_journal_read_from_head|lower}}"
       volumes:

+ 4 - 3
roles/openshift_metrics/defaults/main.yaml

@@ -16,8 +16,8 @@ openshift_metrics_hawkular_ca: ""
 openshift_metrics_hawkular_nodeselector: ""
 
 openshift_metrics_cassandra_replicas: 1
-openshift_metrics_cassandra_storage_type: emptydir
-openshift_metrics_cassandra_pvc_size: 10Gi
+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_limits_memory: 2G
 openshift_metrics_cassandra_limits_cpu: null
 openshift_metrics_cassandra_requests_memory: 1G
@@ -46,7 +46,8 @@ openshift_metrics_master_url: https://kubernetes.default.svc.cluster.local
 openshift_metrics_node_id: nodename
 openshift_metrics_project: openshift-infra
 
-openshift_metrics_cassandra_pvc_prefix: metrics-cassandra
+openshift_metrics_cassandra_pvc_prefix: "{{ openshift_hosted_metrics_storage_volume_name | default('metrics-cassandra') }}"
+openshift_metrics_cassandra_pvc_access: "{{ openshift_hosted_metrics_storage_access_modes | default('ReadWriteOnce') }}"
 
 openshift_metrics_hawkular_user_write_access: False
 

+ 5 - 3
roles/openshift_metrics/tasks/install_cassandra.yaml

@@ -31,10 +31,12 @@
     labels:
       metrics-infra: hawkular-cassandra
     access_modes:
-    - ReadWriteOnce
+    - "{{ openshift_metrics_cassandra_pvc_access }}"
     size: "{{ openshift_metrics_cassandra_pvc_size }}"
   with_sequence: count={{ openshift_metrics_cassandra_replicas }}
-  when: openshift_metrics_cassandra_storage_type == 'pv'
+  when:
+  - openshift_metrics_cassandra_storage_type != 'emptydir'
+  - openshift_metrics_cassandra_storage_type != 'dynamic'
   changed_when: false
 
 - name: generate hawkular-cassandra persistent volume claims (dynamic)
@@ -48,7 +50,7 @@
     annotations:
       volume.alpha.kubernetes.io/storage-class: dynamic
     access_modes:
-    - ReadWriteOnce
+    - "{{ openshift_metrics_cassandra_pvc_access }}"
     size: "{{ openshift_metrics_cassandra_pvc_size }}"
   with_sequence: count={{ openshift_metrics_cassandra_replicas }}
   when: openshift_metrics_cassandra_storage_type == 'dynamic'