Merge pull request #45860 from adk3798/alertmanager-skip-verify

mgr/cephadm: allow setting insecure_skip_verify for alertmanager

Reviewed-by: Francesco Pantano <fpantano@redhat.com>
Reviewed-by: Patrick Seidensal <pseidensal@suse.com>
This commit is contained in:
Adam King 2022-04-18 08:57:14 -04:00 committed by GitHub
commit b6f42e6db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 0 deletions

View File

@ -387,6 +387,26 @@ added to the default receivers' ``<webhook_configs>`` configuration.
Run ``reconfig`` on the service to update its configuration:
.. prompt:: bash #
ceph orch reconfig alertmanager
Turn on Certificate Validation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you are using certificates for alertmanager and want to make sure
these certs are verified, you should set the "secure" option to
true in your alertmanager spec (this defaults to false).
.. code-block:: yaml
service_type: alertmanager
spec:
secure: true
If you already had alertmanager daemons running before applying the spec
you must reconfigure them to update their configuration
.. prompt:: bash #
ceph orch reconfig alertmanager

View File

@ -131,6 +131,10 @@ class AlertmanagerService(CephadmService):
default_webhook_urls: List[str] = []
spec = cast(AlertManagerSpec, self.mgr.spec_store[daemon_spec.service_name].spec)
try:
secure = spec.secure
except AttributeError:
secure = False
user_data = spec.user_data
if 'default_webhook_urls' in user_data and isinstance(
user_data['default_webhook_urls'], list):
@ -175,6 +179,7 @@ class AlertmanagerService(CephadmService):
'dashboard_urls': dashboard_urls,
'default_webhook_urls': default_webhook_urls,
'snmp_gateway_urls': snmp_gateway_urls,
'secure': secure,
}
yml = self.mgr.template.render('services/alertmanager/alertmanager.yml.j2', context)

View File

@ -3,6 +3,11 @@
global:
resolve_timeout: 5m
{% if not secure %}
http_config:
tls_config:
insecure_skip_verify: true
{% endif %}
route:
receiver: 'default'

View File

@ -251,6 +251,9 @@ class TestMonitoring:
global:
resolve_timeout: 5m
http_config:
tls_config:
insecure_skip_verify: true
route:
receiver: 'default'

View File

@ -1112,6 +1112,7 @@ class AlertManagerSpec(MonitoringSpec):
config: Optional[Dict[str, str]] = None,
networks: Optional[List[str]] = None,
port: Optional[int] = None,
secure: bool = False,
extra_container_args: Optional[List[str]] = None,
):
assert service_type == 'alertmanager'
@ -1136,6 +1137,7 @@ class AlertManagerSpec(MonitoringSpec):
# added to the default receivers'
# <webhook_configs> configuration.
self.user_data = user_data or {}
self.secure = secure
def get_port_start(self) -> List[int]:
return [self.get_port(), 9094]