Skip to content

Create hook for adding custom CA certs #3023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions hooks/playbooks/install_custom_ca_certs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- name: Set up custom CA secret for OpenStack control plane
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
vars:
_custom_ca_cert_filepath: "{{ custom_ca_cert_filepath | mandatory }}"
_namespace: "{{ namespace | default('openstack') }}"
_controlplane_name: "{{ controlplane_name | default('controlplane') }}"
tasks:
- name: Read custom CA certificate file
ansible.builtin.slurp:
src: "{{ _custom_ca_cert_filepath }}"
register: custom_ca_certs

- name: Create custom CA secret
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: custom-ca-certs
namespace: "{{ _namespace }}"
data:
CustomCACerts: "{{ custom_ca_certs.content }}"

- name: Patch OpenStack control plane to use custom CA secret
kubernetes.core.k8s:
state: patched
kind: OpenStackControlPlane
api_version: core.openstack.org/v1beta1
name: "{{ _controlplane_name }}"
namespace: "{{ _namespace }}"
definition:
spec:
tls:
podLevel:
enabled: true
caBundleSecretName: custom-ca-certs