Configuration

Note

The following documentation is extracted from the config.py file, at the root of the project.

This file references all the environment variables that can be passed to the application, and their default value.

Kubemen will load its configuration from this file first, and then will try to override each variable with what is defined in the process environment. If a matching variable is found in the environment, its value will be casted to the type of the default value defined here.

Kubemen will then follow the same process if a matching annotation is found in a watched resource, and modify its behavior for the handling of this particular object. But only connector prefixed options can be modified this way.

Please refer to the description of Connector for more information on this behavior.

config.ANNOTATIONS_PREFIX = 'kubemen.numberly.com'

Prefix to use for Kubemen-specific annotations. Must not contain a slash.

config.APP_DEBUG = True

This is only useful when running locally (hot reload on code changes). Production setups must disable it by passing APP_DEBUG=0 as an environment variable.

config.APP_HOST = '0.0.0.0'

This is only useful when running locally. When using the Docker image, you should pass those as arguments of gunicorn with the GUNICORN_CMD_ARGS environment variable (GUNICORN_CMD_ARGS="-b 0.0.0.0:8080", for example).

config.APP_PORT = 8080

This is only useful when running locally. When using the Docker image, you should pass those as arguments of gunicorn with the GUNICORN_CMD_ARGS environment variable (GUNICORN_CMD_ARGS="-b 0.0.0.0:8080", for example).

config.AVAILABLE_CONNECTORS = ('kubemen.connectors.mattermost.Mattermost', 'kubemen.connectors.email.Email')

List of connectors that can be used through annotations, even if the connector is disabled globally.

config.EMAIL_ENABLE = False

Enable the Email connector globally. This can still be overriden for any given resource with the kubemen.numberly.com/mattermost.enable annotation. See AVAILABLE_CONNECTORS if you wish to forbid this connector.

config.MATTERMOST_ATTACH_BADGE = True

Whether to add a fancy badge to attachments (it’s more visible) or not.

config.MATTERMOST_ATTACH_DIFF = True

Whether to display a diff of the resource’s configuration or not.

config.MATTERMOST_ATTACH_IMAGES = True

Whether to list images used by Deployments or not.

config.MATTERMOST_BADGE_URL = 'https://raw.githubusercontent.com/numberly/kubemen/master/artwork/icons/kubemen.png'

If MATTERMOST_ATTACH_BADGE is true, define the badge URL.

config.MATTERMOST_CHANNEL_ID = ''

The Mattermost channel on which the message should be posted. Keep blank to use the default channel (the one that was configured in Mattermost when creating the webhook). Make sure that the webhook is not “locked” to a channel in its configuration.

config.MATTERMOST_ENABLE = False

Enable the Mattermost connector globally. This can still be overriden for any given resource with the kubemen.numberly.com/mattermost.enable annotation. See AVAILABLE_CONNECTORS if you wish to forbid this connector.

config.MATTERMOST_HOOK_URL = ''

Hook URL as defined with the “Incoming Webhook” configuration. This is the URL that Kubemen will use to send messages to Mattermost.

config.MATTERMOST_ICONS_BASE_URL = 'https://raw.githubusercontent.com/numberly/kubemen/master/artwork/icons/'

If MATTERMOST_USE_RANDOM_CHARACTER is true, define the base URL on which the icons of Watchmen can be fetched.

config.MATTERMOST_TEXT_MESSAGE_FORMAT = '{emoji} **{operation}** of `{kind}` **{name}** by `{username}` in `{namespace}` {hashtag}'

How to format messages sent to Mattermost.

config.MATTERMOST_USE_RANDOM_CHARACTER = True

Whether to replace the default Mattermost webhook’s avatar and name with a Watchmen character (i.e. Rorschach, Doctor Manhattan, etc) or not. If disabled, the image and name configured in Mattermost at the creation of the webhook will be used.

config.USELESS_DIFF_PATHS_REGEXPS = ('\\.metadata\\.generation', '.*\\.annotations\\["kubectl\\.kubernetes\\.io/last-applied-configuration"\\]', '.*\\.annotations\\["kubectl\\.kubernetes\\.io/restartedAt"\\]')

RegExps of YAML paths that shouldn’t be taken into account when searching differences between two versions of an object that changed.

config.USERNAME_FORMAT = '{0}'

How to display usernames, given the groups matched with USERNAME_REGEXP.

config.USERNAME_REGEXP = '(.*)@.*'

What usernames should be taken into account and how to extract them. If you want to keep everything, and not just the first part of an email as in the default value, use the following one (be cautious though, this will allow serviceaccounts): USERNAMES_REGEX = r"(.*)"