|
| 1 | +# devscripts_sno |
| 2 | + |
| 3 | +Deploy a Single Node OpenShift (SNO) cluster on libvirt/KVM using the |
| 4 | +[dev-scripts](https://github.com/openshift-metal3/dev-scripts) agent installer |
| 5 | +(`make agent`). |
| 6 | + |
| 7 | +This role is a thin wrapper around the `devscripts` role: it prepares secrets |
| 8 | +and host prerequisites, runs the dev-scripts configuration and host-prep steps, |
| 9 | +executes `make agent`, and copies the resulting kubeconfig to `~/.kube/config`. |
| 10 | + |
| 11 | +It complements the full `devscripts` deployment path (baremetal/libvirt with |
| 12 | +`make all`) and the physical bare metal path documented in |
| 13 | +[bm_sno](../bm_sno/README.md) (`cifmw_bm_sno: true`). |
| 14 | + |
| 15 | +When used from the reproducer, set `cifmw_devscripts_sno: true` so the |
| 16 | +`devscripts` configuration template exports SNO-specific variables (see |
| 17 | +[dev-scripts AGENTS.md](https://github.com/openshift-metal3/dev-scripts/blob/master/AGENTS.md)). |
| 18 | +That flag is separate from including this role by name; reproducer scenarios |
| 19 | +such as `scenarios/reproducers/va-hci-minimal-sno.yml` combine the flag with |
| 20 | +`cifmw_devscripts_config_overrides` for a one-master layout. |
| 21 | + |
| 22 | +## Parameters |
| 23 | + |
| 24 | +### Role-specific |
| 25 | + |
| 26 | +| Parameter | Type | Default | Description | |
| 27 | +| --- | --- | --- | --- | |
| 28 | +| `cifmw_devscripts_sno_installer_timeout` | int | `7200` | Seconds before `make agent` is killed by `timeout` (2 hours) | |
| 29 | +| `cifmw_devscripts_sno_repo_dir` | str | `~/src/github.com/openshift-metal3/dev-scripts` | Path to the dev-scripts repository | |
| 30 | +| `cifmw_devscripts_sno_data_dir` | str | `~/ci-framework-data` | Base directory for CI Framework data on the host | |
| 31 | +| `cifmw_devscripts_sno_artifacts_dir` | str | `{{ cifmw_devscripts_sno_data_dir }}/artifacts` | Directory for role script artifacts and logs | |
| 32 | + |
| 33 | +### Required for standalone use |
| 34 | + |
| 35 | +When running this role outside the reproducer playbook, provide secret content |
| 36 | +(the role writes files from these variables in `pre.yml`): |
| 37 | + |
| 38 | +| Parameter | Description | |
| 39 | +| --- | --- | |
| 40 | +| `cifmw_manage_secrets_citoken_content` | CI token string written to `cifmw_manage_secrets_citoken_file` | |
| 41 | +| `cifmw_manage_secrets_pullsecret_content` | Pull secret JSON written to `cifmw_manage_secrets_pullsecret_file` | |
| 42 | + |
| 43 | +Default secret file paths (from `defaults/main.yml`): |
| 44 | + |
| 45 | +| Parameter | Default | |
| 46 | +| --- | --- | |
| 47 | +| `cifmw_manage_secrets_citoken_file` | `{{ ansible_user_dir }}/secrets/ci_token` | |
| 48 | +| `cifmw_manage_secrets_pullsecret_file` | `{{ ansible_user_dir }}/secrets/pull_secret.json` | |
| 49 | + |
| 50 | +Alternatively, use the file-based variables documented in the |
| 51 | +[devscripts role README](../devscripts/README.md#secrets-management) if you |
| 52 | +integrate with `manage_secrets` directly. |
| 53 | + |
| 54 | +### SNO and dev-scripts configuration |
| 55 | + |
| 56 | +Set `cifmw_devscripts_sno: true` so `conf_ciuser.j2` exports the reduced SNO |
| 57 | +variable set (`NUM_MASTERS=1`, `NUM_WORKERS=0`, and agent-related keys). |
| 58 | + |
| 59 | +Cluster version, networking, and VM sizing are controlled through |
| 60 | +`cifmw_devscripts_config_overrides` (and optional |
| 61 | +`cifmw_devscripts_config_overrides_patch.*` keys), same as the `devscripts` |
| 62 | +role. See [devscripts README](../devscripts/README.md#parameters) and |
| 63 | +[Supported keys in cifmw_devscripts_config_overrides](../devscripts/README.md#supported-keys-in-cifmw_devscripts_config_overrides). |
| 64 | + |
| 65 | +Common SNO overrides (also used in `scenarios/reproducers/va-hci-minimal-sno.yml`): |
| 66 | + |
| 67 | +| Key | Example | Description | |
| 68 | +| --- | --- | --- | |
| 69 | +| `num_masters` | `1` | Single control-plane node | |
| 70 | +| `master_memory` | `16384` | Memory (MiB) for the master VM | |
| 71 | +| `master_disk` | `120` | Root disk size (GiB) | |
| 72 | +| `master_vcpu` | `12` | vCPUs for the master VM | |
| 73 | +| `agent_e2e_test_scenario` | `SNO_IPV4` | Agent installer test scenario | |
| 74 | +| `agent_platform_type` | `none` | Agent platform type | |
| 75 | +| `openshift_version` | `stable-4.18` | OpenShift version (minor or `stable-X.Y`) | |
| 76 | +| `openshift_release_type` | `ga` | Release type (`nightly`, `ga`, `okd`) | |
| 77 | +| `external_subnet_v4` | `192.168.111.0/24` | External network for the cluster | |
| 78 | +| `ip_stack` | `v4` | IP stack (`v4`, `v6`, `v6v4`) | |
| 79 | + |
| 80 | +Additional dev-scripts variables (for example `cifmw_devscripts_cpu_passthrough`, |
| 81 | +`cifmw_devscripts_host_bm_net_ip_addr`) follow the `devscripts` role |
| 82 | +documentation. |
| 83 | + |
| 84 | +## Task files |
| 85 | + |
| 86 | +| Task file | Description | |
| 87 | +| --- | --- | |
| 88 | +| `main.yml` | Orchestrates pre, QEMU ACL, setup, and post phases | |
| 89 | +| `pre.yml` | Maps role vars to `devscripts`, writes secrets, installs packages | |
| 90 | +| `prepare_qemu_home_access.yml` | Installs `acl`/`qemu-kvm` and grants `qemu` traverse on the user home | |
| 91 | +| `setup.yml` | Runs `devscripts` `build_config.yml` and `100_pre.yml`, then `make agent` | |
| 92 | +| `post.yml` | Copies cluster kubeconfig to `~/.kube/config` | |
| 93 | + |
| 94 | +## Examples |
| 95 | + |
| 96 | +### Standalone playbook |
| 97 | + |
| 98 | +See `example-playbook.yaml` in this role directory: |
| 99 | + |
| 100 | +```bash |
| 101 | +ansible-playbook \ |
| 102 | + -e @secrets.yaml \ |
| 103 | + -e @scenarios/reproducers/va-hci-minimal-sno.yml \ |
| 104 | + -i inventory.yaml \ |
| 105 | + roles/devscripts_sno/example-playbook.yaml |
| 106 | +``` |
| 107 | + |
| 108 | +Minimal `secrets.yaml` for standalone runs: |
| 109 | + |
| 110 | +```yaml |
| 111 | +cifmw_devscripts_sno: true |
| 112 | +cifmw_manage_secrets_citoken_content: "{{ lookup('env', 'CI_TOKEN') }}" |
| 113 | +cifmw_manage_secrets_pullsecret_content: | |
| 114 | + {{ lookup('file', lookup('env', 'HOME') ~ '/pull-secret') }} |
| 115 | +
|
| 116 | +cifmw_devscripts_config_overrides: |
| 117 | + openshift_version: "stable-4.18" |
| 118 | + openshift_release_type: ga |
| 119 | + num_masters: 1 |
| 120 | + master_memory: 16384 |
| 121 | + master_disk: 120 |
| 122 | + master_vcpu: 12 |
| 123 | + external_subnet_v4: 192.168.111.0/24 |
| 124 | + ip_stack: v4 |
| 125 | + agent_e2e_test_scenario: SNO_IPV4 |
| 126 | + agent_platform_type: none |
| 127 | +``` |
| 128 | +
|
| 129 | +### Reproducer scenario (libvirt SNO) |
| 130 | +
|
| 131 | +From `scenarios/reproducers/va-hci-minimal-sno.yml`: |
| 132 | + |
| 133 | +```yaml |
| 134 | +cifmw_devscripts_sno: true |
| 135 | +cifmw_reproducer_allow_one_ocp: true |
| 136 | +cifmw_devscripts_cpu_passthrough: true |
| 137 | +cifmw_devscripts_host_bm_net_ip_addr: "192.168.111.1" |
| 138 | +
|
| 139 | +cifmw_devscripts_config_overrides: |
| 140 | + num_masters: 1 |
| 141 | + master_memory: 16384 |
| 142 | + master_disk: 120 |
| 143 | + master_vcpu: 12 |
| 144 | + external_subnet_v4: 192.168.111.0/24 |
| 145 | + ip_stack: v4 |
| 146 | + agent_e2e_test_scenario: SNO_IPV4 |
| 147 | + agent_platform_type: none |
| 148 | + openshift_release_type: ga |
| 149 | + openshift_version: stable-4.18 |
| 150 | +``` |
| 151 | + |
| 152 | +After deployment, credentials are under the dev-scripts auth directory: |
| 153 | + |
| 154 | +```bash |
| 155 | +export KUBECONFIG=~/src/github.com/openshift-metal3/dev-scripts/ocp/ocp/auth/kubeconfig |
| 156 | +oc login -u kubeadmin \ |
| 157 | + -p "$(cat ~/src/github.com/openshift-metal3/dev-scripts/ocp/ocp/auth/kubeadmin-password)" |
| 158 | +``` |
| 159 | + |
| 160 | +## SNO deployment methods in CI Framework |
| 161 | + |
| 162 | +| Flag | Role / method | Environment | |
| 163 | +| --- | --- | --- | |
| 164 | +| `cifmw_devscripts_sno: true` | dev-scripts agent (`make agent`) on libvirt/KVM | Virtual machine on the hypervisor | |
| 165 | +| `cifmw_bm_sno: true` | `bm_sno` (agent-based, iDRAC Redfish) | Physical bare metal host | |
| 166 | + |
| 167 | +See [reproducer README](../reproducer/README.md#sno-deployment-methods) for how |
| 168 | +these paths fit into full reproducer jobs. |
| 169 | + |
| 170 | +## References |
| 171 | + |
| 172 | +* [devscripts role](../devscripts/README.md) |
| 173 | +* [bm_sno role](../bm_sno/README.md) |
| 174 | +* [dev-scripts](https://github.com/openshift-metal3/dev-scripts) |
| 175 | +* [dev-scripts agent installer](https://github.com/openshift-metal3/dev-scripts/tree/master/agent) |
| 176 | +* [dev-scripts AGENTS.md](https://github.com/openshift-metal3/dev-scripts/blob/master/AGENTS.md) |
| 177 | +* [dev-scripts config_example.sh](https://github.com/openshift-metal3/dev-scripts/blob/master/config_example.sh) |
0 commit comments