Browse Source

Switch HA containers to k8s-file log-driver and make it a parameter

Currently in puppet-tripleo for the HA container we hardcode the following:
 options => "--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",

Since at least podman had some changes in terms of supported driver
backends (and bugs) it's best if we make this configurable. While we're
at it we should also switch to k8s-file as a driver when podman is being
used which is what all other containers are using. When docker is the
default container_cli we will stick to journald as usual.

Tested this on a Train environment and successfully verified that
we still see the correct logs in /var/log/containers/.../...

Change-Id: I5b1483826f816d11a064a937d59f9a8f468315a5
Closes-Bug: #1853517
tags/12.0.0
Michele Baldessari 2 weeks ago
parent
commit
bad716070a
11 changed files with 137 additions and 11 deletions
  1. +16
    -1
      manifests/profile/pacemaker/cinder/backup_bundle.pp
  2. +16
    -1
      manifests/profile/pacemaker/cinder/volume_bundle.pp
  3. +16
    -1
      manifests/profile/pacemaker/database/mysql_bundle.pp
  4. +16
    -1
      manifests/profile/pacemaker/database/redis_bundle.pp
  5. +16
    -1
      manifests/profile/pacemaker/haproxy_bundle.pp
  6. +16
    -1
      manifests/profile/pacemaker/manila/share_bundle.pp
  7. +16
    -1
      manifests/profile/pacemaker/ovn_dbs_bundle.pp
  8. +16
    -1
      manifests/profile/pacemaker/rabbitmq_bundle.pp
  9. +3
    -1
      spec/classes/tripleo_profile_pacemaker_cinder_backup_bundle_spec.rb
  10. +3
    -1
      spec/classes/tripleo_profile_pacemaker_cinder_volume_bundle_spec.rb
  11. +3
    -1
      spec/classes/tripleo_profile_pacemaker_manila_share_bundle_spec.rb

+ 16
- 1
manifests/profile/pacemaker/cinder/backup_bundle.pp View File

@@ -47,6 +47,11 @@
# (optional) Container backend to use when creating the bundle
# Defaults to 'docker'
#
# [*log_driver*]
# (optional) Container log driver to use. When set to undef it uses 'k8s-file'
# when container_cli is set to podman and 'journald' when it is set to docker.
# Defaults to undef
#
# [*tls_priorities*]
# (optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set
# Defaults to hiera('tripleo::pacemaker::tls_priorities', undef)
@@ -57,6 +62,7 @@ class tripleo::profile::pacemaker::cinder::backup_bundle (
$docker_volumes = [],
$docker_environment = {'KOLLA_CONFIG_STRATEGY' => 'COPY_ALWAYS'},
$container_backend = 'docker',
$log_driver = undef,
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$pcs_tries = hiera('pcs_tries', 20),
$step = Integer(hiera('step')),
@@ -66,6 +72,15 @@ class tripleo::profile::pacemaker::cinder::backup_bundle (
} else {
$pacemaker_master = false
}
if $log_driver == undef {
if hiera('container_cli', 'docker') == 'podman' {
$log_driver_real = 'k8s-file'
} else {
$log_driver_real = 'journald'
}
} else {
$log_driver_real = $log_driver
}

include ::tripleo::profile::base::cinder::backup

@@ -204,7 +219,7 @@ class tripleo::profile::pacemaker::cinder::backup_bundle (
expression => ['cinder-backup-role eq true'],
},
container_options => 'network=host',
options => "--ipc=host --privileged=true --user=root --log-driver=journald ${docker_env}${tls_priorities_real}",
options => "--ipc=host --privileged=true --user=root --log-driver=${log_driver_real} ${docker_env}${tls_priorities_real}",
run_command => '/bin/bash /usr/local/bin/kolla_start',
storage_maps => $storage_maps,
container_backend => $container_backend,

+ 16
- 1
manifests/profile/pacemaker/cinder/volume_bundle.pp View File

@@ -47,6 +47,11 @@
# (optional) Container backend to use when creating the bundle
# Defaults to 'docker'
#
# [*log_driver*]
# (optional) Container log driver to use. When set to undef it uses 'k8s-file'
# when container_cli is set to podman and 'journald' when it is set to docker.
# Defaults to undef
#
# [*tls_priorities*]
# (optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set
# Defaults to hiera('tripleo::pacemaker::tls_priorities', undef)
@@ -59,6 +64,7 @@ class tripleo::profile::pacemaker::cinder::volume_bundle (
$pcs_tries = hiera('pcs_tries', 20),
$step = Integer(hiera('step')),
$container_backend = 'docker',
$log_driver = undef,
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
) {
if $::hostname == downcase($bootstrap_node) {
@@ -67,6 +73,15 @@ class tripleo::profile::pacemaker::cinder::volume_bundle (
$pacemaker_master = false
}

if $log_driver == undef {
if hiera('container_cli', 'docker') == 'podman' {
$log_driver_real = 'k8s-file'
} else {
$log_driver_real = 'journald'
}
} else {
$log_driver_real = $log_driver
}
include ::tripleo::profile::base::cinder::volume

if $step >= 2 and $pacemaker_master {
@@ -205,7 +220,7 @@ class tripleo::profile::pacemaker::cinder::volume_bundle (
expression => ['cinder-volume-role eq true'],
},
container_options => 'network=host',
options => "--ipc=host --privileged=true --user=root --log-driver=journald ${docker_env}${tls_priorities_real}",
options => "--ipc=host --privileged=true --user=root --log-driver=${log_driver_real} ${docker_env}${tls_priorities_real}",
run_command => '/bin/bash /usr/local/bin/kolla_start',
storage_maps => $storage_maps,
container_backend => $container_backend,

+ 16
- 1
manifests/profile/pacemaker/database/mysql_bundle.pp View File

@@ -118,6 +118,11 @@
# (optional) Container backend to use when creating the bundle
# Defaults to 'docker'
#
# [*log_driver*]
# (optional) Container log driver to use. When set to undef it uses 'k8s-file'
# when container_cli is set to podman and 'journald' when it is set to docker.
# Defaults to undef
#
# [*tls_priorities*]
# (optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set
# Defaults to hiera('tripleo::pacemaker::tls_priorities', undef)
@@ -141,6 +146,7 @@ class tripleo::profile::pacemaker::database::mysql_bundle (
$ipv6 = str2bool(hiera('mysql_ipv6', false)),
$mysql_server_options = hiera('tripleo::profile::base::database::mysql::mysql_server_options', {}),
$container_backend = 'docker',
$log_driver = undef,
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$pcs_tries = hiera('pcs_tries', 20),
$step = Integer(hiera('step')),
@@ -151,6 +157,15 @@ class tripleo::profile::pacemaker::database::mysql_bundle (
$pacemaker_master = false
}

if $log_driver == undef {
if hiera('container_cli', 'docker') == 'podman' {
$log_driver_real = 'k8s-file'
} else {
$log_driver_real = 'journald'
}
} else {
$log_driver_real = $log_driver
}
# FQDN are lowercase in /etc/hosts, so are pacemaker node names
$galera_node_names_lookup = downcase(hiera('mysql_short_node_names', $::hostname))
if (hiera('mysql_node_names_override', undef)) {
@@ -422,7 +437,7 @@ MYSQL_HOST=localhost\n",
expression => ['galera-role eq true'],
},
container_options => 'network=host',
options => "--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",
options => "--user=root --log-driver=${log_driver_real} -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",
run_command => '/bin/bash /usr/local/bin/kolla_start',
network => "control-port=${control_port}",
storage_maps => merge($storage_maps, $storage_maps_tls),

+ 16
- 1
manifests/profile/pacemaker/database/redis_bundle.pp View File

@@ -95,6 +95,11 @@
# (optional) Container backend to use when creating the bundle
# Defaults to 'docker'
#
# [*log_driver*]
# (optional) Container log driver to use. When set to undef it uses 'k8s-file'
# when container_cli is set to podman and 'journald' when it is set to docker.
# Defaults to undef
#
# [*tls_priorities*]
# (optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set
# Defaults to hiera('tripleo::pacemaker::tls_priorities', undef)
@@ -107,6 +112,7 @@ class tripleo::profile::pacemaker::database::redis_bundle (
$redis_docker_control_port = hiera('tripleo::profile::pacemaker::database::redis_bundle::control_port', '3124'),
$container_backend = 'docker',
$pcs_tries = hiera('pcs_tries', 20),
$log_driver = undef,
$step = Integer(hiera('step')),
$redis_network = hiera('redis_network', undef),
$extra_config_file = '/etc/redis-tls.conf',
@@ -123,6 +129,15 @@ class tripleo::profile::pacemaker::database::redis_bundle (
$pacemaker_master = false
}

if $log_driver == undef {
if hiera('container_cli', 'docker') == 'podman' {
$log_driver_real = 'k8s-file'
} else {
$log_driver_real = 'journald'
}
} else {
$log_driver_real = $log_driver
}
if $enable_internal_tls {
if !$redis_network {
fail('redis_network is not set in the hieradata.')
@@ -333,7 +348,7 @@ slave-announce-port ${local_tuple[0][2]}
expression => ['redis-role eq true'],
},
container_options => 'network=host',
options => "--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",
options => "--user=root --log-driver=${log_driver_real} -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",
run_command => '/bin/bash /usr/local/bin/kolla_start',
network => "control-port=${redis_docker_control_port}",
storage_maps => merge($storage_maps, $storage_maps_tls),

+ 16
- 1
manifests/profile/pacemaker/haproxy_bundle.pp View File

@@ -71,6 +71,11 @@
# (optional) Container backend to use when creating the bundle
# Defaults to 'docker'
#
# [*log_driver*]
# (optional) Container log driver to use. When set to undef it uses 'k8s-file'
# when container_cli is set to podman and 'journald' when it is set to docker.
# Defaults to undef
#
# [*tls_priorities*]
# (optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set
# Defaults to hiera('tripleo::pacemaker::tls_priorities', undef)
@@ -98,6 +103,7 @@ class tripleo::profile::pacemaker::haproxy_bundle (
$op_params = '',
$container_backend = 'docker',
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$log_driver = undef,
$step = Integer(hiera('step')),
$pcs_tries = hiera('pcs_tries', 20),
) {
@@ -109,6 +115,15 @@ class tripleo::profile::pacemaker::haproxy_bundle (
$pacemaker_master = false
}

if $log_driver == undef {
if hiera('container_cli', 'docker') == 'podman' {
$log_driver_real = 'k8s-file'
} else {
$log_driver_real = 'journald'
}
} else {
$log_driver_real = $log_driver
}
if $step >= 2 and $enable_load_balancer {
if $pacemaker_master {
if (hiera('haproxy_short_node_names_override', undef)) {
@@ -255,7 +270,7 @@ class tripleo::profile::pacemaker::haproxy_bundle (
replicas => $haproxy_nodes_count,
location_rule => $haproxy_location_rule,
container_options => 'network=host',
options => "--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",
options => "--user=root --log-driver=${log_driver_real} -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",
run_command => '/bin/bash /usr/local/bin/kolla_start',
storage_maps => merge($storage_maps, $cert_storage_maps, $storage_maps_internal_tls),
container_backend => $container_backend,

+ 16
- 1
manifests/profile/pacemaker/manila/share_bundle.pp View File

@@ -51,6 +51,11 @@
# (optional) Container backend to use when creating the bundle
# Defaults to 'docker'
#
# [*log_driver*]
# (optional) Container log driver to use. When set to undef it uses 'k8s-file'
# when container_cli is set to podman and 'journald' when it is set to docker.
# Defaults to undef
#
# [*tls_priorities*]
# (optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set
# Defaults to hiera('tripleo::pacemaker::tls_priorities', undef)
@@ -63,6 +68,7 @@ class tripleo::profile::pacemaker::manila::share_bundle (
$ceph_nfs_enabled = hiera('ceph_nfs_enabled', false),
$container_backend = 'docker',
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$log_driver = undef,
$pcs_tries = hiera('pcs_tries', 20),
$step = Integer(hiera('step')),
) {
@@ -72,6 +78,15 @@ class tripleo::profile::pacemaker::manila::share_bundle (
$pacemaker_master = false
}

if $log_driver == undef {
if hiera('container_cli', 'docker') == 'podman' {
$log_driver_real = 'k8s-file'
} else {
$log_driver_real = 'journald'
}
} else {
$log_driver_real = $log_driver
}
include ::tripleo::profile::base::manila::share

if $step >= 2 and $pacemaker_master {
@@ -222,7 +237,7 @@ class tripleo::profile::pacemaker::manila::share_bundle (
expression => ['manila-share-role eq true'],
},
container_options => 'network=host',
options => "--ipc=host --privileged=true --user=root --log-driver=journald ${docker_env}${tls_priorities_real}",
options => "--ipc=host --privileged=true --user=root --log-driver=${log_driver_real} ${docker_env}${tls_priorities_real}",
run_command => '/bin/bash /usr/local/bin/kolla_start',
storage_maps => $storage_maps,
container_backend => $container_backend,

+ 16
- 1
manifests/profile/pacemaker/ovn_dbs_bundle.pp View File

@@ -64,6 +64,11 @@
# (optional) Container backend to use when creating the bundle
# Defaults to 'docker'
#
# [*log_driver*]
# (optional) Container log driver to use. When set to undef it uses 'k8s-file'
# when container_cli is set to podman and 'journald' when it is set to docker.
# Defaults to undef
#
# [*tls_priorities*]
# (optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set
# Defaults to hiera('tripleo::pacemaker::tls_priorities', undef)
@@ -95,6 +100,7 @@ class tripleo::profile::pacemaker::ovn_dbs_bundle (
$op_params = '',
$container_backend = 'docker',
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$log_driver = undef,
$enable_internal_tls = hiera('enable_internal_tls', false),
$ca_file = undef,
$dbs_timeout = hiera('tripleo::profile::pacemaker::ovn_dbs_bundle::dbs_timeout', 60),
@@ -106,6 +112,15 @@ class tripleo::profile::pacemaker::ovn_dbs_bundle (
$pacemaker_master = false
}

if $log_driver == undef {
if hiera('container_cli', 'docker') == 'podman' {
$log_driver_real = 'k8s-file'
} else {
$log_driver_real = 'journald'
}
} else {
$log_driver_real = $log_driver
}
if $step >= 3 {

if $pacemaker_master {
@@ -212,7 +227,7 @@ nb_master_protocol=ssl sb_master_protocol=ssl"
masters => 1,
location_rule => $ovn_dbs_location_rule,
container_options => 'network=host',
options => "--log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",
options => "--log-driver=${log_driver_real} -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS${tls_priorities_real}",
run_command => '/bin/bash /usr/local/bin/kolla_start',
network => "control-port=${ovn_dbs_control_port}",
storage_maps => merge($storage_maps, $ovn_storage_maps_tls),

+ 16
- 1
manifests/profile/pacemaker/rabbitmq_bundle.pp View File

@@ -83,6 +83,11 @@
# (optional) Container backend to use when creating the bundle
# Defaults to 'docker'
#
# [*log_driver*]
# (optional) Container log driver to use. When set to undef it uses 'k8s-file'
# when container_cli is set to podman and 'journald' when it is set to docker.
# Defaults to undef
#
# [*tls_priorities*]
# (optional) Sets PCMK_tls_priorities in /etc/sysconfig/pacemaker when set
# Defaults to hiera('tripleo::pacemaker::tls_priorities', undef)
@@ -105,6 +110,7 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
$pcs_tries = hiera('pcs_tries', 20),
$step = Integer(hiera('step')),
$container_backend = 'docker',
$log_driver = undef,
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
) {
# is this an additional nova cell?
@@ -131,6 +137,15 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
$pacemaker_master = false
}

if $log_driver == undef {
if hiera('container_cli', 'docker') == 'podman' {
$log_driver_real = 'k8s-file'
} else {
$log_driver_real = 'journald'
}
} else {
$log_driver_real = $log_driver
}
include ::tripleo::profile::base::rabbitmq

file { '/var/lib/rabbitmq/.erlang.cookie':
@@ -269,7 +284,7 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
},
container_options => 'network=host',
# lint:ignore:140chars
options => "--user=root --log-driver=journald -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS -e LANG=en_US.UTF-8 -e LC_ALL=en_US.UTF-8${tls_priorities_real}",
options => "--user=root --log-driver=${log_driver_real} -e KOLLA_CONFIG_STRATEGY=COPY_ALWAYS -e LANG=en_US.UTF-8 -e LC_ALL=en_US.UTF-8${tls_priorities_real}",
# lint:endignore
run_command => '/bin/bash /usr/local/bin/kolla_start',
network => "control-port=${rabbitmq_docker_control_port}",

+ 3
- 1
spec/classes/tripleo_profile_pacemaker_cinder_backup_bundle_spec.rb View File

@@ -57,6 +57,7 @@ describe 'tripleo::profile::pacemaker::cinder::backup_bundle' do
let(:params) { {
:step => 5,
:cinder_backup_docker_image => 'c-bak-docker-image',
:log_driver => 'journald',
} }

context 'with default inputs' do
@@ -80,12 +81,13 @@ describe 'tripleo::profile::pacemaker::cinder::backup_bundle' do
params.merge!({
:docker_volumes => ['/src/1:/tgt/1', '/src/2:/tgt/2:ro', '/src/3:/tgt/3:ro,z'],
:docker_environment => ['RIGHT=LEFT', 'UP=DOWN'],
:log_driver => 'k8s-file',
})
end
it 'should create custom cinder-backup resource bundle' do
is_expected.to contain_pacemaker__resource__bundle('openstack-cinder-backup').with(
:image => 'c-bak-docker-image',
:options => '--ipc=host --privileged=true --user=root --log-driver=journald -e RIGHT=LEFT -e UP=DOWN',
:options => '--ipc=host --privileged=true --user=root --log-driver=k8s-file -e RIGHT=LEFT -e UP=DOWN',
:storage_maps => {
'cinder-backup-src-1' => {
'source-dir' => '/src/1',

+ 3
- 1
spec/classes/tripleo_profile_pacemaker_cinder_volume_bundle_spec.rb View File

@@ -62,6 +62,7 @@ describe 'tripleo::profile::pacemaker::cinder::volume_bundle' do
let(:params) { {
:step => 5,
:cinder_volume_docker_image => 'c-vol-docker-image',
:log_driver => 'journald',
} }

context 'with default inputs' do
@@ -86,12 +87,13 @@ describe 'tripleo::profile::pacemaker::cinder::volume_bundle' do
params.merge!({
:docker_volumes => ['/src/1:/tgt/1', '/src/2:/tgt/2:ro', '/src/3:/tgt/3:ro,z'],
:docker_environment => ['RIGHT=LEFT', 'UP=DOWN'],
:log_driver => 'k8s-file',
})
end
it 'should create custom cinder-volume resource bundle' do
is_expected.to contain_pacemaker__resource__bundle('openstack-cinder-volume').with(
:image => 'c-vol-docker-image',
:options => '--ipc=host --privileged=true --user=root --log-driver=journald -e RIGHT=LEFT -e UP=DOWN',
:options => '--ipc=host --privileged=true --user=root --log-driver=k8s-file -e RIGHT=LEFT -e UP=DOWN',
:storage_maps => {
'cinder-volume-src-1' => {
'source-dir' => '/src/1',

+ 3
- 1
spec/classes/tripleo_profile_pacemaker_manila_share_bundle_spec.rb View File

@@ -57,6 +57,7 @@ describe 'tripleo::profile::pacemaker::manila::share_bundle' do
let(:params) { {
:step => 5,
:manila_share_docker_image => 'manila-share-image',
:log_driver => 'journald',
} }

context 'with default inputs' do
@@ -99,12 +100,13 @@ describe 'tripleo::profile::pacemaker::manila::share_bundle' do
params.merge!({
:docker_volumes => ['/src/1:/tgt/1', '/src/2:/tgt/2:ro', '/src/3:/tgt/3:ro,z'],
:docker_environment => ['RIGHT=LEFT', 'UP=DOWN'],
:log_driver => 'k8s-file',
})
end
it 'should create custom manila-share resource bundle' do
is_expected.to contain_pacemaker__resource__bundle('openstack-manila-share').with(
:image => 'manila-share-image',
:options => '--ipc=host --privileged=true --user=root --log-driver=journald -e RIGHT=LEFT -e UP=DOWN',
:options => '--ipc=host --privileged=true --user=root --log-driver=k8s-file -e RIGHT=LEFT -e UP=DOWN',
:storage_maps => {
'manila-share-src-1' => {
'source-dir' => '/src/1',

Loading…
Cancel
Save