3c5d5a12fd
When using the OVN Cluster Ansible role, we currently default to /etc/ipa/ca.crt. We should instead use the value defined by the user in InternalTLSCAFile parameter. This change defines the relevant Ansible variables when the role is called: tripleo_ovn_cluster_northd_ssl_ca_cert tripleo_ovn_cluster_sb_ssl_ca_cert tripleo_ovn_cluster_nb_ssl_ca_cert Closes-Bug: #1989535 Change-Id: I28a4d173505a194c8a735e8b2e1c6f2589338730
357 lines
15 KiB
YAML
357 lines
15 KiB
YAML
heat_template_version: wallaby
|
|
|
|
description: >
|
|
OpenStack containerized OVN DBs service in cluster mode
|
|
|
|
parameters:
|
|
ContainerOvnNbDbImage:
|
|
description: image
|
|
type: string
|
|
tags:
|
|
- role_specific
|
|
ContainerOvnSbDbImage:
|
|
description: image
|
|
type: string
|
|
tags:
|
|
- role_specific
|
|
ContainerOvnNorthdImage:
|
|
description: image
|
|
type: string
|
|
tags:
|
|
- role_specific
|
|
EndpointMap:
|
|
default: {}
|
|
description: Mapping of service endpoint -> protocol. Typically set
|
|
via parameter_defaults in the resource registry.
|
|
type: json
|
|
ServiceData:
|
|
default: {}
|
|
description: Dictionary packing service data
|
|
type: json
|
|
ServiceNetMap:
|
|
default: {}
|
|
description: Mapping of service_name -> network name. Typically set
|
|
via parameter_defaults in the resource registry. This
|
|
mapping overrides those in ServiceNetMapDefaults.
|
|
type: json
|
|
RoleName:
|
|
default: ''
|
|
description: Role name on which the service is applied
|
|
type: string
|
|
RoleParameters:
|
|
default: {}
|
|
description: Parameters specific to the role
|
|
type: json
|
|
OVNOvsdbProbeInterval:
|
|
description: Probe interval in ms for the OVSDB session
|
|
type: number
|
|
default: 60000
|
|
OVNNorthboundServerPort:
|
|
description: Port of the OVN Northbound DB server
|
|
type: number
|
|
default: 6641
|
|
OVNSouthboundServerPort:
|
|
description: Port of the OVN Southbound DB server
|
|
type: number
|
|
default: 6642
|
|
OVNNorthboundClusterPort:
|
|
description: Cluster port of the OVN Northbound DB server
|
|
type: number
|
|
default: 6643
|
|
OVNSouthboundClusterPort:
|
|
description: Cluster port of the OVN Southbound DB server
|
|
type: number
|
|
default: 6644
|
|
EnableInternalTLS:
|
|
type: boolean
|
|
default: false
|
|
InternalTLSCAFile:
|
|
default: '/etc/ipa/ca.crt'
|
|
type: string
|
|
description: Specifies the default CA cert to use if TLS is used for
|
|
services in the internal network.
|
|
CertificateKeySize:
|
|
type: string
|
|
default: '2048'
|
|
description: Specifies the private key size used when creating the
|
|
certificate.
|
|
OvnDBSCertificateKeySize:
|
|
type: string
|
|
default: ''
|
|
description: Override the private key size used when creating the
|
|
certificate for this service
|
|
|
|
conditions:
|
|
key_size_override_unset: {equals: [{get_param: OvnDBSCertificateKeySize}, '']}
|
|
is_ipv6:
|
|
equals:
|
|
- {get_param: [ServiceData, net_ip_version_map, {get_param: [ServiceNetMap, OvnDbsNetwork]}]}
|
|
- 6
|
|
|
|
resources:
|
|
|
|
ContainersCommon:
|
|
type: ../containers-common.yaml
|
|
|
|
RoleParametersValue:
|
|
type: OS::Heat::Value
|
|
properties:
|
|
type: json
|
|
value:
|
|
map_replace:
|
|
- map_replace:
|
|
- ContainerOvnNbDbImage: ContainerOvnNbDbImage
|
|
ContainerOvnSbDbImage: ContainerOvnSbDbImage
|
|
ContainerOvnNorthdImage: ContainerOvnNorthdImage
|
|
- values: {get_param: [RoleParameters]}
|
|
- values:
|
|
ContainerOvnNbDbImage: {get_param: ContainerOvnNbDbImage}
|
|
ContainerOvnSbDbImage: {get_param: ContainerOvnSbDbImage}
|
|
ContainerOvnNorthdImage: {get_param: ContainerOvnNorthdImage}
|
|
|
|
outputs:
|
|
role_data:
|
|
description: Role data for the OVN multi-active cluster role.
|
|
value:
|
|
service_name: ovn_dbs
|
|
firewall_rules:
|
|
map_merge:
|
|
repeat:
|
|
for_each:
|
|
<%net_cidr%>:
|
|
get_param:
|
|
- ServiceData
|
|
- net_cidr_map
|
|
- {get_param: [ServiceNetMap, OvnDbsNetwork]}
|
|
template:
|
|
'121 OVN DB server and cluster ports for <%net_cidr%>':
|
|
proto: 'tcp'
|
|
source: <%net_cidr%>
|
|
dport:
|
|
- {get_param: OVNNorthboundServerPort}
|
|
- {get_param: OVNSouthboundServerPort}
|
|
- {get_param: OVNNorthboundClusterPort}
|
|
- {get_param: OVNSouthboundClusterPort}
|
|
kolla_config:
|
|
/var/lib/kolla/config_files/ovn_cluster_north_db_server.json:
|
|
command: bash -c $* -- eval source /etc/sysconfig/ovn_cluster; exec /usr/local/bin/start-nb-db-server ${OVN_NB_DB_OPTS}
|
|
config_files: &ovn_dbs_kolla_config_files
|
|
- source: "/var/lib/kolla/config_files/src/*"
|
|
dest: "/"
|
|
merge: true
|
|
preserve_properties: true
|
|
- source: "/var/lib/kolla/config_files/src-tls/*"
|
|
dest: "/"
|
|
merge: true
|
|
preserve_properties: true
|
|
optional: true
|
|
permissions: &ovn_dbs_kolla_permissions
|
|
- path: /var/log/openvswitch
|
|
owner: root:root
|
|
recurse: true
|
|
- path: /var/log/ovn
|
|
owner: root:root
|
|
recurse: true
|
|
/var/lib/kolla/config_files/ovn_cluster_south_db_server.json:
|
|
command: bash -c $* -- eval source /etc/sysconfig/ovn_cluster; exec /usr/local/bin/start-sb-db-server ${OVN_SB_DB_OPTS}
|
|
config_files: *ovn_dbs_kolla_config_files
|
|
permissions: *ovn_dbs_kolla_permissions
|
|
/var/lib/kolla/config_files/ovn_cluster_northd.json:
|
|
command: bash -c $* -- eval source /etc/sysconfig/ovn_cluster; exec /usr/bin/ovn-northd ${OVN_NORTHD_OPTS}
|
|
config_files: *ovn_dbs_kolla_config_files
|
|
permissions: *ovn_dbs_kolla_permissions
|
|
docker_config:
|
|
step_0:
|
|
ovn_cluster_north_db_server:
|
|
start_order: 0
|
|
image: {get_attr: [RoleParametersValue, value, ContainerOvnNbDbImage]}
|
|
net: host
|
|
privileged: false
|
|
restart: always
|
|
volumes:
|
|
list_concat:
|
|
- {get_attr: [ContainersCommon, volumes]}
|
|
-
|
|
- /var/lib/kolla/config_files/ovn_cluster_north_db_server.json:/var/lib/kolla/config_files/config.json:ro
|
|
- /lib/modules:/lib/modules:ro
|
|
- /var/lib/openvswitch/ovn:/var/lib/openvswitch:shared,z
|
|
- /var/lib/openvswitch/ovn:/run/openvswitch:shared,z
|
|
- /var/log/containers/openvswitch:/var/log/openvswitch:z
|
|
- /var/lib/openvswitch/ovn:/var/lib/ovn:shared,z
|
|
- /var/lib/openvswitch/ovn:/etc/openvswitch:shared,z
|
|
- /var/lib/openvswitch/ovn:/etc/ovn:shared,z
|
|
- /var/lib/openvswitch/ovn:/run/ovn:shared,z
|
|
- /var/log/containers/openvswitch:/var/log/ovn:z
|
|
- /var/lib/config-data/ansible-generated/ovn:/var/lib/kolla/config_files/src:ro
|
|
- if:
|
|
- {get_param: EnableInternalTLS}
|
|
-
|
|
- /etc/pki/tls/private/ovn_dbs.key:/var/lib/kolla/config_files/src-tls/etc/pki/tls/private/ovn_dbs.key:ro
|
|
- /etc/pki/tls/certs/ovn_dbs.crt:/var/lib/kolla/config_files/src-tls/etc/pki/tls/certs/ovn_dbs.crt:ro
|
|
- null
|
|
environment:
|
|
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
|
|
ovn_cluster_south_db_server:
|
|
start_order: 0
|
|
image: {get_attr: [RoleParametersValue, value, ContainerOvnSbDbImage]}
|
|
net: host
|
|
privileged: false
|
|
restart: always
|
|
volumes:
|
|
list_concat:
|
|
- {get_attr: [ContainersCommon, volumes]}
|
|
-
|
|
- /var/lib/kolla/config_files/ovn_cluster_south_db_server.json:/var/lib/kolla/config_files/config.json:ro
|
|
- /lib/modules:/lib/modules:ro
|
|
- /var/lib/openvswitch/ovn:/var/lib/openvswitch:shared,z
|
|
- /var/lib/openvswitch/ovn:/run/openvswitch:shared,z
|
|
- /var/log/containers/openvswitch:/var/log/openvswitch:z
|
|
- /var/lib/openvswitch/ovn:/var/lib/ovn:shared,z
|
|
- /var/lib/openvswitch/ovn:/etc/openvswitch:shared,z
|
|
- /var/lib/openvswitch/ovn:/etc/ovn:shared,z
|
|
- /var/lib/openvswitch/ovn:/run/ovn:shared,z
|
|
- /var/log/containers/openvswitch:/var/log/ovn:z
|
|
- /var/lib/config-data/ansible-generated/ovn:/var/lib/kolla/config_files/src:ro
|
|
- if:
|
|
- {get_param: EnableInternalTLS}
|
|
-
|
|
- /etc/pki/tls/private/ovn_dbs.key:/var/lib/kolla/config_files/src-tls/etc/pki/tls/private/ovn_dbs.key:ro
|
|
- /etc/pki/tls/certs/ovn_dbs.crt:/var/lib/kolla/config_files/src-tls/etc/pki/tls/certs/ovn_dbs.crt:ro
|
|
- null
|
|
environment:
|
|
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
|
|
ovn_cluster_northd:
|
|
start_order: 2
|
|
image: {get_attr: [RoleParametersValue, value, ContainerOvnNorthdImage]}
|
|
net: host
|
|
privileged: false
|
|
restart: always
|
|
healthcheck:
|
|
test: /openstack/healthcheck
|
|
volumes:
|
|
list_concat:
|
|
- {get_attr: [ContainersCommon, volumes]}
|
|
-
|
|
- /var/lib/kolla/config_files/ovn_cluster_northd.json:/var/lib/kolla/config_files/config.json:ro
|
|
- /lib/modules:/lib/modules:ro
|
|
- /var/lib/openvswitch/ovn:/run/openvswitch:shared,z
|
|
- /var/log/containers/openvswitch:/var/log/openvswitch:z
|
|
- /var/lib/openvswitch/ovn:/run/ovn:shared,z
|
|
- /var/log/containers/openvswitch:/var/log/ovn:z
|
|
- /var/lib/config-data/ansible-generated/ovn:/var/lib/kolla/config_files/src:ro
|
|
- if:
|
|
- {get_param: EnableInternalTLS}
|
|
-
|
|
- /etc/pki/tls/private/ovn_dbs.key:/var/lib/kolla/config_files/src-tls/etc/pki/tls/private/ovn_dbs.key:ro
|
|
- /etc/pki/tls/certs/ovn_dbs.crt:/var/lib/kolla/config_files/src-tls/etc/pki/tls/certs/ovn_dbs.crt:ro
|
|
- null
|
|
environment:
|
|
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
|
|
global_config_settings:
|
|
ovn_db_clustered: true
|
|
metadata_settings:
|
|
if:
|
|
- {get_param: EnableInternalTLS}
|
|
- - service: ovn_dbs
|
|
network: {get_param: [ServiceNetMap, OvnDbsNetwork]}
|
|
type: node
|
|
- null
|
|
host_prep_tasks:
|
|
- name: create persistent directories
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
setype: "{{ item.setype }}"
|
|
mode: "{{ item.mode|default(omit) }}"
|
|
loop:
|
|
- { 'path': /var/log/containers/openvswitch, 'setype': container_file_t, 'mode': '0750' }
|
|
- { 'path': /var/lib/openvswitch/ovn, 'setype': container_file_t }
|
|
deploy_steps_tasks:
|
|
- name: Prepare OVN cluster
|
|
when: step|int == 1
|
|
block:
|
|
- name: Certificate generation
|
|
when: enable_internal_tls | bool
|
|
block:
|
|
- include_role:
|
|
name: linux-system-roles.certificate
|
|
vars:
|
|
certificate_requests:
|
|
- name: ovn_dbs
|
|
dns:
|
|
str_replace:
|
|
template: "{{fqdn_$NETWORK}}"
|
|
params:
|
|
$NETWORK: {get_param: [ServiceNetMap, OvnDbsNetwork]}
|
|
principal:
|
|
str_replace:
|
|
template: "ovn_dbs/{{fqdn_$NETWORK}}@{{idm_realm}}"
|
|
params:
|
|
$NETWORK: {get_param: [ServiceNetMap, OvnDbsNetwork]}
|
|
key_size:
|
|
if:
|
|
- key_size_override_unset
|
|
- {get_param: CertificateKeySize}
|
|
- {get_param: OvnDBSCertificateKeySize}
|
|
ca: ipa
|
|
- name: set is_ovn_dbs_bootstrap_node fact
|
|
set_fact: is_ovn_dbs_bootstrap_node={{ovn_dbs_short_bootstrap_node_name|lower == ansible_facts['hostname']|lower}}
|
|
- name: Configure OVN DBs and northd
|
|
include_role:
|
|
name: tripleo_ovn_cluster
|
|
vars:
|
|
tripleo_ovn_cluster_dbs_protocol: "{{ enable_internal_tls | ternary('ssl', 'tcp', 'tcp') }}"
|
|
tripleo_ovn_cluster_network: {get_param: [ServiceNetMap, OvnDbsNetwork]}
|
|
tripleo_ovn_cluster_nb_db_port: {get_param: OVNNorthboundServerPort}
|
|
tripleo_ovn_cluster_sb_db_port: {get_param: OVNSouthboundServerPort}
|
|
tripleo_ovn_cluster_nb_local_port: {get_param: OVNNorthboundClusterPort}
|
|
tripleo_ovn_cluster_nb_remote_port: {get_param: OVNNorthboundClusterPort}
|
|
tripleo_ovn_cluster_sb_local_port: {get_param: OVNSouthboundClusterPort}
|
|
tripleo_ovn_cluster_sb_remote_port: {get_param: OVNSouthboundClusterPort}
|
|
tripleo_ovn_cluster_northd_ssl_ca_cert: {get_param: InternalTLSCAFile}
|
|
tripleo_ovn_cluster_sb_ssl_ca_cert: {get_param: InternalTLSCAFile}
|
|
tripleo_ovn_cluster_nb_ssl_ca_cert: {get_param: InternalTLSCAFile}
|
|
- name: Start OVN DBs and northd containers (bootstrap node)
|
|
when:
|
|
- step|int == 3
|
|
- is_ovn_dbs_bootstrap_node | bool
|
|
block: &ovn_dbs_start_containers
|
|
- name: Start OVN container
|
|
include_role:
|
|
name: tripleo_container_manage
|
|
vars:
|
|
tripleo_container_manage_config: "/var/lib/tripleo-config/container-startup-config/step_0"
|
|
tripleo_container_manage_config_id: "{{ ovn_container }}"
|
|
tripleo_container_manage_config_patterns: "{{ ovn_container }}.json"
|
|
loop:
|
|
- ovn_cluster_north_db_server
|
|
- ovn_cluster_south_db_server
|
|
- ovn_cluster_northd
|
|
loop_control:
|
|
loop_var: ovn_container
|
|
- name: Set connection
|
|
become: true
|
|
shell: |
|
|
podman exec ovn_cluster_north_db_server bash -c "ovn-nbctl --no-leader-only --inactivity-probe={{ tripleo_ovn_cluster_probe_interval }} set-connection p{{ tripleo_ovn_cluster_dbs_protocol }}:{{ tripleo_ovn_cluster_nb_db_port }}:{{ tripleo_ovn_cluster_dbs_addr }}"
|
|
podman exec ovn_cluster_south_db_server bash -c "ovn-sbctl --no-leader-only --inactivity-probe={{ tripleo_ovn_cluster_probe_interval }} set-connection p{{ tripleo_ovn_cluster_dbs_protocol }}:{{ tripleo_ovn_cluster_sb_db_port }}:{{ tripleo_ovn_cluster_dbs_addr }}"
|
|
when:
|
|
- is_ovn_dbs_bootstrap_node | bool
|
|
vars:
|
|
tripleo_ovn_cluster_network: {get_param: [ServiceNetMap, OvnDbsNetwork]}
|
|
tripleo_ovn_cluster_nb_db_port: {get_param: OVNNorthboundServerPort}
|
|
tripleo_ovn_cluster_sb_db_port: {get_param: OVNSouthboundServerPort}
|
|
tripleo_ovn_cluster_dbs_protocol: "{{ enable_internal_tls | ternary('ssl', 'tcp', 'tcp') }}"
|
|
tripleo_ovn_cluster_dbs_addr:
|
|
if:
|
|
- is_ipv6
|
|
- "[::]"
|
|
- "0.0.0.0"
|
|
tripleo_ovn_cluster_probe_interval: {get_param: OVNOvsdbProbeInterval}
|
|
- name: Start OVN DBs and northd containers (non-bootstrap nodes)
|
|
when:
|
|
- step|int == 4
|
|
- not is_ovn_dbs_bootstrap_node | bool
|
|
block: *ovn_dbs_start_containers
|
|
update_tasks: []
|
|
upgrade_tasks: []
|