547a510f63
There are no logs under /var/log/containers/keepalived even though we explicitly try to capture logs on file for the keepalived container: [root@undercloud-0 ~]# podman exec -it keepalived sh -c 'ps -ax' PID TTY STAT TIME COMMAND 1 ? Ss 0:00 dumb-init --single-child -- /usr/local/bin/kolla_start 8 ? S 0:00 /usr/sbin/keepalived -nldD | tee -a /var/log/keepalived.log 12 ? S 2:18 /usr/sbin/keepalived -nldD | tee -a /var/log/keepalived.log The reason this is broken is that 'tee' is not passed to a shell but ends up being an ignored argument of keepalived. Notice how there is no shell process and also no tee process in the container above. To fix that we need to pass the proper commands to a shell. This is done in a special way like we did for the haproxy container so that kolla does not mangle quotes and spaces. After this fix we correctly see that the container logs on disk: [root@undercloud-0 container-puppet]# ls -l /var/log/containers/keepalived/ -rw-r--r--. 1 root root 17483 Jan 28 15:55 keepalived.log While we're at it we remove the usage of tee. It makes no sense to log both on file and on stdout/stderr. Co-Authored-By: Damien Ciabrini <dciabrin@redhat.com> Change-Id: Id309e812f7dc8d66bd4912fce282ce72350fcbf8 Closes-Bug: #1861169
153 lines
5.3 KiB
YAML
153 lines
5.3 KiB
YAML
heat_template_version: rocky
|
|
|
|
description: >
|
|
OpenStack containerized Keepalived service
|
|
|
|
parameters:
|
|
ContainerKeepalivedImage:
|
|
description: image
|
|
type: string
|
|
ContainerKeepalivedConfigImage:
|
|
description: The container image to use for the keepalived config_volume
|
|
type: string
|
|
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
|
|
DefaultPasswords:
|
|
default: {}
|
|
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
|
|
# TODO(emilien) Remove when Keepalived 2.0.6 is out
|
|
# https://bugs.launchpad.net/tripleo/+bug/1791238
|
|
KeepalivedRestart:
|
|
default: false
|
|
description: Whether or not restart Keepalived. Useful for Undercloud only.
|
|
type: boolean
|
|
ControlVirtualInterface:
|
|
default: ''
|
|
description: >
|
|
Interface where virtual ip will be assigned. This value will be
|
|
automatically set by the deployment tool. Overriding here will
|
|
override automatic setting.
|
|
type: string
|
|
PublicVirtualInterface:
|
|
default: ''
|
|
description: >
|
|
Interface where virtual ip will be assigned. This value will be
|
|
automatically set by the deployment tool. Overriding here will
|
|
override automatic setting.
|
|
type: string
|
|
MonitoringSubscriptionKeepalived:
|
|
default: 'overcloud-keepalived'
|
|
type: string
|
|
|
|
conditions:
|
|
control_iface_empty: {equals : [{get_param: ControlVirtualInterface}, '']}
|
|
public_iface_empty: {equals : [{get_param: PublicVirtualInterface}, '']}
|
|
|
|
resources:
|
|
ContainersCommon:
|
|
type: ../containers-common.yaml
|
|
|
|
outputs:
|
|
role_data:
|
|
description: Role data for the Keepalived role.
|
|
value:
|
|
service_name: keepalived
|
|
firewall_rules:
|
|
'106 keepalived vrrp':
|
|
proto: vrrp
|
|
monitoring_subscription: {get_param: MonitoringSubscriptionKeepalived}
|
|
config_settings:
|
|
map_merge:
|
|
- tripleo::keepalived:custom_vrrp_script: 'test -S /var/lib/haproxy/stats && echo "show info" | socat /var/lib/haproxy/stats stdio'
|
|
-
|
|
if:
|
|
- control_iface_empty
|
|
- {}
|
|
- tripleo::keepalived::control_virtual_interface: {get_param: ControlVirtualInterface}
|
|
-
|
|
if:
|
|
- public_iface_empty
|
|
- {}
|
|
- tripleo::keepalived::public_virtual_interface: {get_param: PublicVirtualInterface}
|
|
service_config_settings: {}
|
|
# BEGIN DOCKER SETTINGS
|
|
puppet_config:
|
|
config_volume: 'keepalived'
|
|
puppet_tags: 'file'
|
|
step_config: |
|
|
include ::tripleo::profile::base::keepalived
|
|
config_image: {get_param: ContainerKeepalivedConfigImage}
|
|
kolla_config:
|
|
/var/lib/kolla/config_files/keepalived.json:
|
|
command: "/bin/bash -c $* -- eval exec /usr/sbin/keepalived -nldD &>>/var/log/keepalived.log"
|
|
config_files:
|
|
- source: "/var/lib/kolla/config_files/src/*"
|
|
dest: "/"
|
|
merge: true
|
|
preserve_properties: true
|
|
docker_config:
|
|
step_1:
|
|
keepalived:
|
|
start_order: 0
|
|
image: {get_param: ContainerKeepalivedImage}
|
|
net: host
|
|
privileged: true
|
|
restart: always
|
|
# FIXME: needs to be added to the container first
|
|
#healthcheck:
|
|
#test: /openstack/healthcheck
|
|
volumes:
|
|
list_concat:
|
|
- {get_attr: [ContainersCommon, volumes]}
|
|
-
|
|
- /var/lib/kolla/config_files/keepalived.json:/var/lib/kolla/config_files/config.json:ro
|
|
- /var/lib/config-data/puppet-generated/keepalived:/var/lib/kolla/config_files/src:ro
|
|
- /var/log/containers/keepalived/:/var/log/:z
|
|
- /lib/modules/:/lib/modules/:ro
|
|
- /var/lib/haproxy/:/var/lib/haproxy/:z
|
|
environment:
|
|
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
|
|
command: /usr/local/bin/kolla_start
|
|
host_prep_tasks:
|
|
- name: Set fact for restarting Keepalived container
|
|
set_fact:
|
|
restart_keepalived: {get_param: KeepalivedRestart}
|
|
- name: Restart Keepalived container
|
|
shell: "{{container_cli}} restart keepalived"
|
|
when: restart_keepalived|bool
|
|
ignore_errors: True
|
|
- name: load ip_vs module
|
|
import_role:
|
|
name: tripleo_module_load
|
|
vars:
|
|
modules:
|
|
- name: ip_vs
|
|
- name: create persistent directories
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
setype: "{{ item.setype }}"
|
|
with_items:
|
|
- { 'path': /var/log/containers/keepalived, 'setype': svirt_sandbox_file_t, 'mode': '0750' }
|