-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add VSphere IPI e2e steps #7586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-robot
merged 2 commits into
openshift:master
from
patrickdillon:vsphere-ipi-steps
Mar 25, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - abhinavdahiya | ||
| - jcpowermac | ||
| - patrickdillon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - abhinavdahiya | ||
| - jcpowermac | ||
| - patrickdillon |
92 changes: 92 additions & 0 deletions
92
ci-operator/step-registry/ipi/conf/vsphere/dns/ipi-conf-vsphere-dns-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o nounset | ||
| set -o errexit | ||
| set -o pipefail | ||
|
|
||
| echo "origin-ci-int-aws.dev.rhcloud.com" > "${SHARED_DIR}"/basedomain.txt | ||
|
|
||
| cluster_profile=/var/run/secrets/ci.openshift.io/cluster-profile | ||
| cluster_name=${NAMESPACE}-${JOB_NAME_HASH} | ||
| base_domain=$(<"${SHARED_DIR}"/basedomain.txt) | ||
| cluster_domain="${cluster_name}.${base_domain}" | ||
|
|
||
| export AWS_SHARED_CREDENTIALS_FILE=${cluster_profile}/.awscred | ||
|
|
||
| # Load array created in setup-vips: | ||
| # 0: API | ||
| # 1: Ingress | ||
| # 2: DNS | ||
| declare -a vips | ||
| mapfile -t vips < "${SHARED_DIR}"/vips.txt | ||
|
|
||
| hosted_zone_id="$(aws route53 list-hosted-zones-by-name \ | ||
| --dns-name "${base_domain}" \ | ||
| --query "HostedZones[? Config.PrivateZone != \`true\` && Name == \`${base_domain}.\`].Id" \ | ||
| --output text)" | ||
|
|
||
|
|
||
| echo "Creating DNS records..." | ||
| cat > "${SHARED_DIR}"/dns-create.json <<EOF | ||
| { | ||
| "Comment": "Create public OpenShift DNS records for VSphere IPI CI install", | ||
| "Changes": [{ | ||
| "Action": "UPSERT", | ||
| "ResourceRecordSet": { | ||
| "Name": "api.$cluster_domain.", | ||
| "Type": "A", | ||
| "TTL": 60, | ||
| "ResourceRecords": [{"Value": "${vips[0]}"}] | ||
| } | ||
| },{ | ||
| "Action": "UPSERT", | ||
| "ResourceRecordSet": { | ||
| "Name": "*.apps.$cluster_domain.", | ||
| "Type": "A", | ||
| "TTL": 60, | ||
| "ResourceRecords": [{"Value": "${vips[1]}"}] | ||
| } | ||
| },{ | ||
| "Action": "UPSERT", | ||
| "ResourceRecordSet": { | ||
| "Name": "$cluster_domain.", | ||
| "Type": "NS", | ||
| "TTL": 300, | ||
| "ResourceRecords": [{"Value": "${vips[2]}"}] | ||
| } | ||
| }]} | ||
| EOF | ||
|
|
||
| aws route53 change-resource-record-sets --hosted-zone-id "$hosted_zone_id" --change-batch file:///"${SHARED_DIR}"/dns-create.json | ||
|
|
||
| echo "Creating batch file to destroy DNS records" | ||
| cat > "${SHARED_DIR}"/dns-delete.json <<EOF | ||
| { | ||
| "Comment": "Delete public OpenShift DNS records for VSphere IPI CI install", | ||
| "Changes": [{ | ||
| "Action": "DELETE", | ||
| "ResourceRecordSet": { | ||
| "Name": "api.$cluster_domain.", | ||
| "Type": "A", | ||
| "TTL": 60, | ||
| "ResourceRecords": [{"Value": "${vips[0]}"}] | ||
| } | ||
| },{ | ||
| "Action": "DELETE", | ||
| "ResourceRecordSet": { | ||
| "Name": "*.apps.$cluster_domain.", | ||
| "Type": "A", | ||
| "TTL": 60, | ||
| "ResourceRecords": [{"Value": "${vips[1]}"}] | ||
| } | ||
| },{ | ||
| "Action": "DELETE", | ||
| "ResourceRecordSet": { | ||
| "Name": "$cluster_domain.", | ||
| "Type": "NS", | ||
| "TTL": 300, | ||
| "ResourceRecords": [{"Value": "${vips[2]}"}] | ||
| } | ||
| }]} | ||
| EOF | ||
|
|
||
13 changes: 13 additions & 0 deletions
13
ci-operator/step-registry/ipi/conf/vsphere/dns/ipi-conf-vsphere-dns-ref.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ref: | ||
| as: ipi-conf-vsphere-dns | ||
| from: upi-installer | ||
| commands: ipi-conf-vsphere-dns-commands.sh | ||
| resources: | ||
| requests: | ||
| cpu: 10m | ||
| memory: 100Mi | ||
| documentation: >- | ||
| Uses VIPs in ${SHARED_DIR}/vips.txt to create route53 dns records. Outputs | ||
| ${SHARED_DIR}/basedomain.txt to ensure consistent basedomain in conf and | ||
| deprovision steps. Saves batch job to delete DNS records to | ||
| ${SHARED_DIR}/dns-delete.json for use in deprovisioning. |
11 changes: 11 additions & 0 deletions
11
ci-operator/step-registry/ipi/conf/vsphere/ipi-conf-vsphere-chain.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| chain: | ||
| as: ipi-conf-vsphere | ||
| steps: | ||
| - ref: ipi-conf-vsphere-vips | ||
| - ref: ipi-conf-vsphere-dns | ||
| - ref: ipi-conf | ||
patrickdillon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - ref: ipi-conf-vsphere | ||
| documentation: >- | ||
| The vSphere IPI configure step chain generates prerequisites for installing | ||
| a cluster: virtual IP addresses, DNS records, and the install-config.yaml. | ||
| Resources are created based on the cluster profile and optional input files. | ||
30 changes: 30 additions & 0 deletions
30
ci-operator/step-registry/ipi/conf/vsphere/ipi-conf-vsphere-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o nounset | ||
| set -o errexit | ||
| set -o pipefail | ||
|
|
||
| CONFIG="${SHARED_DIR}/install-config.yaml" | ||
| TFVARS_PATH=/var/run/secrets/ci.openshift.io/cluster-profile/secret.auto.tfvars | ||
| vsphere_user=$(grep -oP 'vsphere_user="\K[^"]+' ${TFVARS_PATH}) | ||
| vsphere_password=$(grep -oP 'vsphere_password="\K[^"]+' ${TFVARS_PATH}) | ||
| base_domain=$(<"${SHARED_DIR}"/basedomain.txt) | ||
|
|
||
| declare -a vips | ||
| mapfile -t vips < "${SHARED_DIR}/vips.txt" | ||
|
|
||
| cat >> "${CONFIG}" << EOF | ||
| baseDomain: $base_domain | ||
| platform: | ||
| vsphere: | ||
| cluster: devel | ||
patrickdillon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| datacenter: dc1 | ||
| defaultDatastore: nvme-ds1 | ||
| network: VM Network | ||
patrickdillon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| password: ${vsphere_password} | ||
| username: ${vsphere_user} | ||
| vCenter: vcsa-ci.vmware.devcluster.openshift.com | ||
| apiVIP: "${vips[0]}" | ||
| ingressVIP: "${vips[1]}" | ||
| dnsVIP: "${vips[2]}" | ||
| EOF | ||
12 changes: 12 additions & 0 deletions
12
ci-operator/step-registry/ipi/conf/vsphere/ipi-conf-vsphere-ref.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ref: | ||
| as: ipi-conf-vsphere | ||
| from: base | ||
| commands: ipi-conf-vsphere-commands.sh | ||
| resources: | ||
| requests: | ||
| cpu: 10m | ||
| memory: 100Mi | ||
| documentation: >- | ||
| The IPI vSphere configure step generates the vSphere-specific | ||
| install-config.yaml contents based on the cluster profile, | ||
| $SHARED_DIR/vips.txt, $SHARED_DIR/basedomain.txt, and optional input files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - abhinavdahiya | ||
| - jcpowermac | ||
| - patrickdillon |
35 changes: 35 additions & 0 deletions
35
ci-operator/step-registry/ipi/conf/vsphere/vips/ipi-conf-vsphere-vips-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o nounset | ||
| set -o errexit | ||
| set -o pipefail | ||
|
|
||
| tfvars_path=/var/run/secrets/ci.openshift.io/cluster-profile/secret.auto.tfvars | ||
| cluster_name=${NAMESPACE}-${JOB_NAME_HASH} | ||
| ipam_token=$(grep -oP 'ipam_token="\K[^"]+' ${tfvars_path}) | ||
|
|
||
| # Array to hold virtual ips: | ||
| # 0: API | ||
| # 1: Ingress | ||
| # 2: DNS | ||
| declare -a vips | ||
|
|
||
| echo "Reserving virtual ip addresses from the IPAM server..." | ||
| for i in {0..2} | ||
| do | ||
| args=$(jq -n \ | ||
| --arg hostn "$cluster_name-$i" \ | ||
| --arg token "$ipam_token" \ | ||
| '{network: "139.178.87.128", hostname: $hostn, ipam: "139.178.89.254", ipam_token: $token}') | ||
|
|
||
| vip_json=$(echo "$args" | bash <(curl -s https://raw.githubusercontent.com/openshift/installer/master/upi/vsphere/machine/cidr_to_ip.sh)) | ||
| vips[$i]=$(echo "$vip_json" | jq -r .ip_address ) | ||
| if [[ -z ${vips[$i]} ]]; then | ||
| echo "error: Unable to reserve virtual IP address, exiting" 1>&2 | ||
| exit 1 | ||
| fi | ||
| echo "${vips[$i]}" >> "${SHARED_DIR}"/vips.txt | ||
| done | ||
|
|
||
| echo "Reserved the following IP addresses..." | ||
| cat "${SHARED_DIR}"/vips.txt |
13 changes: 13 additions & 0 deletions
13
ci-operator/step-registry/ipi/conf/vsphere/vips/ipi-conf-vsphere-vips-ref.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ref: | ||
| as: ipi-conf-vsphere-vips | ||
| from: upi-installer | ||
| commands: ipi-conf-vsphere-vips-commands.sh | ||
| resources: | ||
| requests: | ||
| cpu: 10m | ||
| memory: 100Mi | ||
| documentation: >- | ||
| Using secrets from the vSphere cluster profile, the vSphere VIP setup step | ||
| reserves IP addresses through IPAM and saves them to $SHARED_DIR/vips.txt | ||
| for later use in creating DNS records and the install config. They are also | ||
| needed in deprovisioning to release the reserved VIPs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - abhinavdahiya | ||
| - jcpowermac | ||
| - patrickdillon |
7 changes: 7 additions & 0 deletions
7
ci-operator/step-registry/ipi/deprovision/vsphere/ipi-deprovision-vsphere-chain.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| chain: | ||
| as: ipi-deprovision-vsphere | ||
| steps: | ||
| - chain: gather | ||
| - ref: ipi-deprovision-vsphere | ||
| documentation: |- | ||
| The IPI deprovision step chain contains all the individual steps necessary to deprovision an OpenShift cluster. |
28 changes: 28 additions & 0 deletions
28
ci-operator/step-registry/ipi/deprovision/vsphere/ipi-deprovision-vsphere-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/bin/bash | ||
|
|
||
| cluster_profile=/var/run/secrets/ci.openshift.io/cluster-profile | ||
| tfvars_path=/var/run/secrets/ci.openshift.io/cluster-profile/secret.auto.tfvars | ||
| base_domain=$(<"${SHARED_DIR}"/basedomain.txt) | ||
| cluster_name=${NAMESPACE}-${JOB_NAME_HASH} | ||
| ipam_token=$(grep -oP 'ipam_token="\K[^"]+' ${tfvars_path}) | ||
|
|
||
| export AWS_SHARED_CREDENTIALS_FILE=${cluster_profile}/.awscred | ||
|
|
||
| echo "Deprovisioning cluster ..." | ||
| cp -ar "${SHARED_DIR}" /tmp/installer | ||
| TF_LOG=debug openshift-install --dir /tmp/installer destroy cluster | ||
| cp /tmp/installer/.openshift_install.log "${ARTIFACT_DIR}/" | ||
|
|
||
| hosted_zone_id="$(aws route53 list-hosted-zones-by-name \ | ||
| --dns-name "${base_domain}" \ | ||
| --query "HostedZones[? Config.PrivateZone != \`true\` && Name == \`${base_domain}.\`].Id" \ | ||
| --output text)" | ||
|
|
||
| echo "Releasing IP addresses from IPAM server..." | ||
| for i in {0..2} | ||
| do | ||
| curl -s "http://139.178.89.254/api/removeHost.php?apiapp=address&apitoken=${ipam_token}&host=${cluster_name}-$i" | ||
| done | ||
|
|
||
| echo "Deleting Route53 DNS records..." | ||
| aws route53 change-resource-record-sets --hosted-zone-id "$hosted_zone_id" --change-batch file:///"${SHARED_DIR}"/dns-delete.json |
12 changes: 12 additions & 0 deletions
12
ci-operator/step-registry/ipi/deprovision/vsphere/ipi-deprovision-vsphere-ref.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ref: | ||
| as: ipi-deprovision-vsphere | ||
| from: upi-installer | ||
| commands: ipi-deprovision-vsphere-commands.sh | ||
| resources: | ||
| requests: | ||
| cpu: 1000m | ||
| memory: 100Mi | ||
| documentation: >- | ||
| Reads the VIP and DNS records created in the setup phases from $SHARED_DIR | ||
| and delete them. Also uses $SHARED_DIR/basedomain.txt to ensure consistent | ||
| basedomain as setup steps. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - abhinavdahiya | ||
| - jcpowermac | ||
| - patrickdillon |
7 changes: 7 additions & 0 deletions
7
ci-operator/step-registry/ipi/install/vsphere/ipi-install-vsphere-chain.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| chain: | ||
| as: ipi-install-vsphere | ||
| steps: | ||
| - ref: ipi-install-rbac | ||
| - ref: ipi-install-vsphere | ||
| documentation: |- | ||
| The IPI install step chain contains all the individual steps necessary to install an OpenShift cluster. |
1 change: 1 addition & 0 deletions
1
ci-operator/step-registry/ipi/install/vsphere/ipi-install-vsphere-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../install/ipi-install-install-commands.sh |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.