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

Headlamp does not show restart/edit/scale buttons on resources with sufficient permissions #2633

Open
Andrew1988123123 opened this issue Dec 4, 2024 · 2 comments
Labels
bug Something isn't working frontend Issues related to the frontend

Comments

@Andrew1988123123
Copy link

Describe the bug

The bug title says it all. I gave permissions to restart, scale, edit the deployment but the button with the option to restart and scale the deployment does not appear. These are sufficient permissions because I tested using kubectl.
kubectl rollout restart deployment gotify -n default

According to the documentation the buttons should appear
https://headlamp.dev/docs/latest/faq/#headlamp-is-not-showing-deleteeditscale-buttons-in-a-resource-why-is-that

To Reproduce

Create Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: gotify
  namespace: default
spec:
  selector:
    matchLabels:
      app: gotify
  replicas: 1
  template:
    metadata:
      labels:
        app: gotify
    spec:
      containers:
        - name: gotify
          image: gotify/server
          env:
            - name: GOTIFY_SERVER_PORT
              value: "81"
          ports:
            - containerPort: 81
          readinessProbe:
            httpGet:
              path: /health
              port: 81
            initialDelaySeconds: 5
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: /health
              port: 81
            initialDelaySeconds: 10
            periodSeconds: 20

Create SA with secret

apiVersion: v1
kind: Secret
metadata:
  name: cluster-developer
  namespace: default
  annotations:
    kubernetes.io/service-account.name: cluster-developer
type: kubernetes.io/service-account-token
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: cluster-developer
  namespace: default

Create custom RBAC with sufficient permissions.

kind: ClusterRole
metadata:
  name: custom-role
rules:
  - apiGroups: [ "" ]
    resources: [ "pods" ]
    verbs: [ "get", "delete" ]
  - apiGroups: [ "" ]
    resources: [ "pods/portforward" ]
    verbs: [ "get", "create", "delete" ]
  - apiGroups: [ "" ]
    resources: [ "pods/exec" ]
    verbs: [ "get", "create" ]
  - apiGroups: [ "" ]
    resources: [ "configmaps" ]
    verbs: [ "get" ]
  - apiGroups: [ "apps" ]
    resources: [ "deployments/scale" ]
    verbs: [ "get", "patch" ]
  - apiGroups: [ "apps" ]
    resources: [ "deployments" ]
    verbs: [ "get", "patch" ]

---

# ClusterRoleBinding for granting the custom-role to the service account
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: cluster-developer-binding
subjects:
  - kind: ServiceAccount
    name: cluster-developer
    namespace: default
roleRef:
  kind: ClusterRole
  name: custom-role
  apiGroup: rbac.authorization.k8s.io

---

# ClusterRoleBinding for granting the 'view' role to the service account
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: cluster-developer-view-binding
subjects:
  - kind: ServiceAccount
    name: cluster-developer
    namespace: default
roleRef:
  kind: ClusterRole
  name: view
  apiGroup: rbac.authorization.k8s.io

Environment (please provide info about your environment):

  • Installation type: Windows-Winget
  • Headlamp Version: v0.26.0

Are you able to fix this issue?

No. I work as devops :(

Additional Context

image

Excepted result
image

Additionally, after pressing the actions button the bubble has weird formatting.
image

@Andrew1988123123 Andrew1988123123 added the bug Something isn't working label Dec 4, 2024
@dosubot dosubot bot added the frontend Issues related to the frontend label Dec 4, 2024
@skoeva
Copy link
Contributor

skoeva commented Dec 4, 2024

Hi, thanks for submitting this issue!

Do the buttons also not appear at the top when you click on the deployment?

image

Tried to test this locally (app in WSL and browser) and I see this on both:

image

@Andrew1988123123
Copy link
Author

Thanks for the reply
After clicking on the deployment object I see this.
image

Do you use correct kubeconfig? On the last photo you have a visible delete button. My custom RBAC does not contain delete verb which removes deployment object. You should use kubeconfig with limited access. Use all the roles I used and generate kubeconfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend Issues related to the frontend
Projects
Development

No branches or pull requests

2 participants