-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add hubs deployment ibu lane #79893
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
Open
shaior
wants to merge
1
commit into
openshift:main
Choose a base branch
from
shaior:ibu_lane
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add hubs deployment ibu lane #79893
Changes from all commits
Commits
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
35 changes: 35 additions & 0 deletions
35
...erator/config/openshift-kni/eco-ci-cd/openshift-kni-eco-ci-cd-main__cnf-ran-ibu-4.20.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,35 @@ | ||
| build_root: | ||
| image_stream_tag: | ||
| name: eco-ci-cd | ||
| namespace: telcov10n-ci | ||
| tag: eco-ci-cd | ||
| releases: | ||
| latest: | ||
| candidate: | ||
| product: ocp | ||
| stream: nightly | ||
| version: "4.20" | ||
| resources: | ||
| '*': | ||
| limits: | ||
| memory: 4Gi | ||
| requests: | ||
| cpu: 100m | ||
| memory: 200Mi | ||
| tests: | ||
| - as: cnf-ran-ztp-tests | ||
| capabilities: | ||
| - intranet | ||
| cron: 0 0 31 2 * | ||
| steps: | ||
| env: | ||
| SEED_CLUSTER_NAME: kni-qe-108 | ||
| SEED_HUB_VERSION: "4.20" | ||
| TARGET_CLUSTER_NAME: kni-qe-109 | ||
| TARGET_HUB_VERSION: "4.18" | ||
| workflow: telcov10n-functional-cnf-ran-ibu | ||
| zz_generated_metadata: | ||
| branch: main | ||
| org: openshift-kni | ||
| repo: eco-ci-cd | ||
| variant: cnf-ran-ibu-4.20 |
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
4 changes: 4 additions & 0 deletions
4
ci-operator/step-registry/telcov10n/functional/cnf-ran/ibu-seed-hub-deploy/OWNERS
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: | ||
| - shaior | ||
| - kononovn | ||
| - eifrach |
94 changes: 94 additions & 0 deletions
94
.../cnf-ran/ibu-seed-hub-deploy/telcov10n-functional-cnf-ran-ibu-seed-hub-deploy-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,94 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| if [ -f "${SHARED_DIR}/skip.txt" ]; then | ||
| echo "Detected skip.txt — skipping" | ||
| exit 0 | ||
| fi | ||
|
|
||
| MOUNTED_HOST_INVENTORY="/var/host_variables" | ||
|
|
||
| process_inventory() { | ||
| local directory="$1" | ||
| local dest_file="$2" | ||
|
|
||
| if [ -z "$directory" ]; then | ||
| echo "Usage: process_inventory <directory> <dest_file>" | ||
| return 1 | ||
| fi | ||
|
|
||
| if [ ! -d "$directory" ]; then | ||
| echo "Error: '$directory' is not a valid directory" | ||
| return 1 | ||
| fi | ||
|
|
||
| find "$directory" -type f | while IFS= read -r filename; do | ||
| if [[ $filename == *"secretsync-vault-source-path"* ]]; then | ||
| continue | ||
| else | ||
| echo "$(basename "${filename}")": \'"$(cat "$filename")"\' | ||
| fi | ||
| done > "${dest_file}" | ||
| } | ||
|
|
||
| echo "SEED_CLUSTER_NAME=${SEED_CLUSTER_NAME}" | ||
| echo "SEED_HUB_VERSION=${SEED_HUB_VERSION}" | ||
|
|
||
| echo "Processing common group_vars" | ||
| mkdir /eco-ci-cd/inventories/ocp-deployment/group_vars | ||
|
|
||
| find /var/group_variables/common/ -mindepth 1 -type d | while read -r dir; do | ||
| echo " group_var: $(basename "${dir}")" | ||
| process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/group_vars/"$(basename "${dir}")" | ||
| done | ||
|
|
||
| echo "Processing seed hub group_vars (${SEED_CLUSTER_NAME})" | ||
| find "/var/group_variables/${SEED_CLUSTER_NAME}/" -mindepth 1 -type d | while read -r dir; do | ||
| echo " group_var: $(basename "${dir}")" | ||
| process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/group_vars/"$(basename "${dir}")" | ||
| done | ||
|
|
||
| echo "Processing seed hub host_vars (${SEED_CLUSTER_NAME})" | ||
| mkdir /eco-ci-cd/inventories/ocp-deployment/host_vars | ||
|
|
||
| find "${MOUNTED_HOST_INVENTORY}/${SEED_CLUSTER_NAME}/" -mindepth 1 -type d | while read -r dir; do | ||
| echo " host_var: $(basename "${dir}")" | ||
| process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/host_vars/"$(basename "${dir}")" | ||
| done | ||
|
|
||
| cd /eco-ci-cd | ||
|
|
||
| echo "Running deploy-ocp-sno for seed hub ${SEED_CLUSTER_NAME} (version=${SEED_HUB_VERSION})" | ||
| EXTRA_VARS="release=${SEED_HUB_VERSION} cluster_name=${SEED_CLUSTER_NAME} disconnected=true" | ||
| if [ "${DISABLE_INSIGHTS}" = "true" ]; then | ||
| EXTRA_VARS="${EXTRA_VARS} disable_insights=true" | ||
| fi | ||
|
|
||
| ansible-playbook ./playbooks/deploy-ocp-sno.yml \ | ||
| -i ./inventories/ocp-deployment/build-inventory.py \ | ||
| --extra-vars "${EXTRA_VARS}" | ||
|
|
||
| # Write seed hub inventory to SHARED_DIR. | ||
| # host_vars are cluster-specific and get a "seed_" prefix to avoid collision with target hub files. | ||
| # group_vars/all is common across all clusters — no prefix needed. | ||
| echo "Copying seed hub inventory to SHARED_DIR" | ||
| find /eco-ci-cd/inventories/ocp-deployment/host_vars -maxdepth 1 -type f | while read -r f; do | ||
| cp "$f" "${SHARED_DIR}/seed_$(basename "$f")" | ||
| done | ||
| cp /eco-ci-cd/inventories/ocp-deployment/group_vars/all "${SHARED_DIR}/all" | ||
|
|
||
| echo "Getting seed hub cluster version" | ||
| HUB_KUBECONFIG="/home/telcov10n/project/generated/${SEED_CLUSTER_NAME}/auth/kubeconfig" | ||
|
|
||
| BASTION_IP=$(grep -oP '(?<=ansible_host: ).*' /eco-ci-cd/inventories/ocp-deployment/host_vars/bastion | sed "s/'//g") | ||
| BASTION_USER=$(grep -oP '(?<=ansible_user: ).*' /eco-ci-cd/inventories/ocp-deployment/group_vars/all | sed "s/'//g") | ||
|
|
||
| cat /var/group_variables/common/all/ansible_ssh_private_key > "/tmp/temp_ssh_key" | ||
| chmod 600 "/tmp/temp_ssh_key" | ||
|
|
||
| CLUSTER_VERSION=$(ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ | ||
| -i /tmp/temp_ssh_key "${BASTION_USER}@${BASTION_IP}" \ | ||
| "KUBECONFIG=${HUB_KUBECONFIG} oc get clusterversion version -ojsonpath='{.status.desired.version}'") | ||
|
|
||
| echo "Seed hub cluster version: ${CLUSTER_VERSION}" | ||
| echo "${CLUSTER_VERSION}" > "${SHARED_DIR}/seed_hub_version" | ||
10 changes: 10 additions & 0 deletions
10
...an/ibu-seed-hub-deploy/telcov10n-functional-cnf-ran-ibu-seed-hub-deploy-ref.metadata.json
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,10 @@ | ||
| { | ||
| "path": "telcov10n/functional/cnf-ran/ibu-seed-hub-deploy/telcov10n-functional-cnf-ran-ibu-seed-hub-deploy-ref.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "shaior", | ||
| "kononovn", | ||
| "eifrach" | ||
| ] | ||
| } | ||
| } |
52 changes: 52 additions & 0 deletions
52
...nal/cnf-ran/ibu-seed-hub-deploy/telcov10n-functional-cnf-ran-ibu-seed-hub-deploy-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,52 @@ | ||
| ref: | ||
| as: telcov10n-functional-cnf-ran-ibu-seed-hub-deploy | ||
| from_image: | ||
| namespace: telcov10n-ci | ||
| name: eco-ci-cd | ||
| tag: eco-ci-cd | ||
| commands: telcov10n-functional-cnf-ran-ibu-seed-hub-deploy-commands.sh | ||
| timeout: 4h | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| memory: 200Mi | ||
| env: | ||
| - name: SEED_HUB_VERSION | ||
| default: "4.20" | ||
| documentation: OCP version to deploy on the seed hub (the upgrade destination version — the version spokes will upgrade TO) | ||
| - name: SEED_CLUSTER_NAME | ||
| default: "kni-qe-108" | ||
| documentation: BM cluster name for the IBU seed hub | ||
| - name: DISABLE_INSIGHTS | ||
| default: "false" | ||
| documentation: Set to "true" to remove cloud.openshift.com from pull secret, disabling Insights and Telemetry | ||
| credentials: | ||
| - namespace: test-credentials | ||
| name: telcov10n-ansible-group-all | ||
| mount_path: /var/group_variables/common/all | ||
| - namespace: test-credentials | ||
| name: telcov10n-ansible-group-bastions | ||
| mount_path: /var/group_variables/common/bastions | ||
| - namespace: test-credentials | ||
| name: telcov10n-ansible-group-hypervisors | ||
| mount_path: /var/group_variables/common/hypervisors | ||
| # kni-qe-108 (seed hub) | ||
| - namespace: test-credentials | ||
| name: telcov10n-ansible-kni-qe-108-master0 | ||
| mount_path: /var/host_variables/kni-qe-108/master0 | ||
| - namespace: test-credentials | ||
| name: telcov10n-ansible-kni-qe-108-bastion | ||
| mount_path: /var/host_variables/kni-qe-108/bastion | ||
| - namespace: test-credentials | ||
| name: telcov10n-ansible-group-kni-qe-108-nodes | ||
| mount_path: /var/group_variables/kni-qe-108/nodes | ||
| - namespace: test-credentials | ||
| name: telcov10n-ansible-group-kni-qe-108-masters | ||
| mount_path: /var/group_variables/kni-qe-108/masters | ||
| - namespace: test-credentials | ||
| name: telcov10n-ansible-hypervisors-helix89 | ||
| mount_path: /var/host_variables/kni-qe-108/hypervisor | ||
| documentation: |- | ||
| Deploy IBU seed hub (kni-qe-108). | ||
| The seed hub provides the OCP image used for upgrading target spokes. | ||
|
|
4 changes: 4 additions & 0 deletions
4
ci-operator/step-registry/telcov10n/functional/cnf-ran/ibu-target-hub-deploy/OWNERS
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: | ||
| - shaior | ||
| - kononovn | ||
| - eifrach |
94 changes: 94 additions & 0 deletions
94
...-ran/ibu-target-hub-deploy/telcov10n-functional-cnf-ran-ibu-target-hub-deploy-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,94 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| if [ -f "${SHARED_DIR}/skip.txt" ]; then | ||
| echo "Detected skip.txt — skipping" | ||
| exit 0 | ||
| fi | ||
|
|
||
| MOUNTED_HOST_INVENTORY="/var/host_variables" | ||
|
|
||
| process_inventory() { | ||
| local directory="$1" | ||
| local dest_file="$2" | ||
|
|
||
| if [ -z "$directory" ]; then | ||
| echo "Usage: process_inventory <directory> <dest_file>" | ||
| return 1 | ||
| fi | ||
|
|
||
| if [ ! -d "$directory" ]; then | ||
| echo "Error: '$directory' is not a valid directory" | ||
| return 1 | ||
| fi | ||
|
|
||
| find "$directory" -type f | while IFS= read -r filename; do | ||
| if [[ $filename == *"secretsync-vault-source-path"* ]]; then | ||
| continue | ||
| else | ||
| echo "$(basename "${filename}")": \'"$(cat "$filename")"\' | ||
| fi | ||
| done > "${dest_file}" | ||
| } | ||
|
|
||
| echo "TARGET_CLUSTER_NAME=${TARGET_CLUSTER_NAME}" | ||
| echo "TARGET_HUB_VERSION=${TARGET_HUB_VERSION}" | ||
|
|
||
| echo "Processing common group_vars" | ||
| mkdir /eco-ci-cd/inventories/ocp-deployment/group_vars | ||
|
|
||
| find /var/group_variables/common/ -mindepth 1 -type d | while read -r dir; do | ||
| echo " group_var: $(basename "${dir}")" | ||
| process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/group_vars/"$(basename "${dir}")" | ||
| done | ||
|
|
||
| echo "Processing target hub group_vars (${TARGET_CLUSTER_NAME})" | ||
| find "/var/group_variables/${TARGET_CLUSTER_NAME}/" -mindepth 1 -type d | while read -r dir; do | ||
| echo " group_var: $(basename "${dir}")" | ||
| process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/group_vars/"$(basename "${dir}")" | ||
| done | ||
|
|
||
| echo "Processing target hub host_vars (${TARGET_CLUSTER_NAME})" | ||
| mkdir /eco-ci-cd/inventories/ocp-deployment/host_vars | ||
|
|
||
| find "${MOUNTED_HOST_INVENTORY}/${TARGET_CLUSTER_NAME}/" -mindepth 1 -type d | while read -r dir; do | ||
| echo " host_var: $(basename "${dir}")" | ||
| process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/host_vars/"$(basename "${dir}")" | ||
| done | ||
|
|
||
| cd /eco-ci-cd | ||
|
|
||
| echo "Running deploy-ocp-sno for target hub ${TARGET_CLUSTER_NAME} (version=${TARGET_HUB_VERSION})" | ||
| EXTRA_VARS="release=${TARGET_HUB_VERSION} cluster_name=${TARGET_CLUSTER_NAME} disconnected=true" | ||
| if [ "${DISABLE_INSIGHTS}" = "true" ]; then | ||
| EXTRA_VARS="${EXTRA_VARS} disable_insights=true" | ||
| fi | ||
|
|
||
| ansible-playbook ./playbooks/deploy-ocp-sno.yml \ | ||
| -i ./inventories/ocp-deployment/build-inventory.py \ | ||
| --extra-vars "${EXTRA_VARS}" | ||
|
|
||
| # Write target hub inventory to SHARED_DIR (used by downstream steps). | ||
| # host_vars are copied flat — no prefix, as these are the "primary" hub files. | ||
| # group_vars/all is common across all clusters — same approach as seed hub. | ||
| echo "Copying target hub inventory to SHARED_DIR" | ||
| find /eco-ci-cd/inventories/ocp-deployment/host_vars -maxdepth 1 -type f | while read -r f; do | ||
| cp "$f" "${SHARED_DIR}/$(basename "$f")" | ||
| done | ||
| cp /eco-ci-cd/inventories/ocp-deployment/group_vars/all "${SHARED_DIR}/all" | ||
|
|
||
| echo "Getting target hub cluster version" | ||
| HUB_KUBECONFIG="/home/telcov10n/project/generated/${TARGET_CLUSTER_NAME}/auth/kubeconfig" | ||
|
|
||
| BASTION_IP=$(grep -oP '(?<=ansible_host: ).*' /eco-ci-cd/inventories/ocp-deployment/host_vars/bastion | sed "s/'//g") | ||
| BASTION_USER=$(grep -oP '(?<=ansible_user: ).*' /eco-ci-cd/inventories/ocp-deployment/group_vars/all | sed "s/'//g") | ||
|
|
||
| cat /var/group_variables/common/all/ansible_ssh_private_key > "/tmp/temp_ssh_key" | ||
| chmod 600 "/tmp/temp_ssh_key" | ||
|
|
||
| CLUSTER_VERSION=$(ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ | ||
| -i /tmp/temp_ssh_key "${BASTION_USER}@${BASTION_IP}" \ | ||
| "KUBECONFIG=${HUB_KUBECONFIG} oc get clusterversion version -ojsonpath='{.status.desired.version}'") | ||
|
|
||
| echo "Target hub cluster version: ${CLUSTER_VERSION}" | ||
| echo "${CLUSTER_VERSION}" > "${SHARED_DIR}/target_hub_version" |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
mkdir -pto avoid a hard failure when the directory already exists.With
set -e, a baremkdiraborts the whole step ifgroup_vars/host_varsalready exist in theeco-ci-cdinventory tree (e.g. on a retry or if the repo ships these dirs).-pmakes this idempotent.🛠️ Proposed fix
Also applies to: 52-52
🤖 Prompt for AI Agents