Skip to content

Commit

Permalink
Mount TLS certs
Browse files Browse the repository at this point in the history
The dataplane operator will provide certs and keys to the ansibleEE pod
in /var/lib/openstack/certs as well as a cacert file in
/var/lib/openstack/cacerts.  It will also pass an environment variable
tls_certs_enabled to indicate that the certs are present.

This PR copies these files to the appropriate place on the compute node
and then mounts these files in the nova-compute container.

We still need to confirm that these files are in the right location
in the container and add config to use these certs - as well as code
to trust the cacert.  Will need help from compute DFG for that.

Depends-On: openstack-k8s-operators/dataplane-operator#442
  • Loading branch information
vakwetu committed Nov 15, 2023
1 parent e509ffe commit 9041d9a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion playbooks/install_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
delegate_to: localhost
- name: Install and configure time service using timesync system role
ansible.builtin.include_role:
name: "{{timesyncfqcn}}"
name: "{{ timesyncfqcn }}"
tags:
- dataplane_chrony
- name: Install edpm_chrony
Expand Down
6 changes: 6 additions & 0 deletions roles/edpm_nova/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ edpm_nova_image_download_retries: 5
edpm_nova_config_src: /var/lib/openstack/configs
edpm_nova_config_dest: /var/lib/openstack/config/nova
edpm_nova_compute_image: "quay.io/podified-antelope-centos9/openstack-nova-compute:current-podified"

# certs
edpm_nova_certs_src: /var/lib/openstack/certs
edpm_nova_certs_dest: /var/lib/openstack/certs/nova
edpm_nova_cacerts_src: /var/lib/openstack/cacerts
edpm_nova_cacerts_dest: /var/lib/openstack/cacerts/nova
26 changes: 26 additions & 0 deletions roles/edpm_nova/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,32 @@ argument_specs:
description: |
The path to the directory where the nova config files
will be rendered on the compute node.
edpm_nova_certs_src:
type: str
default: /var/lib/openstack/certs
description: |
The path to the directory containing the nova cert and key files
in the ansibleEE container. This is the directory
where all TLS certs and keys for the nova service are mounted.
edpm_nova_certs_dest:
type: str
default: /var/lib/openstack/certs/nova
description: |
The path to the directory where the nova cert and key files
will be rendered on the compute node.
edpm_nova_cacerts_src:
type: str
default: /var/lib/openstack/cacerts
description: |
The path to the directory containing the cacert files
in the ansibleEE container. This is the directory
where all cacert PEM files for the nova service are mounted.
edpm_nova_cacerts_dest:
type: str
default: /var/lib/openstack/cacerts/nova
description: |
The path to the directory where the cacert PEM files
for the nova service will be rendered on the compute node.
edpm_nova_compute_image:
type: str
default: "quay.io/podified-antelope-centos9/openstack-nova-compute:current-podified"
Expand Down
22 changes: 22 additions & 0 deletions roles/edpm_nova/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
loop:
- {"path": "{{ edpm_nova_config_dest }}", "mode": "0755"}
- {"path": "/var/lib/openstack/config/containers", "mode": "0755"}
- {"path": "{{ edpm_nova_cacerts_dest }}", "mode": "0755"}
- name: Create persistent directories
tags:
- configure
Expand Down Expand Up @@ -118,3 +119,24 @@
mode: '0600'
owner: nova
group: nova

- name: Get fact for tls_certs_enabled
ansible.builtin.set_fact:
tls_certs_enabled: "{{ lookup('env', 'tls_certs_enabled') | default(false, true) }}"

- name: Copy TLS files to the compute node
tags:
- configure
- nova
become: true
loop:
- {"src": "{{ edpm_nova_certs_src }}/{{ inventory_hostname }}-tls.crt", "dest": "{{ edpm_nova_certs_dest }}/tls.crt"}
- {"src": "{{ edpm_nova_certs_src }}/{{ inventory_hostname }}-tls.key", "dest": "{{ edpm_nova_certs_dest }}/tls.key"}
- {"src": "{{ edpm_nova_cacerts_src }}/TLSCABundleFile", "dest": "{{ edpm_nova_cacerts_dest }}/TLSCABundleFile"}
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: '0600'
owner: nova
group: nova
when: tls_certs_enabled|bool
3 changes: 3 additions & 0 deletions roles/edpm_nova/templates/nova_compute.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
},
"volumes": [
"/var/lib/openstack/config/nova:/var/lib/kolla/config_files:ro",
"/var/lib/openstack/certs/nova/tls.crt:/etc/pki/nova/server-cert.pem:ro",
"/var/lib/openstack/certs/nova/tls.key:/etc/pki/nova/private/server-key.pem:ro",
"/var/lib/openstack/cacerts/nova/TLSCABundleFile:/etc/pki/CA/cacert.pem:ro",
"/etc/localtime:/etc/localtime:ro",
"/lib/modules:/lib/modules:ro",
"/dev:/dev",
Expand Down

0 comments on commit 9041d9a

Please sign in to comment.