Skip to content

Commit 9e967d7

Browse files
author
AC
committed
wip
1 parent 605cfe9 commit 9e967d7

15 files changed

+428
-3
lines changed
File renamed without changes.

ocp/4.15/upi_rhosp/README.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,18 @@ References:
336336
* https://docs.redhat.com/en/documentation/openshift_container_platform/4.15/html/operators/cluster-operators-ref#cluster-storage-operator_cluster-operators-ref
337337
* https://github.com/openshift/cluster-storage-operator/tree/release-4.15
338338

339+
== Maintenance
340+
341+
*Restart node*
342+
343+
[source,bash]
344+
----
345+
ansible-playbook ocp/4.15/upi_rhosp/ansible/restart-node.yaml \
346+
-e nodename=node-name \
347+
-e rhosp_instance_name=rhosp-instance
348+
----
349+
[source,bash]
350+
----
339351
== References
340352
341353
* https://docs.redhat.com/en/documentation/openshift_container_platform/4.11/html/installing/installing-on-openstack

ocp/4.15/upi_rhosp/ansible/20.14-rhosp-load-balancer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
# vars:
141141
# ipv4_fixed_address: "servers[0].addresses.{{ rhosp_network }}[?\"OS-EXT-IPS:type\" == 'fixed'].addr"
142142

143-
- name: "Collect ControlPlane host private IPV4 "
143+
- name: "Collect ControlPlane host private IPV4"
144144
ansible.builtin.set_fact:
145145
# openstack_vm_ipv4_address: "{{ item.servers[0].addresses[rhosp_network] | community.general.json_query(ipv4_fixed_address) }}"
146146
rhosp_instance_cp_array: "{{ (rhosp_instance_cp_array | default([])) + [item.servers[0].addresses[rhosp_network] | community.general.json_query(ipv4_fixed_address) | combine ({ 'name' : item.servers[0].name })] }}"

ocp/4.15/upi_rhosp/ansible/20.19-rhosp-compute-node-instance.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
auto_floating_ip: false
3030
# nics:
3131
# - port-name: "{{ os_port_controlplane }}"
32-
meta: "{{ ocp_cluster_id_tag }}"
32+
# meta: "{{ ocp_cluster_id_tag }}"
33+
meta:
34+
openshiftClusterID: "{{ ocp_infra_id }}"
35+
hostname: "{{ rhosp_compute_node_server_prefix }}-{{ item }}"
3336
# wait: false # due to TypeError: 'NoneType' object is not subscriptable
3437
security_groups:
3538
- default
@@ -120,4 +123,16 @@
120123
# group: "{{ server_group_id }}"
121124
# meta: "{{ ocp_cluster_id_tag }}"
122125
# with_indexed_items: "{{ [os_cp_server_name] * os_cp_nodes_number }}"
126+
127+
# Load Balancer
128+
- name: "Add compute node to load balancer"
129+
include_tasks: tasks/rhosp-loadbalancer-member.yaml
130+
vars:
131+
rhosp_lb_member_address: "{{ rhosp_public_lb_pool_members_item.addr }}"
132+
rhosp_lb_member_name: "{{ rhosp_public_lb_pool_members_item.name }}"
133+
rhosp_lb_member_pool: "{{ rhosp_loadbalancer_pool_name }}-public"
134+
rhosp_lb_member_ports: "{{ rhosp_lb_public_ports }}"
135+
loop: "{{ rhosp_instance_cp_array + rhosp_instance_bootstrap_array }}"
136+
loop_control:
137+
loop_var: rhosp_public_lb_pool_members_item
123138
...

ocp/4.15/upi_rhosp/ansible/defaults/main.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rhosp_lb_private_ports:
1111
- {name: "api-int", port: 22623, protocol: "TCP"}
1212
- {name: "api-server", port: 6443, protocol: "TCP"}
1313
ocp_control_plane_count: 3
14-
ocp_compute_node_count: 5
14+
ocp_compute_node_count: 7
1515

1616

1717
rhosp_compute_node:
@@ -25,3 +25,7 @@ rhosp_compute_node:
2525
flavor: b3-16
2626
5:
2727
flavor: b3-16
28+
6:
29+
flavor: b3-16
30+
7:
31+
flavor: b3-16
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
- name: "Cordon and drain node"
3+
hosts: "localhost"
4+
gather_facts: true
5+
6+
pre_tasks:
7+
- name: "Check variables"
8+
ansible.builtin.assert:
9+
that:
10+
- nodename is defined and nodename | length > 0
11+
- rhosp_instance_name is defined and rhosp_instance_name | length > 0
12+
fail_msg:
13+
- "nodename must be defined with the OpenShift node name."
14+
- "rhosp_instance_name must be defined with the name of the RHOSP instance."
15+
16+
tasks:
17+
- name: "Cordon the node"
18+
ansible.builtin.shell: |
19+
oc adm cordon {{ nodename }}
20+
register: oc_adm_cordon_res
21+
22+
- name: "Print cordon result"
23+
ansible.builtin.debug:
24+
var: oc_adm_cordon_res
25+
26+
- name: "Drain node"
27+
ansible.builtin.shell: |
28+
oc adm drain {{ nodename }}
29+
register: oc_adm_drain_res
30+
failed_when: false
31+
32+
- name: "Print drain result"
33+
ansible.builtin.debug:
34+
var: oc_adm_drain_res
35+
36+
- name: "Drain force"
37+
ansible.builtin.shell: |
38+
oc adm drain {{ nodename }} --delete-emptydir-data --ignore-daemonsets
39+
when: oc_adm_drain_res.rc != 0
40+
register: oc_adm_drain_force_res
41+
42+
- name: "Print drain force result"
43+
ansible.builtin.debug:
44+
var: oc_adm_drain_force_res
45+
when: oc_adm_drain_force_res is defined
46+
47+
- name: "Stop the RHOSP instance"
48+
openstack.cloud.server_action:
49+
action: stop
50+
server: "{{ rhosp_instance_name }}"
51+
timeout: 200
52+
53+
- name: "Wait for the VM to stop"
54+
openstack.cloud.server_info:
55+
name: "{{ rhosp_instance_name }}"
56+
register: rhosp_instance_info
57+
until: "rhosp_instance_info.servers[0].status == 'SHUTOFF'"
58+
retries: 30
59+
delay: 2
60+
61+
- name: "Start the RHOSP instance"
62+
openstack.cloud.server_action:
63+
action: start
64+
server: "{{ rhosp_instance_name }}"
65+
timeout: 200
66+
67+
- name: "Wait for the VM to start"
68+
openstack.cloud.server_info:
69+
name: "{{ rhosp_instance_name }}"
70+
register: rhosp_instance_info
71+
until: "rhosp_instance_info.servers[0].status == 'ACTIVE'"
72+
retries: 30
73+
delay: 2
74+
75+
- name: "Print wait result"
76+
ansible.builtin.debug:
77+
msg:
78+
- "rhosp_instance_info: {{ rhosp_instance_info }}"
79+
- "rhosp_instance_info: {{ rhosp_instance_info | to_json }}"
80+
81+
- name: "Uncordon the node"
82+
ansible.builtin.shell: |
83+
oc adm uncordon {{ nodename }}
84+
register: oc_adm_uncordon_res
85+
86+
- name: "Print uncordon result"
87+
ansible.builtin.debug:
88+
var: oc_adm_uncordon_res
89+
...
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
- name: "Collect information"
3+
import_playbook: _common_rhosp.yaml
4+
5+
- name: "Check required variables"
6+
hosts: "localhost"
7+
gather_facts: true
8+
9+
- name: "Setup OpenStack Environment"
10+
hosts: "localhost"
11+
gather_facts: true
12+
13+
tasks:
14+
15+
- name: "Check if cluster image exists"
16+
ansible.builtin.shell: |
17+
oc create -f https://github.com/rook/rook/raw/refs/heads/{{ rook_release_tag }}/deploy/examples/crds.yaml
18+
oc create -f https://github.com/rook/rook/raw/refs/heads/{{ rook_release_tag }}/deploy/examples/common.yaml
19+
20+
# Deployment violates PodSecurity #11755: https://github.com/rook/rook/issues/11755
21+
- name: "Fix NS POD security"
22+
ansible.builtin.shell: |
23+
oc label ns rook-ceph pod-security.kubernetes.io/enforce=privileged
24+
25+
- name: "Deploy the Operator"
26+
ansible.builtin.shell: |
27+
oc create -f https://github.com/rook/rook/raw/refs/heads/{{ rook_release_tag }}/deploy/examples/operator-openshift.yaml
28+
29+
- name: "Deploy Ceph Cluster"
30+
ansible.builtin.shell: |
31+
oc create -f https://github.com/rook/rook/raw/refs/heads/{{ rook_release_tag }}/deploy/examples/cluster.yaml
32+
33+
- name: "Deploy Object Storage"
34+
ansible.builtin.shell: |
35+
oc create -f https://github.com/rook/rook/raw/refs/heads/{{ rook_release_tag }}/deploy/examples/object-openshift.yaml
36+
37+
# Dashboard
38+
# - name: "Dashboard: deploy services"
39+
# ansible.builtin.shell: |
40+
# oc create -f https://github.com/rook/rook/raw/refs/heads/release-1.16/deploy/examples/dashboard-external-http.yaml
41+
# oc create -f https://github.com/rook/rook/raw/refs/heads/release-1.16/deploy/examples/dashboard-external-https.yaml
42+
# #oc create -f https://github.com/rook/rook/raw/refs/heads/release-1.16/deploy/examples/dashboard-loadbalancer.yaml
43+
44+
- name: "Create route for dashboard service"
45+
ansible.builtin.shell: |
46+
oc -n rook-ceph create route passthrough --service=rook-ceph-mgr-dashboard
47+
48+
- name: "Get the dashboard password"
49+
ansible.builtin.shell: |
50+
-n rook-ceph get secret rook-ceph-dashboard-password -o jsonpath="{['data']['password']}" | base64 --decode && echo
51+
register: rook_dashboard_admin_pw_res
52+
53+
- name: "Print the dashboard credentials"
54+
ansible.builtin.debug:
55+
msg:
56+
- "https://rook.io/docs/rook/latest-release/Storage-Configuration/Monitoring/ceph-dashboard/#login-credentials"
57+
- "default user: admin"
58+
- "password: {{ rook_dashboard_admin_pw_res.stdout }}"
59+
60+
# Toolbox
61+
- name: "Deploy Toolbox"
62+
ansible.builtin.shell: |
63+
oc create -f https://github.com/rook/rook/raw/refs/heads/{{ rook_release_tag }}/deploy/examples/toolbox.yaml
64+
65+
...
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
- name: "Collect information"
3+
import_playbook: _common_rhosp.yaml
4+
5+
- name: "Check required variables"
6+
hosts: "localhost"
7+
gather_facts: true
8+
9+
- name: "Setup OpenStack Environment"
10+
hosts: "localhost"
11+
gather_facts: true
12+
13+
tasks:
14+
- name: "Deploy the Operator"
15+
ansible.builtin.shell: |
16+
oc delete -f https://github.com/rook/rook/raw/refs/heads/release-1.16/deploy/examples/operator-openshift.yaml
17+
18+
- name: "Check if cluster image exists"
19+
ansible.builtin.shell: |
20+
oc delete -f https://github.com/rook/rook/raw/refs/heads/release-1.16/deploy/examples/common.yaml
21+
oc delete -f https://github.com/rook/rook/raw/refs/heads/release-1.16/deploy/examples/crds.yaml
22+
23+
...
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
= Rook on OpenShift
2+
Antonio C. <ac (at) trikorasolutions (dot) com>
3+
:revdate: {docdate}
4+
:icons: font
5+
:toc: left
6+
:toclevels: 3
7+
:toc-title: Table of Contents
8+
:description: Rook on OpenShift
9+
10+
== Introduction
11+
12+
[.lead]
13+
This document is WIP and describes the deployment of the OpenShift Data
14+
Foundation operator and a Ceph storage.
15+
16+
== Storage
17+
18+
References:
19+
20+
* https://rook.io/docs/rook/latest-release/Getting-Started/quickstart/#storage
21+
22+
=== Block Storage
23+
24+
25+
[source,bash]
26+
----
27+
oc create -f ocp/storage/rook/ansible/files/rook-ceph-blockstore.yaml
28+
----
29+
30+
* Block Storage: https://rook.io/docs/rook/latest-release/Storage-Configuration/Block-Storage-RBD/block-storage/
31+
32+
=== Shared File System
33+
34+
[source,bash]
35+
----
36+
oc create -f ocp/storage/rook/ansible/files/rook-ceph-filesystem.yaml
37+
----
38+
39+
Shared File System Storage class.
40+
41+
[source,bash]
42+
----
43+
oc create -f ocp/storage/rook/ansible/files/rook-ceph-filesystem-sc.yaml
44+
----
45+
46+
47+
* Shared FS: https://rook.io/docs/rook/latest-release/Storage-Configuration/Shared-Filesystem-CephFS/filesystem-storage/
48+
49+
50+
=== Object Storage
51+
52+
[source,bash]
53+
----
54+
oc create -f ocp/storage/rook/ansible/files/rook-ceph-objectstore.yaml
55+
----
56+
57+
* Object Storage: https://rook.io/docs/rook/latest-release/Storage-Configuration/Object-Storage-RGW/object-storage/
58+
59+
60+
== References
61+
62+
* https://rook.io/docs/rook/latest-release/Getting-Started/ceph-openshift/
63+
* https://rook.io/docs/rook/latest-release/Getting-Started/quickstart/
64+
* Dashboard: https://rook.io/docs/rook/latest-release/Getting-Started/quickstart/#ceph-dashboard
65+
Toolbox: https://rook.io/docs/rook/latest-release/Getting-Started/quickstart/#tools
66+
67+
68+
== Troubleshooting
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rook_version_tag: release-1.16

0 commit comments

Comments
 (0)