Skip to content
Draft
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
1 change: 1 addition & 0 deletions roles/devscripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ networks.
* `cifmw_devscripts_cinder_volume_pvs` (list) a list of physical disks to be
used for creating cinder-volumes volume-group. By default, the list contains
`/dev/vda`.
* `cifmw_devscripts_sno` (bool) Enable Single Node OpenShift. Defaults to `false`.

### Secrets management

Expand Down
1 change: 1 addition & 0 deletions roles/devscripts/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ cifmw_devscripts_config_overrides: {}
cifmw_devscripts_installer_timeout: 7200 # 2 hours
cifmw_devscripts_etcd_slow_profile: true
cifmw_devscripts_disable_console: false
cifmw_devscripts_sno: false
11 changes: 11 additions & 0 deletions roles/devscripts/tasks/310_prepare_overlay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@
uri: "qemu:///system"
loop: "{{ _current_vms.list_vms | select('match', matcher) }}"

- name: Undefine all nodes part of OpenShift platform when SNO node with NVRAM removal
when:
- cifmw_devscripts_sno | default(false) | bool
community.libvirt.virt:
command: "undefine"
flags:
- "nvram"
- "snapshots_metadata"
name: "ocp_master_0"
uri: "qemu:///system"

- name: Disable online cluster flag
when:
- cifmw_devscripts_ocp_online | bool
Expand Down
7 changes: 7 additions & 0 deletions roles/devscripts/tasks/build_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
devscripts_config_patches
}}

- name: Check if num_masters is equal to 1 when cifmw_devscripts_sno
when: cifmw_devscripts_sno and cifmw_devscripts_config['num_masters'] | int != 1
ansible.builtin.fail:
msg: >-
Make sure, vms.ocp.amount (num_masters) is set to 1,
when SNO scenario is set.

- name: Replace OCP version if "stable-" alias used
when:
- cifmw_devscripts_config.openshift_version.startswith("stable-")
Expand Down
9 changes: 9 additions & 0 deletions roles/devscripts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,19 @@
}}
block:
- name: Run devscripts make all
when: not cifmw_devscripts_sno | default(false)
cifmw.general.ci_script:
chdir: "{{ cifmw_devscripts_repo_dir }}"
output_dir: "{{ cifmw_devscripts_artifacts_dir }}"
script: "timeout {{ cifmw_devscripts_installer_timeout }} make all"

- name: Run devscripts make agent when SNO
when: cifmw_devscripts_sno | default(false)
cifmw.general.ci_script:
chdir: "{{ cifmw_devscripts_repo_dir }}"
output_dir: "{{ cifmw_devscripts_artifacts_dir }}"
script: "timeout {{ cifmw_devscripts_installer_timeout }} make agent"

always:
- name: Gather logs
register: _deploy_logs
Expand Down
34 changes: 34 additions & 0 deletions roles/devscripts/templates/conf_ciuser.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,40 @@ set +x
export CI_TOKEN=$(cat {{ cifmw_devscripts_repo_dir }}/ci_token)
set -x

{% if not cifmw_devscripts_sno %}
{% for item in cifmw_devscripts_config %}
export {{ item.upper() }}="{{ cifmw_devscripts_config[item] }}"
{% endfor %}
{% endif %}


{% if cifmw_devscripts_sno %}

{% for item in ['working_dir', 'assets_extra_folder', 'openshift_release_type',
'openshift_version', 'cluster_name', 'base_domain', 'ntp_servers',
'external_bootstrap_mac', 'vm_extradisks',
'vm_extradisks_list', 'ssh_pub_key'] %}
export {{ item.upper() }}="{{ cifmw_devscripts_config[item] }}"
{% endfor %}
# https://github.com/openshift-metal3/dev-scripts/blob/master/agent/docs/none-and-external-platform.md
# https://github.com/openshift-metal3/dev-scripts/blob/master/common.sh#L470
# SNO Configuration
export IP_STACK="v4"
export AGENT_E2E_TEST_SCENARIO="SNO_IPV4"
export AGENT_PLATFORM_TYPE="none"
export NUM_MASTERS=1
export NUM_WORKERS=0

# https://github.com/openshift-metal3/dev-scripts/blob/master/network.sh
# https://github.com/openshift-metal3/dev-scripts/blob/master/vm_setup_vars.yml
# it needs to be 192.168.111.80, with 122.0/24 it fails.
# EXTERNAL_SUBNET_V4="192.168.122.0/24"

#export RENDEZVOUS_IP="192.168.122.10"
# export API_VIP="192.168.111.10"
# # export INGRESS_VIP="192.168.111.4"
# export PROVISIONING_HOST_IP="192.168.111.1"
# # export CLUSTER_DHCP_RANGE="192.168.111.10,192.168.111.100"
# #export DNS_IP="{{ ansible_default_ipv4.address }}"
# export DNS_IP="192.168.111.1"
{% endif %}
7 changes: 7 additions & 0 deletions roles/dnsmasq/tasks/manage_host_record.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@
vars:
short_name: "{{ record.names[0] | regex_replace('^([^.]+)\\..*$', '\\1') }}"
ip: "{{ record.ips[0] }}"

- name: Remove crc.testing from host_records
when: cifmw_devscripts_sno | default(false)
become: true
ansible.builtin.shell: |
sed -i '/crc.testing/d' {{ cifmw_dnsmasq_basedir }}/host_records.conf
notify: Restart dnsmasq
15 changes: 15 additions & 0 deletions roles/libvirt_manager/tasks/add_vm_to_inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@
insertafter: "^\\[{{ _group }}s\\]$"
line: "{{ _ini_line }}"
regexp: "^{{ _full_host_name | regex_escape() }} "

- name: daniel debug
ansible.builtin.copy:
content: |
{{ _vm_type | default('vm_type') }}
{{ _std_group | default('std_group') }}
{{ _group | default('group') }}
{{ _ocp_name | default('ocp_name') }}
{{ _hostname | default('hostname') }}
{{ _ssh_user | default('sshuser') }}
{{ _add_ansible_host | default('add_ansible_host') }}
{{ _ansible_host | default('ansible_host') }}
{{ _full_host_name | default('fullhostname') }}
{{ _ini_line | default('ini_line') }}
dest: "{{ ansible_user_dir }}/{{ _ocp_name | default('test') }}"
10 changes: 5 additions & 5 deletions roles/libvirt_manager/tasks/generate_networking_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@
-y --list > {{ cifmw_libvirt_manager_dst_inv_file }}
ignore_errors: true # noqa: ignore-errors

- name: Remove ini file after conversion
when: _libvirt_inv_file.stat.exists
ansible.builtin.file:
path: "{{ cifmw_libvirt_manager_tmp_inv_file }}"
state: absent
#- name: Remove ini file after conversion
# when: _libvirt_inv_file.stat.exists
# ansible.builtin.file:
# path: "{{ cifmw_libvirt_manager_tmp_inv_file }}"
# state: absent

- name: Generate all IPs based on MAC and networks
vars:
Expand Down
39 changes: 3 additions & 36 deletions roles/reproducer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ None
* `cifmw_reproducer_supported_hypervisor_os`: (List) List of supported hypervisor operating systems and their minimum version.
* `cifmw_reproducer_minimum_hardware_requirements`: (Dict) Define minimum hardware requirements for specific scenarios. Example below
* `cifmw_reproducer_computes_rhos_release_args`: (String) Arguments to use when installing rhos-release repos on compute nodes. Not defined by default, and `cifmw_repo_setup_rhos_release_args` is used instead.
* `cifmw_reproducer_allow_one_ocp` (Bool) Allow to deploy OpenShift cluster just with one master node.
NOTE: When using devscript, remember to set `cifmw_devscripts_sno` to `true`, otherwise it would fail.
If you don't set `cifmw_devscripts_sno` to `true`, minimum value for `ocp` nodes is `2`.

### Advanced parameters
Those parameters shouldn't be used, unless the user is able to understand potential issues in their environment.
Expand Down Expand Up @@ -55,40 +58,4 @@ Please follow the [documentation about the overall "reproducer" feature](https:/
#### Local repositories on your laptop
```YAML
local_home_dir: "{{ lookup('env', 'HOME') }}"
local_base_dir: "{{ local_home_dir }}/src/github.com/openstack-k8s-operators"
remote_base_dir: "/home/zuul/src/github.com/openstack-k8s-operators"
cifmw_reproducer_repositories:
- src: "{{ local_base_dir }}/ci-framework"
dest: "{{ remote_base_dir }}"
- src: "{{ local_base_dir }}/install_yamls"
dest: "{{ remote_base_dir }}"
```
Notes:
* `ansible_user_dir` isn't really usable due to the use of `delegate_to` in order to sync those local repositories.
* You therefore really want to use absolute paths - while the `dest` may be relative with the use of a plain `rsync` command

#### Github code
```YAML
remote_base_dir: "/home/zuul/src/github.com/openstack-k8s-operators"
cifmw_reproducer_repositories:
# Fetch specific version
- src: "https://github.com/cjeanner/ci-framework"
dest: "{{ remote_base_dir }}/ci-framework"
version: some-version
# Fetch a pull-request and checkout the specific content
- src: "https://github.com/foo/install_yamls"
dest: "{{ remote_base_dir }}/install_yamls"
refspec: pull/510/head:my-patch
version: my-patch
# Just get HEAD
- src: "https://github.com/openstack-k8s-operators/openstack-operators"
dest: "{{ remote_base_dir }}/openstack-operators"
```

#### Example `cifmw_reproducer_minimum_hardware_requirements`:
```YAML
cifmw_reproducer_minimum_hardware_requirements:
vcpu: 16
memory: "32 GB"
disk: "200 GB"
```
2 changes: 2 additions & 0 deletions roles/reproducer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ cifmw_reproducer_ironic_node_name_prefix:
# switch_id: "22:57:f8:dd:04:02"
# port_id: "ethernet1/2"
cifmw_reproducer_ironic_local_link_connections: {}

cifmw_reproducer_allow_one_ocp: false
5 changes: 3 additions & 2 deletions roles/reproducer/tasks/ocp_layout_assertions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@
- _element.disksize is defined
- _element.disksize | int > _disk
- _element.amount is defined
- _element.amount >= _min_ocp
- _element.amount >= _min_ocp or cifmw_reproducer_allow_one_ocp
quiet: true
msg: >-
Ensure you provide enough memory (>=16), cpus (>=10) and
disksize (>50) to ocp nodes, set a correct amount (>=3)
and uefi is set to true in cifmw_libvirt_manager.vms.ocp
or set local setup (cifmw_reproducer_allow_one_ocp) and
uefi is set to true in cifmw_libvirt_manager.vms.ocp

- name: Ensure we have needed data for ocp_worker if defined
when:
Expand Down
131 changes: 131 additions & 0 deletions scenarios/reproducers/va-hci-minimal-sno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
cifmw_parent_scenario: "scenarios/reproducers/va-hci-base.yml"

cifmw_devscripts_sno: true
cifmw_reproducer_allow_one_ocp: true
# Time for "killing" metal3 bootstrap script, because
# it would not finish itself (workaround needed).
# Check 07-sno-workaround.sh provided by
# roles/devscripts/tasks/main.yml play.
cifmw_devscripts_sno_bootstrap_timeout: 1800

# HERE if you want to override kustomization, you can uncomment this parameter
# and push the data structure you want to apply.
# cifmw_architecture_user_kustomize:
# stage_0:
# 'network-values':
# data:
# starwars: Obiwan

# HERE, if you want to stop the deployment loop at any stage, you can uncomment
# the following parameter and update the value to match the stage you want to
# reach. Known stages are:
# pre_kustomize_stage_INDEX
# pre_apply_stage_INDEX
# post_apply_stage_INDEX
#
# cifmw_deploy_architecture_stopper:

cifmw_libvirt_manager_configuration:
# NOTE: Important not to add '<dns enable="no"/>' into 'ocpbm' network.
networks:
osp_trunk: |
<network>
<name>osp_trunk</name>
<forward mode='nat'/>
<bridge name='osp_trunk' stp='on' delay='0'/>
<ip family='ipv4'
address='{{ cifmw_networking_definition.networks.ctlplane.network |
ansible.utils.nthhost(1) }}'
prefix='{{ cifmw_networking_definition.networks.ctlplane.network |
ansible.utils.ipaddr('prefix') }}'>
</ip>
</network>
ocpbm: |
<network>
<name>ocpbm</name>
<forward mode='nat'/>
<bridge name='ocpbm' stp='on' delay='0'/>
<ip family='ipv4' address='192.168.111.1' prefix='24'>
</ip>
</network>
ocppr: |
<network>
<name>ocppr</name>
<forward mode='bridge'/>
<bridge name='ocppr'/>
</network>
vms:
# https://github.com/openshift-metal3/dev-scripts/blob/master/common.sh#L470
ocp:
amount: 1
admin_user: core
image_local_dir: "{{ cifmw_basedir }}/images/"
disk_file_name: "ocp_master"
disksize: "100"
extra_disks_num: 3
extra_disks_size: "50G"
cpus: 16
memory: 32
root_part_id: 4
uefi: true
nets:
- ocppr
- ocpbm
- osp_trunk
compute:
uefi: "{{ cifmw_use_uefi }}"
root_part_id: "{{ cifmw_root_partition_id }}"
amount: "{{ [cifmw_libvirt_manager_compute_amount|int, 3] | max }}"
image_url: "{{ cifmw_discovered_image_url }}"
sha256_image_name: "{{ cifmw_discovered_hash }}"
image_local_dir: "{{ cifmw_basedir }}/images/"
disk_file_name: "base-os.qcow2"
disksize: "{{ [cifmw_libvirt_manager_compute_disksize|int, 50] | max }}"
memory: "{{ [cifmw_libvirt_manager_compute_memory|int, 8] | max }}"
cpus: "{{ [cifmw_libvirt_manager_compute_cpus|int, 4] | max }}"
extra_disks_num: 3
extra_disks_size: 30G
nets:
- ocpbm
- osp_trunk
controller:
uefi: "{{ cifmw_use_uefi }}"
root_part_id: "{{ cifmw_root_partition_id }}"
image_url: "{{ cifmw_discovered_image_url }}"
sha256_image_name: "{{ cifmw_discovered_hash }}"
image_local_dir: "{{ cifmw_basedir }}/images/"
disk_file_name: "base-os.qcow2"
disksize: 50
memory: 8
cpus: 4
nets:
- ocpbm
- osp_trunk

## devscript support for OCP deploy
cifmw_devscripts_config_overrides:
fips_mode: "{{ cifmw_fips_enabled | default(false) | bool }}"
num_masters: 1

# Note: with that extra_network_names "osp_trunk", we instruct
# devscripts role to create a new network, and associate it to
# the OCP nodes. This one is a "private network", and will hold
# the VLANs used for network isolation.

# Please create a custom env file to provide:
# cifmw_devscripts_ci_token:
# cifmw_devscripts_pull_secret:

# Test Ceph file and object storage (block is enabled by default)
cifmw_ceph_daemons_layout:
rgw_enabled: true
dashboard_enabled: false
cephfs_enabled: true
ceph_nfs_enabled: false

# Vars related to update_containers cinder volume and manila share
cifmw_update_containers_cindervolumes:
- ceph
cifmw_update_containers_manilashares:
- share1
Loading