ptp-notification-armada-app/notificationclient-base/docker/notificationclient-sidecar/config.py
Cole Walker 37c15ea4fb Add support for httpGet liveness probes
Updates the locationservice, notificationservice and notificationclient
containers to support ipv6 httpGet liveness probes.

notificationservice-base and notificationservice-basev2:
- Adds health.py which starts a simple http server that runs within the
  daemon. The k8s httpGet liveness probe can query this endpoint to
  verify that the service is running
- Update the daemonset template and values to provide the required info
  for initalizing the new endpoint

locationservice-base:
- Remove unused portions of the locationservice_start.sh config map.
  The location-query-server.py and location-announce.py were never
  active and are not required
- Add locationservice_start.py in order to start the locationservice
  pecan WSGI application with either an ipv4 or ipv6 socket
- Use existing pecan endpoint to respond to liveness probes

notificationclient-base:
- Add notificationclient_start.py to start the notificationclient
  pecan WSGI application with either an ipv4 or ipv6 socket
- Use existing pecan endpoint to respond to liveness probes

Daemonset:
- Add required ip and port environment variables to support liveness
  probes on each container
- Add a conditional section for enabling liveness probes. Disabled by
  default but can be enabled via helm overrides by setting "liveness:
  True"

Misc:
- Re-organized python imports in affected files
- Incremented helm chart version to 2.0.1

Test-plan:
Pass: Verify application build and install
Pass: Verify containers build correctly
Pass: Deploy ptp-notification and verify basic sanity (v1 and v2 get,
subscribe, delete, list)
Pass: Enable httpGet liveness probes for each container and verify
operation
Pass: Verify application removal

Story: 2011090
Task: 49851

Signed-off-by: Cole Walker <cole.walker@windriver.com>
Change-Id: I4671c7f8c67c4869a6d5e3b384eae66d8c57a284
2024-04-16 11:07:15 -04:00

77 lines
2.1 KiB
Python

#
# Copyright (c) 2021-2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import os
SIDECAR_API_PORT = os.environ.get("SIDECAR_API_PORT", "8080")
SIDECAR_API_HOST = os.environ.get("SIDECAR_API_HOST", "127.0.0.1")
DATASTORE_PATH = os.environ.get("DATASTORE_PATH", "/opt/datastore")
LOGGING_LEVEL = os.environ.get("LOGGING_LEVEL", "INFO")
# Server Specific Configurations
server = {
'port': SIDECAR_API_PORT,
'host': SIDECAR_API_HOST
}
# Pecan Application Configurations
# Ensure debug = False as per Pecan documentation
app = {
'root': 'sidecar.controllers.root.RootController',
'modules': ['sidecar'],
'static_root': '%(confdir)s/public',
'template_path': '%(confdir)s/sidecar/templates',
'debug': False,
'errors': {
404: '/error/404',
'__force_dict__': True
}
}
logging = {
'root': {'level': 'INFO', 'handlers': ['console']},
'loggers': {
'sidecar': {'level': LOGGING_LEVEL, 'handlers': ['console'], 'propagate': False},
'pecan': {'level': LOGGING_LEVEL, 'handlers': ['console'], 'propagate': False},
'py.warnings': {'handlers': ['console']},
'__force_dict__': True
},
'handlers': {
'console': {
'level': LOGGING_LEVEL,
'class': 'logging.StreamHandler',
'formatter': 'color'
}
},
'formatters': {
'simple': {
'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]'
'[%(threadName)s] %(message)s')
},
'color': {
'()': 'pecan.log.ColorFormatter',
'format': ('%(asctime)s [%(padded_color_levelname)s] [%(name)s]'
'[%(threadName)s] %(message)s'),
'__force_dict__': True
}
}
}
# Bindings and options to pass to SQLAlchemy's ``create_engine``
sqlalchemy = {
'url': "sqlite:////{0}/sidecar.db".format(DATASTORE_PATH),
'echo': False,
'echo_pool': False,
'pool_recycle': 3600,
'encoding': 'utf-8'
}
# Custom Configurations must be in Python dictionary format::
#
# foo = {'bar':'baz'}
#
# All configurations are accessible at::
# pecan.conf