Add the ability to offload amphora logs

This patch adds the ability to enable log offloading from the amphora
instances to an Octavia rsyslog container.

https://review.opendev.org/#/c/731027
Change-Id: I3bafda2dd8049b93d9e049c8b9fe9940784bfac9
(cherry picked from commit f186f8e459)
This commit is contained in:
Michael Johnson 2020-04-28 15:22:38 -07:00
parent c466c86ff5
commit af90b51c53
3 changed files with 77 additions and 18 deletions

View File

@ -185,6 +185,12 @@ parameters:
description: CLI tool used to manage containers.
constraints:
- allowed_values: ['docker', 'podman']
OctaviaLogOffload:
default: false
description: When true, log messages from the amphora will be forwarded
to the administrative log endponts and will be stored with
the controller logs.
type: boolean
conditions:
octavia_raw_image_check:
@ -251,6 +257,7 @@ resources:
octavia_local_tmpdir: "{{playbook_dir}}/octavia-ansible/local_dir"
octavia_group_vars_dir: "{{playbook_dir}}/octavia-ansible/group_vars"
container_cli: { get_param: ContainerCli }
enable_log_offloading: { get_param: OctaviaLogOffload }
outputs:
role_data:

View File

@ -10,6 +10,9 @@ parameters:
ContainerOctaviaConfigImage:
description: The container image to use for the octavia config_volume
type: string
ContainerOctaviaRsyslogImage:
description: The container image to use for the rsyslog-sidecar
type: string
OctaviaHealthManagerLoggingSource:
type: json
default:
@ -54,6 +57,16 @@ parameters:
description: Name of the octavia management network interface using
for communication between octavia worker/health-manager
with the amphora machine.
OctaviaLogOffload:
default: false
description: When true, log messages from the amphora will be forwarded
to the administrative log endponts and will be stored with
the controller logs.
type: boolean
conditions:
log_offload_enabled: {equals: [{get_param: OctaviaLogOffload}, true]}
resources:
@ -83,6 +96,10 @@ outputs:
proto: udp
dport: 5555
iniface: {get_param: OctaviaMgmtPortDevName}
'210 octavia lb-mgmt-net offload rsyslog':
proto: udp
dport: 514
iniface: {get_param: OctaviaMgmtPortDevName}
monitoring_subscription: {get_param: MonitoringSubscriptionOctaviaHealthManager}
config_settings:
map_merge:
@ -114,6 +131,17 @@ outputs:
- path: /var/log/octavia
owner: octavia:octavia
recurse: true
/var/lib/kolla/config_files/octavia_rsyslog.json:
command: /usr/sbin/rsyslogd -n
config_files:
- source: "/var/lib/kolla/config_files/src/*"
dest: "/"
merge: true
preserve_properties: true
permissions:
- path: /var/log/octavia
owner: octavia:octavia
recurse: true
docker_config:
step_2:
octavia_health_manager_init_dirs:
@ -130,24 +158,44 @@ outputs:
- /var/lib/config-data/puppet-generated/octavia/etc/octavia:/etc/octavia/:z
command: ['/bin/bash', '-c', 'mkdir -p /etc/octavia/conf.d/octavia-health-manager; chown -R octavia:octavia /etc/octavia/conf.d/octavia-health-manager']
step_5:
octavia_health_manager:
start_order: 2
stop_grace_period: 300
image: *octavia_health_manager_image
net: host
privileged: false
restart: always
healthcheck:
test: /openstack/healthcheck
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/octavia_health_manager.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/octavia:/var/lib/kolla/config_files/src:ro
- /var/log/containers/octavia:/var/log/octavia:z
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
map_merge:
- octavia_health_manager:
start_order: 2
stop_grace_period: 300
image: *octavia_health_manager_image
net: host
privileged: false
restart: always
healthcheck:
test: /openstack/healthcheck
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/octavia_health_manager.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/octavia:/var/lib/kolla/config_files/src:ro
- /var/log/containers/octavia:/var/log/octavia:z
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
- if:
- log_offload_enabled
- octavia_rsyslog:
start_order: 2
image: {get_param: ContainerOctaviaRsyslogImage}
net: host
privileged: false
restart: always
volumes:
list_concat:
- {get_attr: [ContainersCommon, volumes]}
-
- /var/lib/kolla/config_files/octavia_rsyslog.json:/var/lib/kolla/config_files/config.json:ro
- /var/lib/config-data/puppet-generated/octavia:/var/lib/kolla/config_files/src:ro
- /var/log/containers/octavia:/var/log/octavia:z
environment:
KOLLA_CONFIG_STRATEGY: COPY_ALWAYS
- {}
host_prep_tasks:
- name: create persistent directories
file:

View File

@ -0,0 +1,4 @@
---
features:
- |
Adds the "OctaviaLogOffload" setting to enable amphora log offloading.