From 6b195d71b6c9133490570106e76a528ea67177a2 Mon Sep 17 00:00:00 2001 From: Simon Stone Date: Tue, 2 Jun 2020 15:46:24 +0100 Subject: [PATCH] Extend console role so you can specify zones (resolves #249) Signed-off-by: Simon Stone --- docs/source/roles/console.rst | 9 ++++++++- roles/console/defaults/main.yml | 2 ++ roles/console/templates/k8s/console.yml.j2 | 11 ++++++++++- roles/console/templates/openshift/console.yml.j2 | 11 ++++++++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/docs/source/roles/console.rst b/docs/source/roles/console.rst index 26e61db5..9d6c7afd 100644 --- a/docs/source/roles/console.rst +++ b/docs/source/roles/console.rst @@ -144,7 +144,7 @@ Parameters If specified this secret must already exist in the specified Kubernetes namespace or Red Hat OpenShift project and must contain the TLS certificate and private key that the console will use. - If not specified the console will generate it's own self-signed certificates + If not specified the console will generate it's own self-signed certificates. product_version (optional, str, 2.1.3) The version of IBM Blockchain Platform to use. @@ -154,6 +154,13 @@ Parameters The image tag used for the IBM Blockchain Platform operator is *product_version*-*operator_version*-*arch*, for example ``2.1.3-20200416-amd64``. + zones (optional, list, None) + The list of Kubernetes zones that this console can deploy components into. + + If you do not specify a list of Kubernetes zones, and multiple Kubernetes zones are available, then a random Kubernetes zone will be selected for you when you attempt to create any components. + + See the Kubernetes documentation for more information: https://kubernetes.io/docs/setup/best-practices/multiple-zones/ + wait_timeout (optional, str, 60) The timeout, in seconds, to wait until the console is available. diff --git a/roles/console/defaults/main.yml b/roles/console/defaults/main.yml index e17f0f65..3365da14 100644 --- a/roles/console/defaults/main.yml +++ b/roles/console/defaults/main.yml @@ -34,3 +34,5 @@ wait_timeout: 60 product_version: "2.1.3" operator_version: "20200520" +# console_tls_secret: ibp-tls-secret +# zones: [] diff --git a/roles/console/templates/k8s/console.yml.j2 b/roles/console/templates/k8s/console.yml.j2 index 5586cac5..9f2f9527 100644 --- a/roles/console/templates/k8s/console.yml.j2 +++ b/roles/console/templates/k8s/console.yml.j2 @@ -21,4 +21,13 @@ spec: console: class: "{{ console_storage_class }}" size: "{{ console_storage_size }}" - tlsSecretName: "{{ console_tls_secret | default('') }}" +{%+ if console_tls_secret is defined %} + tlsSecretName: "{{ console_tls_secret }}" +{% endif %} +{%+ if zones is defined %} + clusterdata: + zones: +{%+ for zone in zones %} + - "{{ zone }}" +{% endfor %} +{% endif %} diff --git a/roles/console/templates/openshift/console.yml.j2 b/roles/console/templates/openshift/console.yml.j2 index 5586cac5..9f2f9527 100644 --- a/roles/console/templates/openshift/console.yml.j2 +++ b/roles/console/templates/openshift/console.yml.j2 @@ -21,4 +21,13 @@ spec: console: class: "{{ console_storage_class }}" size: "{{ console_storage_size }}" - tlsSecretName: "{{ console_tls_secret | default('') }}" +{%+ if console_tls_secret is defined %} + tlsSecretName: "{{ console_tls_secret }}" +{% endif %} +{%+ if zones is defined %} + clusterdata: + zones: +{%+ for zone in zones %} + - "{{ zone }}" +{% endfor %} +{% endif %}