From d893eadfbceceacdf8c1ee2dbb0f25c4ea2a99c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Suchomel?= Date: Mon, 7 Oct 2019 16:11:31 +0200 Subject: [PATCH] Merge component, developer and multinode ingress deployment scripts For simplification of deployment and maintenance, reduce the number of scripts that do usually the same. The important part is that when user wants to do multinode deployment, OSH_DEPLOY_MULTINODE variable must be set before executing the script. For now multinone script still stays, only to invoke the common one, but in future it would be better to remove multinode scripts completely and let user call the common script with the right argument. Change-Id: I4dca159827581cbe8d6ded3be85e732acbf60ed1 --- .../developer/kubernetes-and-common-setup.rst | 4 +- doc/source/install/multinode.rst | 8 +- tools/deployment/component/common/ingress.sh | 39 +++++++++- .../developer/common/030-ingress.sh | 73 +------------------ tools/deployment/multinode/020-ingress.sh | 50 +------------ tools/gate/playbooks/multinode-deploy.yaml | 3 +- .../playbooks/multinode-tempest-deploy.yaml | 4 +- 7 files changed, 52 insertions(+), 129 deletions(-) mode change 100755 => 120000 tools/deployment/developer/common/030-ingress.sh diff --git a/doc/source/install/developer/kubernetes-and-common-setup.rst b/doc/source/install/developer/kubernetes-and-common-setup.rst index 7f08f0984a..40781242c7 100644 --- a/doc/source/install/developer/kubernetes-and-common-setup.rst +++ b/doc/source/install/developer/kubernetes-and-common-setup.rst @@ -79,7 +79,7 @@ Alternatively, this step can be performed by running the script directly: Deploy the ingress controller ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. literalinclude:: ../../../../tools/deployment/developer/common/030-ingress.sh +.. literalinclude:: ../../../../tools/deployment/component/common/ingress.sh :language: shell :lines: 1,17- @@ -87,4 +87,4 @@ Alternatively, this step can be performed by running the script directly: .. code-block:: shell - ./tools/deployment/developer/common/030-ingress.sh + ./tools/deployment/developer/component/common/ingress.sh diff --git a/doc/source/install/multinode.rst b/doc/source/install/multinode.rst index bdd114e12b..49c266c7ae 100644 --- a/doc/source/install/multinode.rst +++ b/doc/source/install/multinode.rst @@ -90,7 +90,11 @@ Alternatively, this step can be performed by running the script directly: Deploy the ingress controller ----------------------------- -.. literalinclude:: ../../../tools/deployment/multinode/020-ingress.sh +.. code-block:: shell + + export OSH_DEPLOY_MULTINODE=True + +.. literalinclude:: ../../../tools/deployment/component/common/ingress.sh :language: shell :lines: 1,17- @@ -98,7 +102,7 @@ Alternatively, this step can be performed by running the script directly: .. code-block:: shell - ./tools/deployment/multinode/020-ingress.sh + OSH_DEPLOY_MULTINODE=True ./tools/deployment/component/common/ingress.sh Deploy Ceph diff --git a/tools/deployment/component/common/ingress.sh b/tools/deployment/component/common/ingress.sh index f571805bcf..75d3bdeaa2 100755 --- a/tools/deployment/component/common/ingress.sh +++ b/tools/deployment/component/common/ingress.sh @@ -24,6 +24,7 @@ export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../open make -C ${HELM_CHART_ROOT_PATH} ingress #NOTE: Deploy command +: ${OSH_EXTRA_HELM_ARGS:=""} tee /tmp/ingress-kube-system.yaml << EOF deployment: mode: cluster @@ -31,10 +32,28 @@ deployment: network: host_namespace: true EOF + +touch /tmp/ingress-component.yaml + +if [ -n "${OSH_DEPLOY_MULTINODE}" ]; then + tee --append /tmp/ingress-kube-system.yaml << EOF +pod: + replicas: + error_page: 2 +EOF + + tee /tmp/ingress-component.yaml << EOF +pod: + replicas: + ingress: 2 + error_page: 2 +EOF +fi + helm upgrade --install ingress-kube-system ${HELM_CHART_ROOT_PATH}/ingress \ --namespace=kube-system \ --values=/tmp/ingress-kube-system.yaml \ - ${OSH_EXTRA_HELM_ARGS:=} \ + ${OSH_EXTRA_HELM_ARGS} \ ${OSH_EXTRA_HELM_ARGS_INGRESS} \ ${OSH_EXTRA_HELM_ARGS_INGRESS_KUBE_SYSTEM} @@ -45,9 +64,10 @@ helm upgrade --install ingress-kube-system ${HELM_CHART_ROOT_PATH}/ingress \ helm status ingress-kube-system #NOTE: Deploy namespace ingress -helm upgrade --install ingress-openstack ${OSH_INFRA_PATH}/ingress \ +helm upgrade --install ingress-openstack ${HELM_CHART_ROOT_PATH}/ingress \ --namespace=openstack \ - ${OSH_EXTRA_HELM_ARGS:=} \ + --values=/tmp/ingress-component.yaml \ + ${OSH_EXTRA_HELM_ARGS} \ ${OSH_EXTRA_HELM_ARGS_INGRESS} \ ${OSH_EXTRA_HELM_ARGS_INGRESS_OPENSTACK} @@ -56,3 +76,16 @@ helm upgrade --install ingress-openstack ${OSH_INFRA_PATH}/ingress \ #NOTE: Display info helm status ingress-openstack + +helm upgrade --install ingress-ceph ${HELM_CHART_ROOT_PATH}/ingress \ + --namespace=ceph \ + --values=/tmp/ingress-component.yaml \ + ${OSH_EXTRA_HELM_ARGS} \ + ${OSH_EXTRA_HELM_ARGS_INGRESS} \ + ${OSH_EXTRA_HELM_ARGS_INGRESS_CEPH} + +#NOTE: Wait for deploy +./tools/deployment/common/wait-for-pods.sh ceph + +#NOTE: Display info +helm status ingress-ceph diff --git a/tools/deployment/developer/common/030-ingress.sh b/tools/deployment/developer/common/030-ingress.sh deleted file mode 100755 index a92f94d5fd..0000000000 --- a/tools/deployment/developer/common/030-ingress.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# Copyright 2017 The Openstack-Helm Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -set -xe - -#NOTE: Get the over-rides to use -export HELM_CHART_ROOT_PATH="${HELM_CHART_ROOT_PATH:="${OSH_INFRA_PATH:="../openstack-helm-infra"}"}" -: ${OSH_EXTRA_HELM_ARGS_INGRESS:="$(./tools/deployment/common/get-values-overrides.sh ingress)"} - -#NOTE: Lint and package chart -make -C ${HELM_CHART_ROOT_PATH} ingress - -#NOTE: Deploy command -: ${OSH_EXTRA_HELM_ARGS:=""} -tee /tmp/ingress-kube-system.yaml << EOF -deployment: - mode: cluster - type: DaemonSet -network: - host_namespace: true -EOF -helm upgrade --install ingress-kube-system ${HELM_CHART_ROOT_PATH}/ingress \ - --namespace=kube-system \ - --values=/tmp/ingress-kube-system.yaml \ - ${OSH_EXTRA_HELM_ARGS} \ - ${OSH_EXTRA_HELM_ARGS_INGRESS} \ - ${OSH_EXTRA_HELM_ARGS_INGRESS_KUBE_SYSTEM} - -#NOTE: Wait for deploy -./tools/deployment/common/wait-for-pods.sh kube-system - -#NOTE: Display info -helm status ingress-kube-system - -#NOTE: Deploy namespace ingress -helm upgrade --install ingress-openstack ${HELM_CHART_ROOT_PATH}/ingress \ - --namespace=openstack \ - ${OSH_EXTRA_HELM_ARGS} \ - ${OSH_EXTRA_HELM_ARGS_INGRESS} \ - ${OSH_EXTRA_HELM_ARGS_INGRESS_OPENSTACK} - -#NOTE: Wait for deploy -./tools/deployment/common/wait-for-pods.sh openstack - -#NOTE: Display info -helm status ingress-openstack - - -helm upgrade --install ingress-ceph ${HELM_CHART_ROOT_PATH}/ingress \ - --namespace=ceph \ - ${OSH_EXTRA_HELM_ARGS} \ - ${OSH_EXTRA_HELM_ARGS_INGRESS} \ - ${OSH_EXTRA_HELM_ARGS_INGRESS_CEPH} - -#NOTE: Wait for deploy -./tools/deployment/common/wait-for-pods.sh ceph - -#NOTE: Display info -helm status ingress-ceph diff --git a/tools/deployment/developer/common/030-ingress.sh b/tools/deployment/developer/common/030-ingress.sh new file mode 120000 index 0000000000..7097683624 --- /dev/null +++ b/tools/deployment/developer/common/030-ingress.sh @@ -0,0 +1 @@ +../../component/common/ingress.sh \ No newline at end of file diff --git a/tools/deployment/multinode/020-ingress.sh b/tools/deployment/multinode/020-ingress.sh index 9fc1f82fcc..4a80205839 100755 --- a/tools/deployment/multinode/020-ingress.sh +++ b/tools/deployment/multinode/020-ingress.sh @@ -15,51 +15,5 @@ # under the License. set -xe - -#NOTE: Deploy global ingress -: ${OSH_INFRA_PATH:="../openstack-helm-infra"} -tee /tmp/ingress-kube-system.yaml << EOF -pod: - replicas: - error_page: 2 -deployment: - mode: cluster - type: DaemonSet -network: - host_namespace: true -EOF -helm upgrade --install ingress-kube-system ${OSH_INFRA_PATH}/ingress \ - --namespace=kube-system \ - --values=/tmp/ingress-kube-system.yaml \ - ${OSH_EXTRA_HELM_ARGS} \ - ${OSH_EXTRA_HELM_ARGS_INGRESS_KUBE_SYSTEM} - -#NOTE: Wait for deploy -./tools/deployment/common/wait-for-pods.sh kube-system - -#NOTE: Display info -helm status ingress-kube-system - -#NOTE: Deploy namespaced ingress controllers -for NAMESPACE in openstack ceph; do - # Allow $OSH_EXTRA_HELM_ARGS_INGRESS_ceph and $OSH_EXTRA_HELM_ARGS_INGRESS_openstack overrides - OSH_EXTRA_HELM_ARGS_INGRESS_NAMESPACE="OSH_EXTRA_HELM_ARGS_INGRESS_${NAMESPACE}" - #NOTE: Deploy namespace ingress - tee /tmp/ingress-${NAMESPACE}.yaml << EOF -pod: - replicas: - ingress: 2 - error_page: 2 -EOF - helm upgrade --install ingress-${NAMESPACE} ${OSH_INFRA_PATH}/ingress \ - --namespace=${NAMESPACE} \ - --values=/tmp/ingress-${NAMESPACE}.yaml \ - ${OSH_EXTRA_HELM_ARGS} \ - ${!OSH_EXTRA_HELM_ARGS_INGRESS_NAMESPACE} - - #NOTE: Wait for deploy - ./tools/deployment/common/wait-for-pods.sh ${NAMESPACE} - - #NOTE: Display info - helm status ingress-${NAMESPACE} -done +export OSH_DEPLOY_MULTINODE=True +./tools/deployment/component/common/ingress.sh diff --git a/tools/gate/playbooks/multinode-deploy.yaml b/tools/gate/playbooks/multinode-deploy.yaml index 1e3cffab16..efbde0affb 100644 --- a/tools/gate/playbooks/multinode-deploy.yaml +++ b/tools/gate/playbooks/multinode-deploy.yaml @@ -27,13 +27,14 @@ chdir: "{{ zuul_osh_relative_path | default(zuul.project.src_dir) }}" - name: Deploy Ingress environment: + OSH_DEPLOY_MULTINODE: True OSH_OPENSTACK_RELEASE: "{{ osh_openstack_release }}" OSH_EXTRA_HELM_ARGS: "{{ zuul_osh_extra_helm_args_relative_path | default('') }}" OSH_INFRA_PATH: "{{ zuul_osh_infra_relative_path | default('') }}" zuul_site_mirror_fqdn: "{{ zuul_site_mirror_fqdn }}" shell: | set -xe; - ./tools/deployment/multinode/020-ingress.sh + ./tools/deployment/component/common/ingress.sh args: chdir: "{{ zuul_osh_relative_path | default(zuul.project.src_dir) }}" - name: Deploy Ceph diff --git a/tools/gate/playbooks/multinode-tempest-deploy.yaml b/tools/gate/playbooks/multinode-tempest-deploy.yaml index e6f68777be..141f04cd41 100644 --- a/tools/gate/playbooks/multinode-tempest-deploy.yaml +++ b/tools/gate/playbooks/multinode-tempest-deploy.yaml @@ -21,9 +21,11 @@ args: chdir: "{{ zuul.project.src_dir }}" - name: Deploy Ingress + environment: + OSH_DEPLOY_MULTINODE: True shell: | set -xe; - ./tools/deployment/multinode/020-ingress.sh + ./tools/deployment/component/common/ingress.sh args: chdir: "{{ zuul.project.src_dir }}" - name: Deploy Ceph