Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
NohaIhab opened this issue Oct 4, 2023 · 0 comments · Fixed by #12
Closed
Labels
bug Something isn't working

Comments

@NohaIhab
Copy link
Contributor

NohaIhab commented Oct 4, 2023

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

@NohaIhab NohaIhab added the bug Something isn't working label Oct 4, 2023
NohaIhab added a commit that referenced this issue Oct 4, 2023
adds pvcviewer prefix to all roles and rolebindings, closes #11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant