Skip to content

Helm-Chart: Role and RoleBinding pyroscope-discovery are missing namespace #5446

Description

@tferazzi

Describe the bug

Role and RoleBinding for pyroscope-discovery are missing namespace: {{ .Release.Namespace }}.

This results in error log entries, like e.g.:

caller=builder.go:44 target=kubernetes:///pyroscope-headless.pyroscope-test.svc.cluster.local.:9095 component=kuberesolver-discovery msg="watching ended with error, will reconnect again" err="invalid response code 403 for service pyroscope-headless in namespace pyroscope-test"

To Reproduce

  1. helm template pyroscope grafana/pyroscope --version 2.2.0 --namespace pyroscope-test > pyroscope-test.yaml results in:
# Source: pyroscope/templates/rbac-discovery.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: pyroscope-discovery
  labels:
    helm.sh/chart: pyroscope-2.2.0
    app.kubernetes.io/name: pyroscope
    app.kubernetes.io/instance: pyroscope
    app.kubernetes.io/version: "2.2.0"
    app.kubernetes.io/managed-by: Helm
rules:
- apiGroups:
  - ""
  - discovery.k8s.io
  resources:
  - endpointslices
  - endpoints
  - services
  - pods
  verbs:
  - get
  - watch
  - list
---
# Source: pyroscope/templates/rbac-discovery.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: pyroscope-discovery
  labels:
    helm.sh/chart: pyroscope-2.2.0
    app.kubernetes.io/name: pyroscope
    app.kubernetes.io/instance: pyroscope
    app.kubernetes.io/version: "2.2.0"
    app.kubernetes.io/managed-by: Helm
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: pyroscope-discovery
subjects:
- kind: ServiceAccount
  name: pyroscope
  namespace: pyroscope-test
  1. kubectl apply -f pyroscope-test.yaml
  2. Inspect logs via kubectl logs -n pyroscope-test statefulsets/pyroscope, watch for above mentioned log entries
  3. kubectl get role -n pyroscope-test returns No resources

Expected behavior

Role and RoleBinding are created in the release namespace (matching all other chart resources) and the Pyroscope ServiceAccount can watch Endpoints/EndpointSlices in its own namespace.

Environment

  • Infrastructure: Kubernetes (GKE)
  • Deployment tool: helm

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions