]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
mgr/cephadm: add option for grafana to bind on specific network
authorAdam King <adking@redhat.com>
Wed, 18 Oct 2023 20:22:18 +0000 (16:22 -0400)
committerAdam King <adking@redhat.com>
Tue, 19 Mar 2024 16:41:09 +0000 (12:41 -0400)
commit97dd71cdf18ba3ea01e80129914f4b6a57328890
tree5e55065e4304acbe8534bbd3f2e66f92d52ab111
parentfd67e6fe635bd0b872a9dcaba786048cb76d9fbb
mgr/cephadm: add option for grafana to bind on specific network

For example, with a spec like

```
[root@vm-00 ~]# cat grafana.yaml
service_type: grafana
service_name: grafana
placement:
  count: 1
networks:
  - 10.2.1.0/24
spec:
  anonymous_access: true
  protocol: https
  only_bind_port_on_networks: true
```

where the networks is set and the
"only_bind_port_on_networks" option is
set to true, the grafana daemon will bind
to its port (3000 in this case since it's
the default and I didn't set a port) only
on an IP from that network. I tested this
by holding port 3000 on an IP from a different
network on the host and then deploying
grafana. Without this patch it would have
failed with a port conflict error.

```
[root@vm-00 ~]# netstat -tulpn | grep 3000
tcp        0      0 10.2.1.61:3000          0.0.0.0:*               LISTEN      34178/grafana
tcp        0      0 192.168.122.251:3000    0.0.0.0:*               LISTEN      33274/nc
```

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 6ee5fff0c8dc71c4789496a587e2599ff2e0bc13)
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/services/monitoring.py
src/python-common/ceph/deployment/service_spec.py