This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
107 lines (84 loc) · 4.63 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"""
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 :class:`~kubemen.connectors.base.Connector`
for more information on this behavior.
"""
#: 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).
APP_HOST, APP_PORT = "0.0.0.0", 8080
#: 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.
APP_DEBUG = True
#: Prefix to use for Kubemen-specific annotations. Must not contain a slash.
ANNOTATIONS_PREFIX = "kubemen.numberly.com"
#: How to display usernames, given the groups matched with
#: :obj:`~USERNAME_REGEXP`.
USERNAME_FORMAT = "{0}"
#: 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"(.*)"``
USERNAME_REGEXP = r"(.*)@.*"
#: RegExps of YAML paths that shouldn't be taken into account when searching
#: differences between two versions of an object that changed.
USELESS_DIFF_PATHS_REGEXPS = (
r'\.metadata\.generation',
r'.*\.annotations\["kubectl\.kubernetes\.io/last-applied-configuration"\]',
r'.*\.annotations\["kubectl\.kubernetes\.io/restartedAt"\]'
)
#: List of connectors that can be used through annotations, even if the
#: connector is disabled globally.
AVAILABLE_CONNECTORS = (
"kubemen.connectors.mattermost.Mattermost",
"kubemen.connectors.email.Email"
)
#: Enable the Mattermost connector globally.
#: This can still be overriden for any given resource with the
#: ``kubemen.numberly.com/mattermost.enable`` annotation. See
#: :obj:`AVAILABLE_CONNECTORS` if you wish to forbid this connector.
MATTERMOST_ENABLE = False
#: Hook URL as defined with the "Incoming Webhook" configuration. This is the
#: URL that Kubemen will use to send messages to Mattermost.
MATTERMOST_HOOK_URL = ""
#: 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.
MATTERMOST_CHANNEL_ID = ""
#: How to format messages sent to Mattermost.
MATTERMOST_TEXT_MESSAGE_FORMAT = "{emoji} **{operation}** of `{kind}` **{name}** by `{username}` in `{namespace}` {hashtag}"
#: Whether to list images used by Deployments or not.
MATTERMOST_ATTACH_IMAGES = True
#: Whether to display a diff of the resource's configuration or not.
MATTERMOST_ATTACH_DIFF = True
#: Whether to add a fancy badge to attachments (it's more visible) or not.
MATTERMOST_ATTACH_BADGE = True
#: If :obj:`~MATTERMOST_ATTACH_BADGE` is true, define the badge URL.
MATTERMOST_BADGE_URL = "https://raw.githubusercontent.com/numberly/kubemen/master/artwork/icons/kubemen.png"
#: The Mattermost custom username for the message that will be posted.
#: If set, this will override name configured in Mattermost at the creation of the webhook.
MATTERMOST_USERNAME = ""
#: The Mattermost custom avatar for the message that will be posted.
#: If set, this will override the image configured in Mattermost at the creation of the webhook.
MATTERMOST_ICON_URL = ""
#: Whether to replace the default or custom Mattermost avatar and name with
#: a Watchmen character (i.e. `Rorschach`, `Doctor Manhattan`, etc) or not.
MATTERMOST_USE_RANDOM_CHARACTER = True
#: If :obj:`~MATTERMOST_USE_RANDOM_CHARACTER` is true, define the base URL on
#: which the icons of Watchmen can be fetched.
MATTERMOST_ICONS_BASE_URL = "https://raw.githubusercontent.com/numberly/kubemen/master/artwork/icons/"
#: Enable the Email connector globally.
#: This can still be overriden for any given resource with the
#: ``kubemen.numberly.com/mattermost.enable`` annotation. See
#: :obj:`AVAILABLE_CONNECTORS` if you wish to forbid this connector.
EMAIL_ENABLE = False