Skip to content

Commit 72c50af

Browse files
Merge pull request #118 from aishwaryabk/hyp-het
To add heterogeneous hypershift agent-based installation
2 parents 723fdc1 + 166adc4 commit 72c50af

File tree

9 files changed

+200
-26
lines changed

9 files changed

+200
-26
lines changed

examples/all.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ logging_e2e_testcases: "" #Set to either all or critical
427427
hypershift_agent_install: false
428428
hypershift_agent_destroy: false #Enable only to destroy the hosted cluster
429429
acm_mce_install: false
430+
heterogeneous_install: false
430431
hosted_cluster_name: "hypershift-hosted"
431432
acm_catalogsource_name: "redhat-operators-acm"
432433
acm_catalogsource_image: ""
@@ -437,16 +438,20 @@ mce_upgrade_channel: "stable-2.7"
437438
base_domain: "qe-ppc64le.cis.ibm.net"
438439
pull_secret_file: "~/.pullSecret"
439440
ocp_release: ""
440-
arch: "ppc64le"
441+
ocp_release_image: ""
442+
arch_ppc: "ppc64le"
443+
arch_x86: "x86_64"
441444
hypershift_dir: "/root/hypershift"
442445
hypershift_git_repo: "https://github.com/openshift/hypershift"
443446
hypershift_git_branch: "main"
444447
cluster_namespace: "clusters"
445448
ssh_pub_key: ""
446449
db_volume_size: "10Gi"
447450
fs_volume_size: "100Gi"
448-
iso_url: ""
449-
root_fs_url: ""
451+
iso_url_ppc: ""
452+
root_fs_url_ppc: ""
453+
iso_url_x86: ""
454+
root_fs_url_x86: ""
450455

451456
# ocp-lso vars
452457
lso_enabled: false #set to true for lso operator installation

examples/hypershift_agent.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
hypershift_agent_install: false
55
hypershift_agent_destroy: false #Enable only to destroy the hosted cluster
66
acm_mce_install: false
7+
heterogeneous_install: false
78
hosted_cluster_name: "hypershift-hosted"
89
acm_catalogsource_name: "redhat-operators-acm"
910
acm_catalogsource_image: ""
@@ -14,13 +15,17 @@ mce_upgrade_channel: "stable-2.7"
1415
base_domain: "qe-ppc64le.cis.ibm.net"
1516
pull_secret_file: "~/.pullSecret"
1617
ocp_release: ""
17-
arch: "ppc64le"
18+
ocp_release_image: ""
19+
arch_ppc: "ppc64le"
20+
arch_x86: "x86_64"
1821
hypershift_dir: "/root/hypershift"
1922
hypershift_git_repo: "https://github.com/openshift/hypershift"
2023
hypershift_git_branch: "main"
2124
cluster_namespace: "clusters"
2225
ssh_pub_key: ""
2326
db_volume_size: "10Gi"
2427
fs_volume_size: "100Gi"
25-
iso_url: ""
26-
root_fs_url: ""
28+
iso_url_ppc: ""
29+
root_fs_url_ppc: ""
30+
iso_url_x86: ""
31+
root_fs_url_x86: ""

playbooks/roles/hypershift-agent/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Common variables used for both hypershift deployment and destroy operations:
1515
| hypershift_agent_install | no | false | Enable it to install the hosted cluster |
1616
| hypershift_agent_destroy | no | false | Enable it to destroy the hosted cluster |
1717
| acm_mce_install | no | false | Enable it to install ACM and MCE operator |
18+
| heterogeneous_install | no | false | Enable it to install heterogeneous deployment |
1819
| hosted_cluster_name | no | hypershift-hosted | Name of the hypershift cluster |
1920
| acm_catalogsource_name | no | redhat-operators-acm | Name of the ACM CatalogSource |
2021
| acm_catalogsource_image | yes | | Custom catalog source index image for ACM Operator (Ex: brew.registry.redhat.io/rh-osbs/iib:860542 )|
@@ -25,16 +26,20 @@ Common variables used for both hypershift deployment and destroy operations:
2526
| base_domain | no | qe-ppc64le.cis.ibm.net | The base domain of the cluster |
2627
| pull_secret_file | no | ~/.pullSecret | Pull secret file |
2728
| ocp_release | yes | | ocp release version of the cluster to deploy |
28-
| arch | no | ppc64le | cluster architecture |
29+
| ocp_release_image | yes | | release image used to deploy cluster |
30+
| arch_ppc | no | ppc64le | power cluster architecture |
31+
| arch_x86 | no | x86_64 | x86 cluster architecture |
2932
| hypershift_dir | no | /root/hypershift | folder that will contain kubeconfig, etc |
3033
| hypershift_git_repo | no | https://github.com/openshift/hypershift | git repository to install hypershift |
3134
| hypershift_git_branch | no | main | Hypershift git repository branch |
3235
| cluster_namespace | no | clusters | |
3336
| ssh_pub_key | no | ~/.ssh/id_rsa.pub | |
3437
| db_volume_size | no | 10Gi | Database Volume Size |
3538
| fs_volume_size | no | 100Gi | FileSystem Volume Size |
36-
| iso_url | yes | | ISO url |
37-
| root_fs_url | yes | | Root fs url |
39+
| iso_url_ppc | yes | | ppc64le ISO url |
40+
| root_fs_url_ppc | yes | | ppc64le root fs url |
41+
| iso_url_x86 | yes | | x86 ISO url |
42+
| root_fs_url_x86 | yes | | x86 root fs url |
3843

3944
Dependencies
4045
------------

playbooks/roles/hypershift-agent/defaults/main.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
hypershift_agent_install: false
44
hypershift_agent_destroy: false #Enable only to destroy the hosted cluster
55
acm_mce_install: false
6+
heterogeneous_install: false
67
hosted_cluster_name: "hypershift-hosted"
78
acm_catalogsource_name: "redhat-operators-acm"
89
acm_catalogsource_image: ""
@@ -13,13 +14,17 @@ mce_upgrade_channel: "stable-2.7"
1314
base_domain: "qe-ppc64le.cis.ibm.net"
1415
pull_secret_file: "~/.pullSecret"
1516
ocp_release: ""
16-
arch: "ppc64le"
17+
ocp_release_image: ""
18+
arch_ppc: "ppc64le"
19+
arch_x86: "x86_64"
1720
hypershift_dir: "/root/hypershift"
1821
hypershift_git_repo: "https://github.com/openshift/hypershift"
1922
hypershift_git_branch: "main"
2023
cluster_namespace: "clusters"
2124
ssh_pub_key: "~/.ssh/id_rsa.pub"
2225
db_volume_size: "10Gi"
2326
fs_volume_size: "100Gi"
24-
iso_url: ""
25-
root_fs_url: ""
27+
iso_url_ppc: ""
28+
root_fs_url_ppc: ""
29+
iso_url_x86: ""
30+
root_fs_url_x86: ""

playbooks/roles/hypershift-agent/tasks/install.yml

Lines changed: 91 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
block:
55
- name: Download baremetalhosts manifest
66
get_url:
7-
url: https://raw.githubusercontent.com/openshift/assisted-service/master/hack/crds/metal3.io_baremetalhosts.yaml
7+
url: https://raw.githubusercontent.com/openshift/assisted-service/refs/heads/master/hack/crds/metal3/metal3.io_baremetalhosts.yaml
88
dest: ./metal3.io_baremetalhosts.yaml
99
mode: 0664
1010

@@ -15,7 +15,7 @@
1515

1616
- name: Download preprovisioningimages manifest
1717
get_url:
18-
url: https://raw.githubusercontent.com/openshift/assisted-service/refs/heads/master/hack/crds/metal3.io_preprovisioningimages.yaml
18+
url: https://raw.githubusercontent.com/openshift/assisted-service/refs/heads/master/hack/crds/metal3/metal3.io_preprovisioningimages.yaml
1919
dest: ./metal3.io_preprovisioningimages.yaml
2020
mode: 0664
2121

@@ -216,9 +216,23 @@
216216
src: "{{ role_path }}/templates/agent-service-config.yml"
217217
when: ocp_release_version.stdout != "" and ocp_release_min.stdout != ""
218218

219+
- name: Update AgentServiceConfig for heterogeneous
220+
block:
221+
- name: Update AgentServiceConfig
222+
template:
223+
src: "{{ role_path }}/templates/agent-service-config-heterogeneous.yaml.j2"
224+
dest: "{{ role_path }}/templates/agent-service-config-heterogeneous.yml"
225+
226+
- name: Deploy AgentServiceConfig
227+
kubernetes.core.k8s:
228+
state: present
229+
src: "{{ role_path }}/templates/agent-service-config-heterogeneous.yml"
230+
when: ocp_release_version.stdout != "" and ocp_release_min.stdout != ""
231+
when: heterogeneous_install
232+
219233
- name: Hypershift deployment
220234
block:
221-
- name: Create namespace for hosted control plane namespace
235+
- name: Create namespace for hosted control plane
222236
kubernetes.core.k8s:
223237
state: present
224238
definition:
@@ -233,9 +247,14 @@
233247
finalizers:
234248
- kubernetes
235249

250+
- name: Set value for infra_availability_policy
251+
set_fact:
252+
infra_availability_policy: "{{ 'HighlyAvailable' if heterogeneous_install else 'SingleReplica' }}"
253+
cacheable: yes
254+
236255
- name: Create Hypershift Cluster Agent
237256
shell: |
238-
hcp create cluster agent --name={{ hosted_cluster_name }} --pull-secret={{ pull_secret_file }} --infra-availability-policy SingleReplica --control-plane-availability-policy=SingleReplica --agent-namespace={{ hosted_control_plane_namespace }} --ssh-key {{ ssh_pub_key_value.stdout }} --base-domain={{ base_domain }} --api-server-address=api.{{ hosted_cluster_name }}.{{ base_domain }} --release-image=quay.io/openshift-release-dev/ocp-release:{{ ocp_release }}-multi --render-sensitive --render > {{ hypershift_dir }}/render-{{ hosted_cluster_name }}.yaml
257+
hcp create cluster agent --name={{ hosted_cluster_name }} --pull-secret={{ pull_secret_file }} --infra-availability-policy {{ infra_availability_policy }} --control-plane-availability-policy=SingleReplica --agent-namespace={{ hosted_control_plane_namespace }} --ssh-key {{ ssh_pub_key }} --base-domain={{ base_domain }} --api-server-address=api.{{ hosted_cluster_name }}.{{ base_domain }} --release-image={{ ocp_release_image }} --render-sensitive --render --node-pool-replicas -1 > {{ hypershift_dir }}/render-{{ hosted_cluster_name }}.yaml
239258
ignore_errors: true
240259
environment:
241260
PATH: "{{ hypershift_dir }}/bin:{{ ansible_env.PATH }}"
@@ -285,39 +304,100 @@
285304
shell: "cat {{ ssh_pub_key }}"
286305
register: ssh_pub_key_value
287306

288-
- name: Create InfraEnv
307+
- name: Create NodePool for ppc64le nodes
308+
template:
309+
src: "{{ role_path }}/templates/Nodepool-ppc.yaml.j2"
310+
dest: "{{ role_path }}/templates/Nodepool-ppc.yml"
311+
delegate_to: localhost
312+
313+
- name: Deploy NodePool for ppc64le nodes
314+
kubernetes.core.k8s:
315+
state: present
316+
src: "{{ role_path }}/templates/Nodepool-ppc.yml"
317+
318+
- name: Create InfraEnv for ppc64le
289319
kubernetes.core.k8s:
290320
state: present
291321
definition:
292322
apiVersion: agent-install.openshift.io/v1beta1
293323
kind: InfraEnv
294324
metadata:
295-
name: "{{ hosted_cluster_name }}"
325+
name: "{{ hosted_cluster_name }}-ppc"
296326
namespace: "{{ hosted_control_plane_namespace }}"
297327
spec:
298-
cpuArchitecture: ppc64le
328+
cpuArchitecture: "{{ arch_ppc }}"
299329
pullSecretRef:
300330
name: pull-secret
301331
sshAuthorizedKey: "{{ ssh_pub_key_value.stdout }}"
302332

333+
- name: Create NodePool and InfraEnv for heterogeneous
334+
block:
335+
- name: Create NodePool for x86 nodes
336+
template:
337+
src: "{{ role_path }}/templates/Nodepool-x86.yaml.j2"
338+
dest: "{{ role_path }}/templates/Nodepool-x86.yml"
339+
340+
- name: Deploy NodePool for x86 nodes
341+
kubernetes.core.k8s:
342+
state: present
343+
src: "{{ role_path }}/templates/Nodepool-x86.yml"
344+
345+
- name: Create InfraEnv for x86
346+
kubernetes.core.k8s:
347+
state: present
348+
definition:
349+
apiVersion: agent-install.openshift.io/v1beta1
350+
kind: InfraEnv
351+
metadata:
352+
name: "{{ hosted_cluster_name }}-x86"
353+
namespace: "{{ hosted_control_plane_namespace }}"
354+
spec:
355+
cpuArchitecture: "{{ arch_x86 }}"
356+
pullSecretRef:
357+
name: pull-secret
358+
sshAuthorizedKey: "{{ ssh_pub_key_value.stdout }}"
359+
when: heterogeneous_install
360+
303361
- name: Check if the ISO is generated
304362
shell: "oc get infraenv -n {{ hosted_control_plane_namespace }} --no-headers | awk '{ print $2 }'"
305363
register: infraenv_iso
306364
until: infraenv_iso.stdout|length > 0
307365
retries: 15
308366
delay: 60
309367

310-
- name: Get the url of the generated ISO
311-
shell: "oc get -n {{ hosted_control_plane_namespace }} InfraEnv {{ hosted_cluster_name }} -ojsonpath='{.status.isoDownloadURL}'"
368+
- name: Get the url of the generated power ISO
369+
shell: "oc get -n {{ hosted_control_plane_namespace }} InfraEnv {{ hosted_cluster_name }}-ppc -ojsonpath='{.status.isoDownloadURL}'"
312370
register: infraenv_iso
313371

314-
- name: Output the ISO URL link for download
372+
- name: Output the power ISO URL link for download
315373
debug:
316374
msg: "{{ infraenv_iso.stdout }}"
317375

376+
- name: Get the x86 ISO details
377+
block:
378+
- name: Get initrd_url
379+
shell: (oc get -n {{ hosted_control_plane_namespace }} InfraEnv {{ hosted_cluster_name }}-x86 -o json | jq -r '."status"."bootArtifacts"."initrd"')
380+
register: initrd_url
381+
382+
- name: Get kernel_url
383+
shell: (oc get -n {{ hosted_control_plane_namespace }} InfraEnv {{ hosted_cluster_name }}-x86 -o json | jq -r '."status"."bootArtifacts"."kernel"')
384+
register: kernel_url
385+
386+
- name: Get rootfs_url
387+
shell: (oc get -n {{ hosted_control_plane_namespace }} InfraEnv {{ hosted_cluster_name }}-x86 -o json | jq -r '."status"."bootArtifacts"."rootfs"')
388+
register: rootfs_url
389+
390+
- name: Output values of initrd_url, kernel_url and rootfs_url
391+
debug:
392+
msg:
393+
- "initrd_url: {{ initrd_url.stdout }}"
394+
- "kernel_url: {{ kernel_url.stdout }}"
395+
- "rootfs_url: {{ rootfs_url.stdout }}"
396+
when: heterogeneous_install
397+
318398
- name: Output the Kubernetes api service to create DNS entries
319399
debug:
320-
msg: "{{ dns_entry.stdout }}"
400+
msg: "{{ dns_entry.stdout }}"
321401

322402
- name: Output the location of Kubeconfig of the hosted cluster
323403
debug:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: hypershift.openshift.io/v1beta1
2+
kind: NodePool
3+
metadata:
4+
name: {{ hosted_cluster_name }}-ppc
5+
namespace: {{ cluster_namespace }}
6+
spec:
7+
arch: {{ arch_ppc }}
8+
clusterName: {{ hosted_cluster_name }}
9+
management:
10+
autoRepair: false
11+
upgradeType: InPlace
12+
nodeDrainTimeout: 0s
13+
nodeVolumeDetachTimeout: 0s
14+
platform:
15+
agent:
16+
agentLabelSelector:
17+
matchLabels:
18+
inventory.agent-install.openshift.io/cpu-architecture: {{ arch_ppc }}
19+
type: Agent
20+
release:
21+
image: {{ ocp_release_image }}
22+
replicas: 0
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: hypershift.openshift.io/v1beta1
2+
kind: NodePool
3+
metadata:
4+
name: {{ hosted_cluster_name }}-x86
5+
namespace: {{ cluster_namespace }}
6+
spec:
7+
arch: amd64
8+
clusterName: {{ hosted_cluster_name }}
9+
management:
10+
autoRepair: false
11+
upgradeType: InPlace
12+
nodeDrainTimeout: 0s
13+
nodeVolumeDetachTimeout: 0s
14+
platform:
15+
agent:
16+
agentLabelSelector:
17+
matchLabels:
18+
inventory.agent-install.openshift.io/cpu-architecture: {{ arch_x86 }}
19+
type: Agent
20+
release:
21+
image: {{ ocp_release_image }}
22+
replicas: 0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: agent-install.openshift.io/v1beta1
2+
kind: AgentServiceConfig
3+
metadata:
4+
name: agent
5+
spec:
6+
mirrorRegistryRef:
7+
name: mirror-config
8+
databaseStorage:
9+
accessModes:
10+
- ReadWriteOnce
11+
resources:
12+
requests:
13+
storage: "{{ db_volume_size }}"
14+
filesystemStorage:
15+
accessModes:
16+
- ReadWriteOnce
17+
resources:
18+
requests:
19+
storage: "{{ fs_volume_size }}"
20+
osImages:
21+
- openshiftVersion: "{{ ocp_release_min.stdout }}"
22+
version: "{{ ocp_release_version.stdout }}"
23+
url: "{{ iso_url_x86 }}"
24+
rootFSUrl: "{{ root_fs_url_x86 }}"
25+
cpuArchitecture: "{{ arch_x86 }}"
26+
- openshiftVersion: "{{ ocp_release_min.stdout }}"
27+
version: "{{ ocp_release_version.stdout }}"
28+
url: "{{ iso_url_ppc }}"
29+
rootFSUrl: "{{ root_fs_url_ppc }}"
30+
cpuArchitecture: "{{ arch_ppc }}"

playbooks/roles/hypershift-agent/templates/agent-service-config.yaml.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ spec:
2020
osImages:
2121
- openshiftVersion: "{{ ocp_release_min.stdout }}"
2222
version: "{{ ocp_release_version.stdout }}"
23-
url: "{{ iso_url }}"
24-
rootFSUrl: "{{ root_fs_url }}"
25-
cpuArchitecture: "{{ arch }}"
23+
url: "{{ iso_url_ppc }}"
24+
rootFSUrl: "{{ root_fs_url_ppc }}"
25+
cpuArchitecture: "{{ arch_ppc }}"

0 commit comments

Comments
 (0)