Skip to content

[patch] Add ability to set maxUnavailable for machine configs #1828

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
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions ibm/mas_devops/common_tasks/wait-machine-config-update.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
---
# 1. Wait for node pools to start updating
# 1. Set maxUnavailable
# A typical airgap test environment will consist of 3 master nodes and 11 worker nodes
# the test will require the machine config pool to be updated twice (once as part of the
# airgpa set and a second time to simulate an airgap environment)
# by setting MACHINE_CONFIG_MULTIUPDATE we change the worker pool to update 3 nodes at
# a time significantly reducing the setup time. This does not modify the master machine
# config pool as with only 3 master nodes trying to update multiple master nodes can
# cause deadlocks due to trying to drain 2 in parallel and the third not being able to
# contain all the pods
# -----------------------------------------------------------------------------
- name: Set worker maxUnavailable
kubernetes.core.k8s_json_patch:
api_version: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
name: worker
patch:
- op: add
path: /spec/maxUnavailable
value: 3
when:
- machine_config_multiupdate is defined
- machine_config_multiupdate

# 2. Wait for node pools to start updating
# -----------------------------------------------------------------------------
- name: Wait for node pools to start updating
kubernetes.core.k8s_info:
Expand All @@ -18,7 +41,7 @@
- "worker"
- "master"

# 2. Wait for node pools to finish updating
# 3. Wait for node pools to finish updating
# -----------------------------------------------------------------------------
- name: Wait for node pools to finish updating
kubernetes.core.k8s_info:
Expand Down
8 changes: 8 additions & 0 deletions ibm/mas_devops/roles/ocp_idms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ An optional prefix to apply to the catalog sources names for the 3 Red Hat catal
- Environment Variable: `REDHAT_CATALOGS_PREFIX`
- Default: None

### machine_config_multiupdate
An optional value that if present will set the max unavailable nodes for the worker Machine Config Pool.
This is only recommended to be set during setup of an environment where nodes will be lightly loaded and
draining multiple worker nodes in parallel is possible

- Optional
- Environment Variable: `MACHINE_CONFIG_MULTIUPDATE`
- Default: false

Example Playbook
-------------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions ibm/mas_devops/roles/ocp_idms/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ idms_suffix_redhat: "{% if registry_prefix_redhat | length > 0 %}-{{ registry_pr
# Optional Red Hat CatalogSource Name Prefix
# -----------------------------------------------------------------------------
redhat_catalogs_prefix: "{{ lookup('env', 'REDHAT_CATALOGS_PREFIX') | default('', true) }}"

machine_config_multiupdate: "{{ lookup('env','MACHINE_CONFIG_MULTIUPDATE') | default('False',true) | bool}}"
4 changes: 4 additions & 0 deletions ibm/mas_devops/roles/ocp_login/tasks/login-fyre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
login_server: "https://{{ api_host }}:6443"
shell: |
oc login -u kubeadmin -p {{ login_password }} --server={{ login_server }} --insecure-skip-tls-verify=true
register: login_result
retries: 10
delay: 30 # seconds
until: login_result.rc == 0

# 6. For IPv6 testing, lookup network
- name: Lookup network for IPv6 testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ airgap_network_exclusions: "quay.io registry.redhat.io registry.connect.redhat.c

registry_private_ca_file: "{{ lookup('env', 'REGISTRY_PRIVATE_CA_FILE') }}"
registry_private_ca_crt: "{{ lookup('file', registry_private_ca_file) }}"
machine_config_multiupdate: "{{ lookup('env','MACHINE_CONFIG_MULTIUPDATE') | default('False',true) | bool}}"
Loading