]> review.fuel-infra Code Review - tools/sustaining.git/commitdiff
Update stack deployment with sre tenant awareness 93/41593/1
authorVladimir Khlyunev <vkhlyunev@mirantis.com>
Thu, 19 Mar 2020 10:06:57 +0000 (14:06 +0400)
committerVladimir Khlyunev <vkhlyunev@mirantis.com>
Thu, 19 Mar 2020 10:06:57 +0000 (14:06 +0400)
Change-Id: I3001d6c147fbd3ba6e983a1a4e49b9cb5f6f9979

14 files changed:
maintenance-ci/common/data/jenkins-slave.yml
maintenance-ci/common/data/mos-dev-slave-eu.yml
maintenance-ci/common/data/mos-dev-slave-us.yml
maintenance-ci/common/data/mos-slave-eu.yml
maintenance-ci/common/data/mos-slave-us.yml
maintenance-ci/common/data/openrc_files/base_openrc.sh [new file with mode: 0644]
maintenance-ci/common/data/openrc_files/openrc_eu_cloud.sh [new file with mode: 0644]
maintenance-ci/common/data/openrc_files/openrc_maintenance_tenant.sh [new file with mode: 0644]
maintenance-ci/common/data/openrc_files/openrc_sre_tenant.sh [new file with mode: 0644]
maintenance-ci/common/data/openrc_files/openrc_us_cloud.sh [new file with mode: 0644]
maintenance-ci/common/jobs/deploy-jenkins-swarm.yaml
maintenance-ci/common/jobs/multijob-build-image.yaml
maintenance-ci/common/macroses/cloud-selector-macro-set.yaml
maintenance-ci/common/scripts/deploy_heat_stack.sh

index 6f4cd005de24e1b566db9438af51ae23faf7a663..66a805786ad9a99f07019eb7bd7f653067ec2c45 100644 (file)
@@ -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:
index a94f9a5977796ffe25cf099a18b0796a03155759..d7e597ee3337d60f4c6c345776ad1ae7426d16e3 100644 (file)
@@ -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:
index 32afc644a2db2995d216262c54b660876a0f3cf7..5af8998783a9b4df201f1051a6fbbddd8341e949 100644 (file)
@@ -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:
index 211a2e96b45f40a91b560fc89c8a99cc135cc485..3e407663e6ea06cb8dd74353db393fd527d72a5a 100644 (file)
@@ -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:
index 9d673aed39c2c85513a9fdc49905b8974123ba4e..9d91abdc4306785dc7cf665e7ddb963d8122a16f 100644 (file)
@@ -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 (file)
index 0000000..9a1a088
--- /dev/null
@@ -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 (file)
index 0000000..26edb91
--- /dev/null
@@ -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 (file)
index 0000000..ed0094e
--- /dev/null
@@ -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 (file)
index 0000000..1d6c894
--- /dev/null
@@ -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 (file)
index 0000000..f8090f4
--- /dev/null
@@ -0,0 +1 @@
+OS_AUTH_URL=https://ic-us.ssl.mirantis.net:5000/v3
index e5eb747faebd2c7b154f49380ac5b5f4cb752362..1b2e6b7c17fd2f6ef3935badffd162202a8d151e 100644 (file)
@@ -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
                 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
index bf4c2933ca661b0d4c0baf5843e267740e09f16b..51a503e3784f9845c7dd16b217a08ab9e6d241cd 100644 (file)
@@ -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
 
index fd190ca8786b4093a9a105cbd2cebe540ae0677c..5ad55011c4b3de38eadff774962d65451ee606d3 100644 (file)
@@ -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
 - 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}
index 505386df3154f1247a6df70176c9bbd21ef4ac48..0dd73488a0ae958b18daeee361c359735de39bf4 100755 (executable)
@@ -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