-
Notifications
You must be signed in to change notification settings - Fork 449
Description
Summary
Currently, when the Grafana Operator creates a Grafana Service Account, the associated token Secret is created in the same namespace as the Grafana instance. This works fine when other components (e.g., Kiali) that need to integrate with Grafana are deployed in the same namespace.
However, if Grafana is deployed in a different namespace than Kiali, the integration fails because Kiali cannot access the token Secret from another namespace.
This limitation makes cross-namespace integrations difficult and forces users to co-locate components in the same namespace, which is not always desirable for organizational or security reasons.
Use Case
- Grafana is deployed in namespace grafana-ns.
- Kiali is deployed in namespace observability.
- Kiali needs to access Grafana using the Grafana Service Account token.
- Currently, the token Secret is created in grafana-ns, so Kiali cannot access it.
If the operator supported writing the token Secret into a custom namespace (e.g., observability), Kiali could access it without requiring both components to share the same namespace.
Proposed Solution
Add a configurable target namespace for generated token Secrets on the GrafanaServiceAccount CRD.
This should be per-token for flexibility.
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaServiceAccount
metadata:
name: my-grafana-sa
namespace: grafana-ns
spec:
name: grafana-kiali-integration
role: Viewer
instanceName: grafana-cr
isDisabled: false
tokens:
- name: grafana-kiali-serviceaccount-token
secretName: grafana-kiali-serviceaccount-token-secret
secretNamespace: observability # NEW: write Secret into this namespaceNotes
- Operator will need RBAC permissions to create/update/delete Secrets in the target namespace.
- If secretNamespace is omitted, behavior remains unchanged (Secret stays in the GSA namespace).
- Clear error/status should be surfaced if the operator lacks permission to write in the target namespace.