Skip to content

Commit bd8178b

Browse files
committed
Update custom ca certs hook
The hook was supposed to create a secret with custom ca certs and also update the Openstack control-plane to use it. This approach has brought some issues with the control-plane restarting, so we want to change the approach to creating the secret only. The use of the secret will be done separately. Signed-off-by: Katarina Strenkova <[email protected]>
1 parent 1638776 commit bd8178b

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed
Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
---
2-
- name: Set up custom CA secret for OpenStack control plane
2+
- name: Prepare custom CA secret
33
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
44
gather_facts: false
5+
connection: local
56
vars:
6-
_custom_ca_cert_filepath: "{{ custom_ca_cert_filepath | mandatory }}"
7+
_custom_ca_cert_url: "{{ custom_ca_cert_url | mandatory }}"
78
_namespace: "{{ namespace | default('openstack') }}"
8-
_controlplane_name: "{{ controlplane_name | default('controlplane') }}"
99
tasks:
10+
- name: Download cert
11+
ansible.builtin.get_url:
12+
url: "{{ _custom_ca_cert_url }}"
13+
dest: '/tmp/ca_cert.txt'
14+
mode: '0644'
15+
register: download_status
16+
until: download_status is not failed and (download_status.status_code is undefined or download_status.status_code == 200)
17+
retries: 10
18+
delay: 5
19+
1020
- name: Read custom CA certificate file
1121
ansible.builtin.slurp:
12-
src: "{{ _custom_ca_cert_filepath }}"
22+
src: "/tmp/ca_cert.txt"
1323
register: custom_ca_certs
1424

1525
- name: Create custom CA secret
1626
kubernetes.core.k8s:
27+
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
1728
state: present
1829
definition:
1930
apiVersion: v1
@@ -24,17 +35,3 @@
2435
namespace: "{{ _namespace }}"
2536
data:
2637
CustomCACerts: "{{ custom_ca_certs.content }}"
27-
28-
- name: Patch OpenStack control plane to use custom CA secret
29-
kubernetes.core.k8s:
30-
state: patched
31-
kind: OpenStackControlPlane
32-
api_version: core.openstack.org/v1beta1
33-
name: "{{ _controlplane_name }}"
34-
namespace: "{{ _namespace }}"
35-
definition:
36-
spec:
37-
tls:
38-
podLevel:
39-
enabled: true
40-
caBundleSecretName: custom-ca-certs

0 commit comments

Comments
 (0)