Skip to content

Commit 23c1cb6

Browse files
kstrenkovasdatko
authored andcommitted
Create hook for adding custom CA certs
This patch enables adding custom CA certs using a hook. The intended usage is in downstream jobs that want to add certificates into the combined-ca-bundle, e.g. internal certificates.
1 parent ad6505a commit 23c1cb6

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
- name: Set up custom CA secret for OpenStack control plane
3+
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
4+
gather_facts: false
5+
vars:
6+
_custom_ca_cert_filepath: "{{ custom_ca_cert_filepath | mandatory }}"
7+
_namespace: "{{ namespace | default('openstack') }}"
8+
_controlplane_name: "{{ controlplane_name | default('controlplane') }}"
9+
tasks:
10+
- name: Read custom CA certificate file
11+
ansible.builtin.slurp:
12+
src: "{{ _custom_ca_cert_filepath }}"
13+
register: custom_ca_certs
14+
15+
- name: Create custom CA secret
16+
kubernetes.core.k8s:
17+
state: present
18+
definition:
19+
apiVersion: v1
20+
kind: Secret
21+
type: Opaque
22+
metadata:
23+
name: custom-ca-certs
24+
namespace: "{{ _namespace }}"
25+
data:
26+
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)