canonical / nginx-ingress-integrator-operator

nginx-ingress-integrator-operator - charm repository.
Apache License 2.0
1 stars 8 forks source link

fails when deployed in controller model #3

Open mthaddon opened 2 years ago

mthaddon commented 2 years ago

I got the following traceback when I did a deployment in the controller model of my microk8s-hosted controller.

Usually when you bootstrap on IAAS you get a default model as well as controller and are switched to the former, but apparently not on CAAS.

The controller model appears to be unique in that, unlike other models, the k8s namespace is not simply the name of the model but e.g. controller-microk8s-localhost.

unit-mattermost-ingress-0: 11:44:52 ERROR unit.mattermost-ingress/0.juju-log Uncaught exception while in charm code:
Traceback (most recent call last):
  File "./src/charm.py", line 430, in <module>
    main(NginxIngressCharm)
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/ops/main.py", line 406, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/ops/main.py", line 140, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/ops/framework.py", line 278, in emit
    framework._emit(event)
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/ops/framework.py", line 722, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/ops/framework.py", line 767, in _reemit
    custom_handler(event)
  File "./src/charm.py", line 405, in _on_config_changed
    self._define_service()
  File "./src/charm.py", line 330, in _define_service
    api.create_namespaced_service(
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/kubernetes/client/api/core_v1_api.py", line 8304, in create_namespaced_service
    return self.create_namespaced_service_with_http_info(namespace, body, **kwargs) # noqa: E501
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/kubernetes/client/api/core_v1_api.py", line 8399, in create_namespaced_service_with_http_info
    return self.api_client.call_api(
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/kubernetes/client/api_client.py", line 348, in call_api
    return self.__call_api(resource_path, method,
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/kubernetes/client/api_client.py", line 180, in __call_api
    response_data = self.request(
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/kubernetes/client/api_client.py", line 391, in request
    return self.rest_client.POST(url,
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/kubernetes/client/rest.py", line 274, in POST
    return self.request("POST", url,
  File "/var/lib/juju/agents/unit-mattermost-ingress-0/charm/venv/kubernetes/client/rest.py", line 233, in request
    raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '57360413-dd7d-4ac6-8521-1eb077bd5896', 'X-Kubernetes-Pf-Prioritylevel-Uid': '584d7d24-3cbd-4ef6-8917-d9ce2bb79b62', 'Date': 'Sun, 13 Jun 2021 23:44:52 GMT', 'Content-Length': '200'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"namespaces \"controller\" not found","reason":"NotFound","details":{"name":"controller","kind":"namespaces"},"code":404}

unit-mattermost-ingress-0: 11:44:53 ERROR juju.worker.uniter.operation hook "config-changed" (via hook dispatching script: dispatch) failed: exit status 1
cbartz commented 1 week ago

@Thanhphan1147 Can you have a look and try to reproduce the issue? Thanks.