Skip to content

Commit 1be432e

Browse files
committed
oci patchs: Platform External and CCM manifests
1 parent d7eb4fe commit 1be432e

23 files changed

+624
-30
lines changed

docs/guides/installing-agnostic-oci.md

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,21 @@ OCI_COMPARTMENT_ID_IMAGE="<CHANGE_ME:ocid1.compartment.oc1.UUID>"
153153
EOF
154154
source ~/.oci/env
155155

156-
cat <<EOF > ./vars-oci-ha.yaml
156+
cat <<EOF > ~/.openshift/env
157+
export OCP_CUSTOM_RELEASE="docker.io/mtulio/ocp-release:latest"
158+
159+
OCP_RELEASE_413="quay.io/openshift-release-dev/ocp-release:4.13.0-ec.4-x86_64"
160+
EOF
161+
source ~/.openshift/env
162+
163+
CLUSTER_NAME=oci-cr3cmo
164+
cat <<EOF > ./vars-oci-ha_${CLUSTER_NAME}.yaml
157165
provider: oci
158-
cluster_name: oci
166+
cluster_name: ${CLUSTER_NAME}
159167
config_cluster_region: us-sanjose-1
160168
169+
#TODO: create compartment validations
170+
#TODO: allow create compartment from a parent
161171
oci_compartment_id: ${OCI_COMPARTMENT_ID}
162172
oci_compartment_id_dns: ${OCI_COMPARTMENT_ID_DNS}
163173
oci_compartment_id_image: ${OCI_COMPARTMENT_ID_IMAGE}
@@ -169,10 +179,10 @@ config_base_domain: splat-oci.devcluster.openshift.com
169179
config_ssh_key: "$(cat ~/.ssh/id_rsa.pub)"
170180
config_pull_secret_file: "${HOME}/.openshift/pull-secret-latest.json"
171181
172-
config_cluster_version: 4.13.0-ec.3-x86_64
182+
#config_cluster_version: 4.13.0-ec.3-x86_64
173183
version: 4.13.0-ec.3
174-
#config_installer_environment:
175-
# OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE: "quay.io/openshift-release-dev/ocp-release:4.13.0-ec.4-x86_64"
184+
config_installer_environment:
185+
OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE: "${OCP_CUSTOM_RELEASE}"
176186
177187
controlplane_instance: VM.Standard3.Flex
178188
controlplane_instance_spec:
@@ -204,7 +214,41 @@ os_mirror_to_oci:
204214
image_type: QCOW2
205215
#image_type: VMDK
206216
217+
218+
## Apply patches to installer manifests (WIP)
219+
220+
# TODO: we must keep the OCI CCM manifests patch more generic
221+
222+
config_patches:
223+
- rm-capi-machines
224+
#- platform-external-kubelet # PROBLEM hangin kubelete (network)
225+
#- platform-external-kcmo
226+
- deploy-oci-ccm
227+
- yaml_patch # working for OCI, but need to know the path
228+
#- line_regex_patch # ideal, but not working as expected
229+
230+
cfg_patch_yaml_patch_specs:
231+
## patch infra object to create External provider
232+
- manifest: /manifests/cluster-infrastructure-02-config.yml
233+
patch: '{"spec":{"platformSpec":{"type":"External","external":{"platformName":"oci"}}},"status":{"platform":"External","platformStatus":{"type":"External","external":{}}}}'
234+
235+
## OCI : Change the namespace from downloaded assets
236+
#- manifest: /manifests/oci-cloud-controller-manager-02.yaml
237+
# patch: '{"metadata":{"namespace":"oci-cloud-controller-manager"}}'
238+
239+
cfg_patch_line_regex_patch_specs:
240+
- manifest: /manifests/oci-cloud-controller-manager-01-rbac.yaml
241+
#search_string: 'namespace: kube-system'
242+
regexp: '^(.*)(namespace\\: kube-system)$'
243+
#line: 'namespace: oci-cloud-controller-manager'
244+
line: '\\1namespace: oci-cloud-controller-manager'
245+
246+
- manifest: /manifests/oci-cloud-controller-manager-02.yaml
247+
regexp: '^(.*)(namespace\\: kube-system)$'
248+
line: '\\1namespace: oci-cloud-controller-manager'
207249
EOF
250+
251+
208252
```
209253

210254
### Install the clients
@@ -295,6 +339,28 @@ ansible-playbook mtulio.okd_installer.create_node \
295339
oc adm certificate approve $(oc get csr -o json |jq -r '.items[] | select(.status.certificate == null).metadata.name')
296340
```
297341

342+
### Create all
343+
344+
```bash
345+
ansible-playbook mtulio.okd_installer.create_all \
346+
-e certs_max_retries=20 \
347+
-e cert_wait_interval_sec=60 \
348+
-e @./vars-oci-ha.yaml
349+
```
350+
351+
> TO DO: measure total time
352+
353+
## Review the cluster
354+
355+
```bash
356+
export KUBECONFIG=${HOME}/.ansible/okd-installer/clusters/${cluster_name}/auth/kubeconfig
357+
358+
oc get nodes
359+
oc get co
360+
```
361+
362+
## OPCT setup
363+
298364
- Create the OPCT [dedicated] node
299365

300366
> https://redhat-openshift-ecosystem.github.io/provider-certification-tool/user/#option-a-command-line
@@ -344,30 +410,14 @@ oc adm taint node opct-01.priv.ocp.oraclevcn.com node-role.kubernetes.io/tests="
344410
~/opct/bin/openshift-provider-cert-linux-amd64-v0.3.0 report *.tar.gz
345411
```
346412

413+
## Generate custom image
347414

348-
### Create all
349-
350-
```bash
351-
ansible-playbook mtulio.okd_installer.create_all \
352-
-e @./vars-oci-ha.yaml \
353-
-e certs_max_retries=20 \
354-
-e cert_wait_interval_sec=60
355415
```
356416
357-
> TO DO: measure total time
358-
359-
## Review the cluster
360-
361-
```bash
362-
export KUBECONFIG=${HOME}/.ansible/okd-installer/clusters/${cluster_name}/auth/kubeconfig
363-
364-
oc get nodes
365-
oc get co
366417
```
367418

368419
## Destroy
369420

370421
```bash
371-
ansible-playbook mtulio.okd_installer.destroy_cluster \
372-
-e @./vars-oci-ha.yaml
422+
ansible-playbook mtulio.okd_installer.destroy_cluster -e @./vars-oci-ha.yaml
373423
```

playbooks/create_all.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
vars:
1818
mode: create
1919

20+
- name: OKD Installer | Create all | create stack | IAM
21+
ansible.builtin.import_playbook: stack_iam.yaml
22+
2023
- name: OKD Installer | Create all | os_mirror
2124
ansible.builtin.import_playbook: os_mirror.yaml
2225
when: os_mirror | d(false)
2326

2427
- name: OKD Installer | Create all | create stack | network
2528
ansible.builtin.import_playbook: stack_network.yaml
2629

27-
- name: OKD Installer | Create all | create stack | IAM
28-
ansible.builtin.import_playbook: stack_iam.yaml
29-
3030
- name: OKD Installer | Create all | create stack | DNS
3131
ansible.builtin.import_playbook: stack_dns.yaml
3232

playbooks/group_vars/all.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ collection_cluster_dir: "{{ bindir | d(collection_work_dir + '/clusters') }}"
99

1010
config_install_dir: "{{ collection_cluster_dir }}/{{ cluster_name }}"
1111
bin_openshift_install: "{{ collection_bin_dir }}/openshift-install"
12-
bin_oc: "{{ collection_bin_dir }}/openshift-install"
12+
bin_oc: "{{ collection_bin_dir }}/oc"
1313

1414
## export CONFIG_PULL_SECRET_FILE=${HOME}/.openshift/pull-secret-latest.jso
1515
config_pull_secret_file: "{{ lookup('ansible.builtin.env', 'CONFIG_PULL_SECRET_FILE') }}"

playbooks/vars/oci/profiles/ha/node-bootstrap.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,21 @@ compute_resources:
8787
# availability_domain: Uocm:PHX-AD-1
8888
agent_config:
8989
are_all_plugins_disabled: true
90-
90+
91+
# Disk Configuration
92+
preserve_boot_volume: false
9193
source_details:
9294
source_type: image
9395
boot_volume_size_in_gbs: 120
9496
boot_volume_vpus_per_gb: 30
9597

98+
# that config will prevent actions like stop/start (not desired)
99+
# preemptible_instance_config:
100+
# preemption_action:
101+
# preserve_boot_volume: false
102+
# type: TERMINATE
103+
104+
# Network
96105
create_vnic_details:
97106
display_name: "{{ cluster_state.infra_id }}-bootstrap-vnic0"
98107
assign_public_ip: true
@@ -108,6 +117,10 @@ compute_resources:
108117
metadata:
109118
user_data: "{{ lookup('template', 'ocp-bootstrap-user-data.j2') | to_nice_json | string | b64encode }}"
110119

120+
# launch_options:
121+
# firmware: BIOS
122+
# boot_volume_type: PARAVIRTUALIZED
123+
111124
callbacks:
112125
- name: nlb
113126
# nlb_name: ocp-nlb

playbooks/vars/oci/profiles/ha/node-compute.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ compute_resources:
3535
# OCI spec
3636
spec:
3737
state: present
38+
wait: no
3839
compartment_id: "{{ oci_compartment_id }}"
3940
display_name: "{{ cluster_state.infra_id }}-worker-01"
4041
region: "{{ config_cluster_region }}"
@@ -95,6 +96,7 @@ compute_resources:
9596
# OCI spec
9697
spec:
9798
state: present
99+
wait: no
98100
compartment_id: "{{ oci_compartment_id }}"
99101
display_name: "{{ cluster_state.infra_id }}-worker-02"
100102
region: "{{ config_cluster_region }}"
@@ -155,6 +157,7 @@ compute_resources:
155157
# OCI spec
156158
spec:
157159
state: present
160+
wait: no
158161
compartment_id: "{{ oci_compartment_id }}"
159162
display_name: "{{ cluster_state.infra_id }}-worker-03"
160163
region: "{{ config_cluster_region }}"

playbooks/vars/oci/profiles/ha/node-controlplane.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ compute_resources:
3434
# OCI spec
3535
spec:
3636
state: present
37+
wait: no
3738
compartment_id: "{{ oci_compartment_id }}"
3839
display_name: "{{ cluster_state.infra_id }}-master-01"
3940
region: "{{ config_cluster_region }}"
@@ -94,6 +95,7 @@ compute_resources:
9495
# OCI spec
9596
spec:
9697
state: present
98+
wait: no
9799
compartment_id: "{{ oci_compartment_id }}"
98100
display_name: "{{ cluster_state.infra_id }}-master-02"
99101
region: "{{ config_cluster_region }}"
@@ -154,6 +156,7 @@ compute_resources:
154156
# OCI spec
155157
spec:
156158
state: present
159+
wait: yes
157160
compartment_id: "{{ oci_compartment_id }}"
158161
display_name: "{{ cluster_state.infra_id }}-master-03"
159162
region: "{{ config_cluster_region }}"

roles/cloud_network

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
- name: Patch | Create OCI CCM NS
3+
ansible.builtin.template:
4+
src: patches/oci-ccm-ns.yaml.j2
5+
dest: "{{ config_install_dir }}/manifests/oci-cloud-controller-manager-00-namespace.yaml"
6+
mode: 0644
7+
8+
- name: Patch | Create OCI CCM RBAC
9+
ansible.builtin.template:
10+
src: patches/oci-cloud-controller-manager-rbac.yaml.j2
11+
dest: "{{ config_install_dir }}/manifests/oci-cloud-controller-manager-01-rbac.yaml"
12+
mode: 0644
13+
14+
- name: Patch | Create OCI CCM Secret
15+
ansible.builtin.set_fact:
16+
oci_ccm_secret_data: "{{ lookup('template', 'patches/oci-ccm-secret-data.yaml.j2') | from_yaml }}"
17+
18+
- name: Patch | Create OCI CCM Secret
19+
ansible.builtin.template:
20+
src: patches/oci-ccm-secret.yaml.j2
21+
dest: "{{ config_install_dir }}/manifests/oci-cloud-controller-manager-01-secret.yaml"
22+
mode: 0644
23+
vars:
24+
oci_compartment_id: oci_compartment_id
25+
26+
- name: Patch | Create OCI CCM
27+
ansible.builtin.template:
28+
src: patches/oci-cloud-controller-manager.yaml.j2
29+
dest: "{{ config_install_dir }}/manifests/oci-cloud-controller-manager-02.yaml"
30+
mode: 0644
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
- name: Config | Patch manifests | Line regex
3+
ansible.builtin.lineinfile:
4+
path: "{{ config_install_dir }}{{ patch_spec.manifest }}"
5+
# search_string: "{{ patch_spec.search_string }}"
6+
# line: "{{ patch_spec.line }}"
7+
backrefs: true
8+
regexp: "{{ patch_spec.regexp }}"
9+
line: "{{ patch_spec.line }}"
10+
loop: "{{ cfg_patch_line_regex_patch_specs }}"
11+
loop_control:
12+
loop_var: patch_spec

0 commit comments

Comments
 (0)