canonical / sdcore-bundles

Charm bundles used to deploy the SD-Core operators.
Apache License 2.0
0 stars 0 forks source link

NMS is not reachable behind Ingress #22

Open gatici opened 7 months ago

gatici commented 7 months ago

NMS ingress integration is not working properly

If we deploy sdcore bundle from edge channel, NMS UI is not reachable.

To Reproduce

Deploy sdcore bundle: $ juju deploy sdcore --trust --channel=edge

Get NMS URL: $ juju run traefik-k8s/0 show-proxied-endpoints Running operation 1 with 1 task

Waiting for task 2... proxied-endpoints: '{"nms": {"url": "http://10.0.0.3:80/core-nms"}}'

URL starts with http, expected to be an https.

Trying to reach URL: $ curl -vvv http://10.0.0.3/core-nms

It is not routed to any backend. image

Expected behavior

NMS URL should return the backend successfully.

Screenshots

http://nms-0.nms-endpoints.core.svc.cluster.local:3000/ is resolved as http://10.1.146.51:3000/ image

Logs

Bundle is deployed. $ juju status Model Controller Cloud/Region Version SLA Timestamp core microk8s-localhost microk8s/localhost 3.1.6 unsupported 16:38:16+03:00

App Version Status Scale Charm Channel Rev Address Exposed Message amf active 1 sdcore-amf edge 51 10.152.183.110 no
ausf active 1 sdcore-ausf edge 38 10.152.183.194 no
grafana-agent-k8s 0.32.1 waiting 1 grafana-agent-k8s latest/stable 42 10.152.183.158 no installing agent mongodb-k8s active 1 mongodb-k8s 5/edge 36 10.152.183.107 no Primary nms active 1 sdcore-nms edge 23 10.152.183.98 no
nrf active 1 sdcore-nrf edge 57 10.152.183.53 no
nssf active 1 sdcore-nssf edge 35 10.152.183.111 no
pcf active 1 sdcore-pcf edge 30 10.152.183.119 no
router active 1 sdcore-router edge 30 10.152.183.109 no
self-signed-certificates active 1 self-signed-certificates beta 33 10.152.183.216 no
smf active 1 sdcore-smf edge 33 10.152.183.48 no
traefik-k8s 2.9.6 active 1 traefik-k8s latest/stable 129 10.0.0.3 no
udm active 1 sdcore-udm edge 33 10.152.183.26 no
udr active 1 sdcore-udr edge 28 10.152.183.178 no
upf active 1 sdcore-upf edge 62 10.152.183.173 no
webui active 1 sdcore-webui edge 20 10.152.183.112 no

Unit Workload Agent Address Ports Message amf/0 active idle 10.1.146.26
ausf/0
active idle 10.1.146.45
grafana-agent-k8s/0 blocked idle 10.1.146.59 logging-consumer: off, grafana-cloud-config: off mongodb-k8s/0 active idle 10.1.146.25 Primary nms/0 active idle 10.1.146.9
nrf/0
active idle 10.1.146.44
nssf/0 active idle 10.1.146.49
pcf/0
active idle 10.1.146.35
router/0 active idle 10.1.146.5
self-signed-certificates/0
active idle 10.1.146.42
smf/0 active idle 10.1.146.19
traefik-k8s/0
active idle 10.1.146.46
udm/0 active idle 10.1.146.55
udr/0
active idle 10.1.146.13
upf/0 active idle 10.1.146.4
webui/0
active idle 10.1.146.30

We get 404 error, suspecting that Traefik does route it properly. curl -vvv https://10.0.0.3:80/core-nms -k

Environment

Additional context

This is ingress.yaml in Traefik.

root@traefik-k8s-0:/var/lib/juju/storage/configurations/0/juju# cat juju_ingress_ingress_33_nms.yaml http: middlewares: juju-sidecar-noprefix-core-nms: stripPrefix: forceSlash: false prefixes:

curl -vvv http://nms-0.nms-endpoints.core.svc.cluster.local:3000

Juju debug logs:

unit-traefik-k8s-0: 11:01:10 INFO unit.traefik-k8s/0.juju-log Kubernetes service 'traefik-k8s' patched successfully unit-traefik-k8s-0: 11:01:11 ERROR unit.traefik-k8s/0.juju-log invalid databag contents: expecting json. {'host': 'nms-0.nms-endpoints.core.svc.cluster.local', 'model': 'core', 'name': 'nms', 'port': '3000', 'strip-prefix': 'true'} unit-traefik-k8s-0: 11:01:11 WARNING unit.traefik-k8s/0.juju-log is using a deprecated ingress v1 protocol to talk to Traefik. Please inform the maintainers of 'nms' that they should bump to v2. unit-traefik-k8s-0: 11:01:11 WARNING unit.traefik-k8s/0.juju-log provider: <charms.traefik_k8s.v1.ingress.IngressPerAppProvider object at 0x7f3cc7e72dc0> unit-traefik-k8s-0: 11:01:11 WARNING unit.traefik-k8s/0.juju-log providing ingress over ingress v1: handling it as ingress per leader (legacy) unit-traefik-k8s-0: 11:01:11 ERROR unit.traefik-k8s/0.juju-log invalid databag contents: expecting json. {'host': 'nms-0.nms-endpoints.core.svc.cluster.local', 'model': 'core', 'name': 'nms', 'port': '3000', 'strip-prefix': 'true'}

gruyaume commented 7 months ago

The main issue here is that we are using the path routing mode instead of subdomain as mentioned in the sdcore-nms-operator README.md. I have this PR out to update the SD-Core bundles to use subdomain as the routing mode: https://github.com/canonical/sdcore-bundles/pull/23