-
Notifications
You must be signed in to change notification settings - Fork 54
HyperDX Dashboard Provisioner #190
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "helm-charts": minor | ||
| --- | ||
|
|
||
| feat: add dashboard provisioning via a k8s-sidecar that discovers ConfigMaps labeled `hyperdx.io/dashboard: "true"`. Discovery is scoped to the release namespace by default (a namespaced Role, no cluster-wide access); set `hyperdx.dashboards.namespaces` to also watch specific namespaces, or `hyperdx.dashboards.namespaces: [ALL]` for cluster-wide discovery. Requires hyperdxio/hyperdx#1962 (file-based dashboard provisioner). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
charts/clickstack/templates/hyperdx/dashboard-configmap.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| {{- $dashboards := default (dict) .Values.hyperdx.dashboards -}} | ||
| {{- if and $dashboards.enabled $dashboards.configMaps }} | ||
| {{- /* | ||
| Inline dashboard ConfigMap; labeled for discovery by the dashboard provisioner | ||
| alongside any external dashboard ConfigMaps from application charts. | ||
| */ -}} | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: {{ include "clickstack.fullname" . }}-dashboards | ||
| labels: | ||
| {{- include "clickstack.labels" . | nindent 4 }} | ||
| {{ include "clickstack.hyperdx.dashboardLabelKey" . }}: {{ include "clickstack.hyperdx.dashboardLabelValue" . | quote }} | ||
| data: | ||
| {{- $dashboards.configMaps | toYaml | nindent 2 }} | ||
| {{- end }} |
86 changes: 86 additions & 0 deletions
86
charts/clickstack/templates/hyperdx/dashboard-provisioner-rbac.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| {{- if and (default (dict) .Values.hyperdx.dashboards).enabled (eq (include "clickstack.hyperdx.dashboardsRbacCreate" .) "true") }} | ||
| {{- $fullname := include "clickstack.fullname" . -}} | ||
| {{- $saName := include "clickstack.hyperdx.serviceAccountName" . -}} | ||
| {{- /* Cluster-scoped objects are namespace-qualified so two same-named releases don't collide. RBAC names allow 253 chars (not 63), so the qualifier always survives. */}} | ||
| {{- $clusterName := printf "%s-%s-dashboard-provisioner" $fullname .Release.Namespace | trunc 253 | trimSuffix "-" -}} | ||
| {{- if eq (include "clickstack.hyperdx.dashboardsClusterWide" .) "true" }} | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: {{ $clusterName }} | ||
| labels: | ||
| {{- include "clickstack.labels" . | nindent 4 }} | ||
| rules: | ||
| {{- include "clickstack.hyperdx.dashboardRbacRules" . | nindent 2 }} | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: {{ $clusterName }} | ||
| labels: | ||
| {{- include "clickstack.labels" . | nindent 4 }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: {{ $clusterName }} | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ $saName }} | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- else if eq (include "clickstack.hyperdx.dashboardsCrossNamespace" .) "true" }} | ||
| {{- /* Scoped cross-namespace discovery (effective set spans >1 namespace): one ClusterRole as a rule template, bound per namespace via RoleBindings so read access never becomes cluster-wide. */}} | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: {{ $clusterName }} | ||
| labels: | ||
| {{- include "clickstack.labels" . | nindent 4 }} | ||
| rules: | ||
| {{- include "clickstack.hyperdx.dashboardRbacRules" . | nindent 2 }} | ||
| {{- range $ns := (include "clickstack.hyperdx.effectiveNamespaces" . | splitList ",") }} | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ $clusterName }} | ||
| namespace: {{ $ns }} | ||
| labels: | ||
| {{- include "clickstack.labels" $ | nindent 4 }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: {{ $clusterName }} | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ $saName }} | ||
| namespace: {{ $.Release.Namespace }} | ||
| {{- end }} | ||
| {{- else }} | ||
| {{- /* Default: discovery scoped to the release namespace only — a namespaced Role, no cluster-scoped objects. */}} | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: {{ $fullname }}-dashboard-provisioner | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "clickstack.labels" . | nindent 4 }} | ||
| rules: | ||
| {{- include "clickstack.hyperdx.dashboardRbacRules" . | nindent 2 }} | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ $fullname }}-dashboard-provisioner | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| {{- include "clickstack.labels" . | nindent 4 }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: {{ $fullname }}-dashboard-provisioner | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ $saName }} | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add a liveness probe to the watcher?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to dig quite deep to remember why I didn't add any health probes in the first place but there was (and is) a reason for it: the k8s-sidecar image already self-terminates on every failure a probe could catch. A failed startup sync exits the process, and its internal supervisor exits the container if a watcher dies. Together with the restartPolicy: Always, we already provide the restart behavior a probe would add.
A health probe would mainly add a false-positive risk instead: /healthz returns 503 until the initial sync completes, and with cluster-wide discovery on a large cluster that sync can be slow. A liveness probe could kill a healthy watcher mid-sync, and each restart briefly flips the whole pod NotReady, dropping the HyperDX app from Service endpoints over an auxiliary container.
I could add a liveness probe with passthrough values if you'd like though (although I'd advise against it to avoid people shooting themselves in the foot). I'd at least argue to make it empty by default but this would at least allow operators the flexibility to opt-in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. Thanks for the explanation.