From: Vladimir Khlyunev Date: Thu, 19 Mar 2020 10:06:57 +0000 (+0400) Subject: Update stack deployment with sre tenant awareness X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=cae6143257dda2ed8952ad38445fadb6be0ddbee;p=tools%2Fsustaining.git Update stack deployment with sre tenant awareness Change-Id: I3001d6c147fbd3ba6e983a1a4e49b9cb5f6f9979 --- diff --git a/maintenance-ci/common/data/jenkins-slave.yml b/maintenance-ci/common/data/jenkins-slave.yml index 6f4cd00..66a8057 100644 --- a/maintenance-ci/common/data/jenkins-slave.yml +++ b/maintenance-ci/common/data/jenkins-slave.yml @@ -120,7 +120,7 @@ resources: echo "FLAVOR LABELS" > /etc/jenkins-agent/labels echo "127.0.0.1 $(hostname)" >> /etc/hosts echo "FLOATING" > /etc/jenkins-agent/description - echo "OPENSTACK_ENVIRONMENT" > /etc/jenkins-agent/location + echo "OPENSTACK_LOCATION" > /etc/jenkins-agent/location echo "$(hostname | sed 's/-node-.*//')" > /etc/jenkins-agent/slave-name if [[ "FLAVOR" == *"mos.fuel.base"* ]] ; then @@ -142,7 +142,7 @@ resources: LABELS: {get_param: jenkins_labels} wc_notify: { get_attr: [wait_handle, curl_cli] } FLOATING: { get_attr: [ floating_ip, floating_ip_address ] } - OPENSTACK_ENVIRONMENT: {get_param: location} + OPENSTACK_LOCATION: {get_param: location} outputs: diff --git a/maintenance-ci/common/data/mos-dev-slave-eu.yml b/maintenance-ci/common/data/mos-dev-slave-eu.yml index a94f9a5..d7e597e 100644 --- a/maintenance-ci/common/data/mos-dev-slave-eu.yml +++ b/maintenance-ci/common/data/mos-dev-slave-eu.yml @@ -138,7 +138,7 @@ resources: echo "LABELS" > /etc/jenkins-agent/labels echo "127.0.0.1 $(hostname)" >> /etc/hosts echo "FLOATING" > /etc/jenkins-agent/description - echo "OPENSTACK_ENVIRONMENT" > /etc/jenkins-agent/location + echo "OPENSTACK_LOCATION" > /etc/jenkins-agent/location echo "$(hostname | sed 's/-node-.*//')" > /etc/jenkins-agent/slave-name if [[ "FLAVOR" == *"mos.fuel.base"* ]] ; then @@ -160,7 +160,7 @@ resources: LABELS: {get_param: jenkins_labels} wc_notify: { get_attr: [wait_handle, curl_cli] } FLOATING: { get_attr: [ floating_ip, floating_ip_address ] } - OPENSTACK_ENVIRONMENT: {get_param: location} + OPENSTACK_LOCATION: {get_param: location} outputs: diff --git a/maintenance-ci/common/data/mos-dev-slave-us.yml b/maintenance-ci/common/data/mos-dev-slave-us.yml index 32afc64..5af8998 100644 --- a/maintenance-ci/common/data/mos-dev-slave-us.yml +++ b/maintenance-ci/common/data/mos-dev-slave-us.yml @@ -32,7 +32,7 @@ parameters: description: List of labels for jenkins swarm agent separated by whitespace location: type: string - default: 'EU' + default: 'US' description: Backend cluster location (available "EU" and "US") resources: @@ -120,7 +120,7 @@ resources: echo "LABELS" > /etc/jenkins-agent/labels echo "127.0.0.1 $(hostname)" >> /etc/hosts echo "FLOATING" > /etc/jenkins-agent/description - echo "OPENSTACK_ENVIRONMENT" > /etc/jenkins-agent/location + echo "OPENSTACK_LOCATION" > /etc/jenkins-agent/location echo "$(hostname | sed 's/-node-.*//')" > /etc/jenkins-agent/slave-name if [[ "FLAVOR" == *"mos.fuel.base"* ]] ; then @@ -142,7 +142,7 @@ resources: LABELS: {get_param: jenkins_labels} wc_notify: { get_attr: [wait_handle, curl_cli] } FLOATING: { get_attr: [ floating_ip, floating_ip_address ] } - OPENSTACK_ENVIRONMENT: {get_param: location} + OPENSTACK_LOCATION: {get_param: location} outputs: diff --git a/maintenance-ci/common/data/mos-slave-eu.yml b/maintenance-ci/common/data/mos-slave-eu.yml index 211a2e9..3e40766 100644 --- a/maintenance-ci/common/data/mos-slave-eu.yml +++ b/maintenance-ci/common/data/mos-slave-eu.yml @@ -138,7 +138,7 @@ resources: echo "FLAVOR LABELS" > /etc/jenkins-agent/labels echo "127.0.0.1 $(hostname)" >> /etc/hosts echo "FLOATING" > /etc/jenkins-agent/description - echo "OPENSTACK_ENVIRONMENT" > /etc/jenkins-agent/location + echo "OPENSTACK_LOCATION" > /etc/jenkins-agent/location echo "$(hostname | sed 's/-node-.*//')" > /etc/jenkins-agent/slave-name if [[ "FLAVOR" == *"mos.fuel.base"* ]] ; then @@ -160,7 +160,7 @@ resources: LABELS: {get_param: jenkins_labels} wc_notify: { get_attr: [wait_handle, curl_cli] } FLOATING: { get_attr: [ floating_ip, floating_ip_address ] } - OPENSTACK_ENVIRONMENT: {get_param: location} + OPENSTACK_LOCATION: {get_param: location} outputs: diff --git a/maintenance-ci/common/data/mos-slave-us.yml b/maintenance-ci/common/data/mos-slave-us.yml index 9d673ae..9d91abd 100644 --- a/maintenance-ci/common/data/mos-slave-us.yml +++ b/maintenance-ci/common/data/mos-slave-us.yml @@ -32,7 +32,7 @@ parameters: description: List of labels for jenkins swarm agent separated by whitespace location: type: string - default: 'EU' + default: 'US' description: Backend cluster location (available "EU" and "US") resources: @@ -120,7 +120,7 @@ resources: echo "FLAVOR LABELS" > /etc/jenkins-agent/labels echo "127.0.0.1 $(hostname)" >> /etc/hosts echo "FLOATING" > /etc/jenkins-agent/description - echo "OPENSTACK_ENVIRONMENT" > /etc/jenkins-agent/location + echo "OPENSTACK_LOCATION" > /etc/jenkins-agent/location echo "$(hostname | sed 's/-node-.*//')" > /etc/jenkins-agent/slave-name if [[ "FLAVOR" == *"mos.fuel.base"* ]] ; then @@ -142,7 +142,7 @@ resources: LABELS: {get_param: jenkins_labels} wc_notify: { get_attr: [wait_handle, curl_cli] } FLOATING: { get_attr: [ floating_ip, floating_ip_address ] } - OPENSTACK_ENVIRONMENT: {get_param: location} + OPENSTACK_LOCATION: {get_param: location} outputs: diff --git a/maintenance-ci/common/data/openrc_files/base_openrc.sh b/maintenance-ci/common/data/openrc_files/base_openrc.sh new file mode 100644 index 0000000..9a1a088 --- /dev/null +++ b/maintenance-ci/common/data/openrc_files/base_openrc.sh @@ -0,0 +1,8 @@ +OS_USER_DOMAIN_NAME=ldap_mirantis +OS_PROJECT_DOMAIN_ID=default +OS_REGION_NAME=RegionOne +OS_INTERFACE=public +OS_IDENTITY_API_VERSION=3 + +OS_USERNAME=maintenance-ci-robot +OS_PASSWORD=LKMwYTF4Cr3ef \ No newline at end of file diff --git a/maintenance-ci/common/data/openrc_files/openrc_eu_cloud.sh b/maintenance-ci/common/data/openrc_files/openrc_eu_cloud.sh new file mode 100644 index 0000000..26edb91 --- /dev/null +++ b/maintenance-ci/common/data/openrc_files/openrc_eu_cloud.sh @@ -0,0 +1 @@ +OS_AUTH_URL=https://ic-eu.ssl.mirantis.net:5000/v3 diff --git a/maintenance-ci/common/data/openrc_files/openrc_maintenance_tenant.sh b/maintenance-ci/common/data/openrc_files/openrc_maintenance_tenant.sh new file mode 100644 index 0000000..ed0094e --- /dev/null +++ b/maintenance-ci/common/data/openrc_files/openrc_maintenance_tenant.sh @@ -0,0 +1 @@ +OS_PROJECT_NAME=maintenance-team \ No newline at end of file diff --git a/maintenance-ci/common/data/openrc_files/openrc_sre_tenant.sh b/maintenance-ci/common/data/openrc_files/openrc_sre_tenant.sh new file mode 100644 index 0000000..1d6c894 --- /dev/null +++ b/maintenance-ci/common/data/openrc_files/openrc_sre_tenant.sh @@ -0,0 +1 @@ +OS_PROJECT_NAME=sre-team \ No newline at end of file diff --git a/maintenance-ci/common/data/openrc_files/openrc_us_cloud.sh b/maintenance-ci/common/data/openrc_files/openrc_us_cloud.sh new file mode 100644 index 0000000..f8090f4 --- /dev/null +++ b/maintenance-ci/common/data/openrc_files/openrc_us_cloud.sh @@ -0,0 +1 @@ +OS_AUTH_URL=https://ic-us.ssl.mirantis.net:5000/v3 diff --git a/maintenance-ci/common/jobs/deploy-jenkins-swarm.yaml b/maintenance-ci/common/jobs/deploy-jenkins-swarm.yaml index e5eb747..1b2e6b7 100644 --- a/maintenance-ci/common/jobs/deploy-jenkins-swarm.yaml +++ b/maintenance-ci/common/jobs/deploy-jenkins-swarm.yaml @@ -38,7 +38,7 @@ to: $MOS_HUGE_HDD_EXT_NODE_COUNT step: 1 predefined-parameters: | - OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT} + OPENSTACK_LOCATION=${OPENSTACK_LOCATION} HEAT_STACK_TEMPLATE_NAME=${HEAT_STACK_TEMPLATE_NAME} STACK_PREFIX=${STACK_PREFIX} USE_ANTIAFFINITY_GROUP=true @@ -61,7 +61,7 @@ to: $MOS_BASE_HDD_EXT_NODE_COUNT step: 1 predefined-parameters: | - OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT} + OPENSTACK_LOCATION=${OPENSTACK_LOCATION} HEAT_STACK_TEMPLATE_NAME=${HEAT_STACK_TEMPLATE_NAME} STACK_PREFIX=${STACK_PREFIX} USE_ANTIAFFINITY_GROUP=true @@ -84,7 +84,7 @@ to: $MOS_HUGE_NODE_COUNT step: 1 predefined-parameters: | - OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT} + OPENSTACK_LOCATION=${OPENSTACK_LOCATION} HEAT_STACK_TEMPLATE_NAME=${HEAT_STACK_TEMPLATE_NAME} STACK_PREFIX=${STACK_PREFIX} FLAVOR_NAME=mos.fuel.huge @@ -106,7 +106,7 @@ to: $MOS_BASE_NODE_COUNT step: 1 predefined-parameters: | - OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT} + OPENSTACK_LOCATION=${OPENSTACK_LOCATION} HEAT_STACK_TEMPLATE_NAME=${HEAT_STACK_TEMPLATE_NAME} STACK_PREFIX=${STACK_PREFIX} FLAVOR_NAME=mos.fuel.base diff --git a/maintenance-ci/common/jobs/multijob-build-image.yaml b/maintenance-ci/common/jobs/multijob-build-image.yaml index bf4c293..51a503e 100644 --- a/maintenance-ci/common/jobs/multijob-build-image.yaml +++ b/maintenance-ci/common/jobs/multijob-build-image.yaml @@ -35,7 +35,7 @@ - trigger-builds: - project: "deploy-heat-stack" predefined-parameters: | - OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT} + OPENSTACK_LOCATION=${OPENSTACK_LOCATION} HEAT_STACK_TEMPLATE_NAME=jenkins-slave STACK_PREFIX=image-builder FLAVOR_NAME=dev.cmn @@ -47,7 +47,7 @@ - project: "build-swarm-image" block: true predefined-parameters: | - OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT} + OPENSTACK_LOCATION=${OPENSTACK_LOCATION} IMAGE_NAME=${BUILD_IMAGE_NAME} GERRIT_REVIEW=${GERRIT_REVIEW} STAGING_IMAGE=${STAGING_IMAGE} @@ -56,7 +56,7 @@ - trigger-builds: - project: "delete-heat-stack" predefined-parameters: | - OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT} + OPENSTACK_LOCATION=${OPENSTACK_LOCATION} STACK_PREFIX=image-builder block: true diff --git a/maintenance-ci/common/macroses/cloud-selector-macro-set.yaml b/maintenance-ci/common/macroses/cloud-selector-macro-set.yaml index fd190ca..5ad5501 100644 --- a/maintenance-ci/common/macroses/cloud-selector-macro-set.yaml +++ b/maintenance-ci/common/macroses/cloud-selector-macro-set.yaml @@ -2,24 +2,35 @@ name: openstack-cloud-selector parameters: - choice: - name: OPENSTACK_ENVIRONMENT + name: OPENSTACK_LOCATION choices: - EU - US + - choice: + name: OPENSTACK_TENANT + choices: + - sre-team + - maintenance-team - wrapper: name: openstack-creds wrappers: - credentials-binding: - file: - credential-id: maintenance-ci-openrc-password-free - variable: OPENRC_FILE + credential-id: base_openrc + variable: BASE_OPENRC_FILE + - file: + credential-id: openrc_eu_cloud + variable: OPENRC_EU_CLOUD_FILE + - file: + credential-id: openrc_us_cloud + variable: OPENRC_US_CLOUD_FILE - file: - credential-id: maintenance-team-openrc-eu-robot-no-password - variable: EU_OPENRC_FILE + credential-id: openrc_sre_tenant + variable: OPENRC_SRE_TENANT_FILE - file: - credential-id: maintenance-team-openrc-us-robot-no-password - variable: US_OPENRC_FILE + credential-id: openrc_maintenance_tenant + variable: OPENRC_MAINTENANCE_TENANT_FILE - username-password-separated: credential-id: maintenance-ci-robot-password username: OS_USERNAME @@ -28,19 +39,37 @@ - builder: name: openrc-source-file-selector builders: + - inject: + properties-file: ${BASE_OPENRC_FILE} - conditional-step: condition-kind: strings-match - condition-string1: $OPENSTACK_ENVIRONMENT + condition-string1: $OPENSTACK_LOCATION condition-string2: EU condition-case-insensitive: true steps: - inject: - properties-file: ${EU_OPENRC_FILE} + properties-file: ${OPENRC_EU_CLOUD_FILE} - conditional-step: condition-kind: strings-match - condition-string1: $OPENSTACK_ENVIRONMENT + condition-string1: $OPENSTACK_LOCATION condition-string2: US condition-case-insensitive: true steps: - inject: - properties-file: ${US_OPENRC_FILE} + properties-file: ${OPENRC_US_CLOUD_FILE} + - conditional-step: + condition-kind: strings-match + condition-string1: OPENSTACK_TENANT + condition-string2: sre-team + condition-case-insensitive: true + steps: + - inject: + properties-file: ${OPENRC_SRE_TENANT_FILE} + - conditional-step: + condition-kind: strings-match + condition-string1: $OPENSTACK_LOCATION + condition-string2: maintenance-team + condition-case-insensitive: true + steps: + - inject: + properties-file: ${OPENRC_MAINTENANCE_TENANT_FILE} diff --git a/maintenance-ci/common/scripts/deploy_heat_stack.sh b/maintenance-ci/common/scripts/deploy_heat_stack.sh index 505386d..0dd7348 100755 --- a/maintenance-ci/common/scripts/deploy_heat_stack.sh +++ b/maintenance-ci/common/scripts/deploy_heat_stack.sh @@ -17,7 +17,7 @@ if [[ ! -d "${OPENSTACK_CLIENTS_VENV}" ]] ; then deactivate fi -parameter_string="location=${OPENSTACK_ENVIRONMENT}" +parameter_string="location=${OPENSTACK_LOCATION}" if [[ ! -z "${FLAVOR_NAME}" ]] ; then parameter_string="flavor=${FLAVOR_NAME};$parameter_string" fi @@ -36,7 +36,7 @@ else md5_cmd="md5" fi -STACK_NAME="${STACK_PREFIX:-swarm_slave}-${OPENSTACK_ENVIRONMENT,,}-$(head -c 100 /dev/urandom | "${md5_cmd}" | head -c 4)" +STACK_NAME="${STACK_PREFIX:-swarm_slave}-${OPENSTACK_LOCATION,,}-$(head -c 100 /dev/urandom | "${md5_cmd}" | head -c 4)" if [[ ! -z "${CUSTOM_HEAT_STACK_YAML}" ]] ; then TEMPLATE_FILE="${CUSTOM_HEAT_STACK_YAML}" @@ -46,7 +46,7 @@ elif [[ ! -z "${HEAT_STACK_TEMPLATE_NAME}" ]] ; then if [[ -f "${WORKSPACE}/maintenance-ci/common/data/${HEAT_STACK_TEMPLATE_NAME}.yml" ]] ; then TEMPLATE_FILE="${WORKSPACE}/maintenance-ci/common/data/${HEAT_STACK_TEMPLATE_NAME}.yml" else - TEMPLATE_FILE="${WORKSPACE}/maintenance-ci/common/data/${HEAT_STACK_TEMPLATE_NAME}-${OPENSTACK_ENVIRONMENT,,}.yml" + TEMPLATE_FILE="${WORKSPACE}/maintenance-ci/common/data/${HEAT_STACK_TEMPLATE_NAME}-${OPENSTACK_LOCATION,,}.yml" fi fi