Skip to content

Resource dispatcher might fail on remove hook #185

Description

@dariofaccin

Bug Description

As subject.

To Reproduce

  1. juju deploy resource-dispatcher
  2. Integrate with required charms
  3. juju remove-application resource-dispatcher

Environment

Any

Relevant Log Output

2026-09-02T08:59:31.372Z [container-agent] 2026-09-02 08:59:31 INFO juju.worker.uniter.operation runhook.go:186 ran "stop" hook (via hook dispatching script: dispatch)
2026-09-02T08:59:31.868Z [container-agent] 2026-09-02 08:59:31 WARNING juju-log The ``kubernetes_service_patch v1`` library is DEPRECATED and will be removed in October 2025. For patching the Kubernetes service created by Juju during the deployment of a charm, ``ops.Unit.set_ports`` functionality should be used instead.
2026-09-02T08:59:31.960Z [container-agent] 2026-09-02 08:59:31 INFO juju-log HTTP Request: GET https://10.152.183.1/apis/security.istio.io/v1/authorizationpolicies?labelSelector=app.kubernetes.io%2Finstance%3Dresource-dispatcher-kubeflow%2Ckubernetes-resource-handler-scope%3Dresource-dispatcher-allow-all "HTTP/1.1 200 OK"
2026-09-02T08:59:32.048Z [container-agent] 2026-09-02 08:59:32 INFO juju-log HTTP Request: GET https://10.152.183.1/apis/apiextensions.k8s.io/v1/customresourcedefinitions "HTTP/1.1 200 OK"
2026-09-02T08:59:32.332Z [pebble] Check "readiness" failure 1/3: non-2xx status code 418
2026-09-02T08:59:32.353Z [container-agent] 2026-09-02 08:59:32 INFO juju-log Rendering manifests
2026-09-02T08:59:32.392Z [container-agent] 2026-09-02 08:59:32 ERROR juju-log Uncaught exception while in charm code:
2026-09-02T08:59:32.392Z [container-agent] Traceback (most recent call last):
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/src/charm.py", line 396, in <module>
2026-09-02T08:59:32.392Z [container-agent]     main(ResourceDispatcherOperator)
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/ops/__init__.py", line 356, in __call__
2026-09-02T08:59:32.392Z [container-agent]     return _main.main(charm_class=charm_class, use_juju_for_storage=use_juju_for_storage)
2026-09-02T08:59:32.392Z [container-agent]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/ops/_main.py", line 502, in main
2026-09-02T08:59:32.392Z [container-agent]     manager.run()
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/ops/_main.py", line 486, in run
2026-09-02T08:59:32.392Z [container-agent]     self._emit()
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/ops/_main.py", line 421, in _emit
2026-09-02T08:59:32.392Z [container-agent]     self._emit_charm_event(self.dispatcher.event_name)
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/ops/_main.py", line 465, in _emit_charm_event
2026-09-02T08:59:32.392Z [container-agent]     event_to_emit.emit(*args, **kwargs)
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/ops/framework.py", line 351, in emit
2026-09-02T08:59:32.392Z [container-agent]     framework._emit(event)
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/ops/framework.py", line 924, in _emit
2026-09-02T08:59:32.392Z [container-agent]     self._reemit(event_path)
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/ops/framework.py", line 1030, in _reemit
2026-09-02T08:59:32.392Z [container-agent]     custom_handler(event)
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/src/charm.py", line 385, in _on_remove
2026-09-02T08:59:32.392Z [container-agent]     k8s_resources_manifests = self.k8s_resource_handler.render_manifests()
2026-09-02T08:59:32.392Z [container-agent]                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/charmed_kubeflow_chisme/kubernetes/_kubernetes_resource_handler.py", line 268, in render_manifests
2026-09-02T08:59:32.392Z [container-agent]     self._manifests = codecs.load_all_yaml(
2026-09-02T08:59:32.392Z [container-agent]                       ^^^^^^^^^^^^^^^^^^^^^
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/lightkube/codecs.py", line 96, in load_all_yaml
2026-09-02T08:59:32.392Z [container-agent]     return _flatten(yaml.safe_load_all(stream))
2026-09-02T08:59:32.392Z [container-agent]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/lightkube/codecs.py", line 86, in _flatten
2026-09-02T08:59:32.392Z [container-agent]     res = from_dict(obj)
2026-09-02T08:59:32.392Z [container-agent]           ^^^^^^^^^^^^^^
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/lightkube/codecs.py", line 44, in from_dict
2026-09-02T08:59:32.392Z [container-agent]     model = resource_registry.load(d["apiVersion"], d["kind"])
2026-09-02T08:59:32.392Z [container-agent]             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-09-02T08:59:32.392Z [container-agent]   File "/var/lib/juju/agents/unit-resource-dispatcher-0/charm/venv/lib/python3.12/site-packages/lightkube/core/resource_registry.py", line 114, in load
2026-09-02T08:59:32.392Z [container-agent]     raise LoadResourceError(
2026-09-02T08:59:32.392Z [container-agent] lightkube.core.exceptions.LoadResourceError: Cannot find resource DecoratorController of group metacontroller.k8s.io/v1alpha1. If using a CRD, ensure a generic resource is defined.
2026-09-02T08:59:32.697Z [container-agent] 2026-09-02 08:59:32 ERROR juju.worker.uniter.operation runhook.go:180 hook "remove" (via hook dispatching script: dispatch) failed: exit status 1

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions