canonical / pvcviewer-operator

Charm PVCViewer for visualizing PVC content
Apache License 2.0
2 stars 0 forks source link

pvcviewer-operator charm in `BlockedStatus` due to `Failed to create Kubernetes resources` #11

Closed NohaIhab closed 11 months ago

NohaIhab commented 11 months ago

Bug Description

pvcviewer is stuck in BlockedStatus because it's failing to create K8s resources, specifically trying to create the ClusterRoleBinding.rbac.authorization.k8s.io "manager-rolebinding" is causing the error.

To Reproduce

juju deploy kubeflow --channel=latest/edge --trust
juju deploy pvcviewer-operator --channel=latest/edge --trust

Environment

microk8s 1.25-strict/stable juju 3.1/stable

Relevant log output

unit-pvcviewer-operator-0: 11:36:57 ERROR unit.pvcviewer-operator/0.juju-log execute_components caught unhandled exception when executing configure_charm for kubernetes:auth-and-crds
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/lightkube/core/generic_client.py", line 188, in raise_for_status
    resp.raise_for_status()
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/httpx/_models.py", line 749, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '422 Unprocessable Entity' for url 'https://10.152.183.1/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/manager-rolebinding?force=true&fieldManager=lightkube'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/charmed_kubeflow_chisme/components/kubernetes_component.py", line 49, in _configure_app_leader
    krh.apply()
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/charmed_kubeflow_chisme/kubernetes/_kubernetes_resource_handler.py", line 367, in apply
    raise e
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/charmed_kubeflow_chisme/kubernetes/_kubernetes_resource_handler.py", line 340, in apply
    apply_many(
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/charmed_kubeflow_chisme/lightkube/batch/_many.py", line 72, in apply_many
    returns[i] = client.apply(
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/lightkube/core/client.py", line 457, in apply
    return self.patch(type(obj), name, obj, namespace=namespace,
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/lightkube/core/client.py", line 325, in patch
    return self._client.request("patch", res=res, name=name, namespace=namespace, obj=obj,
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/lightkube/core/generic_client.py", line 245, in request
    return self.handle_response(method, resp, br)
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/lightkube/core/generic_client.py", line 196, in handle_response
    self.raise_for_status(resp)
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/lightkube/core/generic_client.py", line 190, in raise_for_status
    raise transform_exception(e)
lightkube.core.exceptions.ApiError: ClusterRoleBinding.rbac.authorization.k8s.io "manager-rolebinding" is invalid: roleRef: Invalid value: rbac.RoleRef{APIGroup:"rbac.authorization.k8s.io", Kind:"ClusterRole", Name:"role"}: cannot change roleRef

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/charmed_kubeflow_chisme/components/charm_reconciler.py", line 92, in reconcile
    component_item.component.configure_charm(event)
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/charmed_kubeflow_chisme/components/component.py", line 51, in configure_charm
    self._configure_app(event)
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/charmed_kubeflow_chisme/components/component.py", line 88, in _configure_app
    self._configure_app_leader(event)
  File "/var/lib/juju/agents/unit-pvcviewer-operator-0/charm/venv/charmed_kubeflow_chisme/components/kubernetes_component.py", line 52, in _configure_app_leader
    raise GenericCharmRuntimeError("Failed to create Kubernetes resources") from e
<unknown>.GenericCharmRuntimeError: Failed to create Kubernetes resources

Additional context

No response