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 0aa4c46
Show file tree
Hide file tree
Showing 5 changed files with 44 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"
17 changes: 17 additions & 0 deletions ansible-ipi-install/roles/scale-worker/tasks/20_create_bmh.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
- name: Create network config secret for workers
template:
dest: "{{ scaling_dir }}/{{ item.host_name }}-network-config-secret.yaml"
src: bare-metal-network-config-secret.yaml.j2
loop: "{{ scale_worker_node.nodes }}"
loop_control:
extended: yes

- name: Apply network config secret for workers
environment:
KUBECONFIG: "{{ kubeconfig_file }}"
shell: |
oc apply -f {{ scaling_dir }}/{{ item.host_name }}-network-config-secret.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=item.prov_nic,baremetal_nic=item.bm_nic)) | b64encode }}
kind: Secret
metadata:
name: "{{ item.host_name }}-network-config-secret"
namespace: openshift-machine-api

0 comments on commit 0aa4c46

Please sign in to comment.