Skip to content

Commit

Permalink
scale worker patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mukrishn committed Mar 24, 2024
1 parent 4ffe6a4 commit 422f6ce
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions ansible-ipi-install/playbook-jetski-scaleup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- supermicro_nodes
- ocp_deploying_node_content
- nondeploying_worker_nodes_content
- worker_network_config_template
- quit_play

- hosts: provisioner
Expand Down
15 changes: 15 additions & 0 deletions ansible-ipi-install/roles/scale-bootstrap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,18 @@
- name: set ocp_nondeplopyed_node_content
set_fact:
nondeploying_worker_nodes_content: "{{ ocp_nondeployed_node_content | combine({'nodes': ocp_nondeployed_node_content.nodes|difference(scale_worker_node.nodes)}, recursive=True) }}"

- name: "Check ansible collection path - redhatci.ocp"
community.general.ansible_galaxy_install:
type: collection
name: redhatci.ocp
register: out

- set_fact:
collection_dir: "{{ item.key }}"
with_dict: "{{ out.installed_collections }}"
when: "item.value != {}"

- name: Set manifest directory path
set_fact:
worker_network_config_template: "{{ collection_dir }}/redhatci/ocp/roles/installer/files/worker_nmstate_file.yaml"
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
- name: Create network config secret for workers
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', bare-metal-network-config-secret, template_vars=dict(host_name=item.host_name,prov_nic=item.prov_nic,bm_nic=item.bm_nic)) | from_yaml }}"
loop: "{{ scale_worker_node.nodes }}"
loop_control:
extended: yes

- name: Create BareMetalHost definition file for new worker
template:
dest: "{{ scaling_dir }}/{{ item.host_name }}-bmh.yaml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ spec:
bootMACAddress: "{{ item.prov_mac }}"
{% if bootmode is defined and bootmode == 'legacy' %}
bootMode: legacy
{% endif %}
{% endif %}
{% if worker_network_config_template is defined %}
PreprovisioningNetworkDataName: "{{ item.host_name }}-network-config-secret"
{% endif %}
userData:
name: worker-user-data
namespace: openshift-machine-api
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
data:
nmstate: {{ lookup('template', worker_network_config_template, template_vars=dict(provision_nic=prov_nic,baremetal_nic=bm_nic)) | b64encode }}
kind: Secret
metadata:
name: "{{ host_name }}-network-config-secret"
namespace: openshift-machine-api

0 comments on commit 422f6ce

Please sign in to comment.