From f186f8e459a843c4127fed014de7e21eeb9d463d Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Tue, 28 Apr 2020 15:22:38 -0700 Subject: [PATCH] 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. Depends-On: https://review.opendev.org/724186 Change-Id: I3bafda2dd8049b93d9e049c8b9fe9940784bfac9 --- .../octavia/octavia-deployment-config.j2.yaml | 7 ++ ...tavia-health-manager-container-puppet.yaml | 84 +++++++++++++++---- .../octavia-log-offload-d1617e767f688da1.yaml | 4 + 3 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 releasenotes/notes/octavia-log-offload-d1617e767f688da1.yaml diff --git a/deployment/octavia/octavia-deployment-config.j2.yaml b/deployment/octavia/octavia-deployment-config.j2.yaml index ce6320cf5f..d24a667e6d 100644 --- a/deployment/octavia/octavia-deployment-config.j2.yaml +++ b/deployment/octavia/octavia-deployment-config.j2.yaml @@ -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: diff --git a/deployment/octavia/octavia-health-manager-container-puppet.yaml b/deployment/octavia/octavia-health-manager-container-puppet.yaml index cd3118342e..2661ed1e50 100644 --- a/deployment/octavia/octavia-health-manager-container-puppet.yaml +++ b/deployment/octavia/octavia-health-manager-container-puppet.yaml @@ -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: diff --git a/releasenotes/notes/octavia-log-offload-d1617e767f688da1.yaml b/releasenotes/notes/octavia-log-offload-d1617e767f688da1.yaml new file mode 100644 index 0000000000..25a6968bd4 --- /dev/null +++ b/releasenotes/notes/octavia-log-offload-d1617e767f688da1.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Adds the "OctaviaLogOffload" setting to enable amphora log offloading.