Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 65
Make Grafana a standalone application#850
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
Open
methylDragon
wants to merge
1
commit into
mainChoose a base branch
from
ch3/standalone-grafana
base:main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Uh oh!
There was an error while loading. Please reload this page.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
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 |
|---|---|---|
| @@ -7,6 +7,7 @@ APPS = [ | ||
| "k8s-relay", | ||
| "mission-crd", | ||
| "prometheus", | ||
| "grafana", | ||
| "token-vendor", | ||
| "akri", | ||
| ] | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| load("//bazel:app.bzl", "app") | ||
| load("//bazel:app_chart.bzl", "app_chart") | ||
| load("//bazel:build_rules/helm_template.bzl", "helm_template") | ||
| helm_template( | ||
| name = "grafana-operator-chart.cloud", | ||
| # We use the kube-prometheus-stack chart instead of the standalone grafana chart | ||
| # because it natively bundles all the default Kubernetes mixin dashboards (like node-exporter, | ||
| # kubelet, apiserver) as ConfigMaps. We disable the rest of the backend components in the values file. | ||
| chart = "//third_party/kube-prometheus-stack:kube-prometheus-stack-87.5.1.tgz", | ||
| helm_version = 3, | ||
| kube_version = "1.29.0", | ||
| # The namespace will later be replaced with the actual one. | ||
| namespace = "HELM-NAMESPACE", | ||
| # Pick a short release name as it will be used as a prefix for a lot of resources. | ||
| release_name = "grafana", | ||
| values = "grafana-cloud.values.yaml", | ||
| ) | ||
| app_chart( | ||
| name = "grafana-cloud", | ||
| # CRITICAL: Do NOT include 00-crds.yaml to prevent ownership collisions with Prometheus | ||
| extra_values = ["values-cloud.yaml"], | ||
| files = [ | ||
| ":grafana-operator-chart.cloud", | ||
| ], | ||
| ) | ||
| app( | ||
| name = "grafana", | ||
| charts = [ | ||
| ":grafana-cloud", | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| ) |
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,32 @@ | ||
| apiVersion: app.k8s.io/v1beta1 | ||
| kind: Application | ||
| metadata: | ||
| name: "grafana" | ||
| labels: | ||
| app.kubernetes.io/name: {{ .Chart.Name }} | ||
| app.kubernetes.io/version: {{ .Chart.Version }} | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| app.kubernetes.io/name: {{ .Chart.Name }} | ||
| componentKinds: | ||
| - group: core | ||
| kind: Service | ||
| - group: apps | ||
| kind: Deployment | ||
| - group: apps | ||
| kind: Ingress | ||
| - group: gateway.networking.k8s.io | ||
| kind: HTTPRoute | ||
| - group: gateway.envoyproxy.io | ||
| kind: SecurityPolicy | ||
| descriptor: | ||
| type: "grafana" | ||
| version: {{ .Chart.Version }} | ||
| description: "Grafana provides visualization dashboards" | ||
| keywords: | ||
| - "dashboard" | ||
| - "visualization" | ||
| links: | ||
| - description: Grafana Dashboard | ||
| url: "https://{{ .Values.domain }}/grafana/" |
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,22 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: grafana-datasources | ||
| labels: | ||
| grafana_datasource: "1" | ||
| app.kubernetes.io/name: {{ .Chart.Name }} | ||
| data: | ||
| datasources.yaml: | | ||
| apiVersion: 1 | ||
| {{- if .Values.datasources }} | ||
| datasources: | ||
| {{ toYaml .Values.datasources | indent 4 }} | ||
| {{- else }} | ||
| datasources: | ||
| - name: Prometheus | ||
| type: prometheus | ||
| uid: prometheus | ||
| url: http://kube-prometheus.{{ .Values.prometheusNamespace | default "app-prometheus" }}.svc.cluster.local:9090 | ||
| access: proxy | ||
| isDefault: true | ||
| {{- end }} |
4 changes: 2 additions & 2 deletions
4 .../prometheus/cloud/grafana-http-route.yaml → ...rts/grafana/cloud/grafana-http-route.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
2 changes: 1 addition & 1 deletion
2 ...rts/prometheus/cloud/grafana-ingress.yaml → ...charts/grafana/cloud/grafana-ingress.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 |
|---|---|---|
| @@ -23,6 +23,6 @@ spec: | ||
| pathType: Prefix | ||
| backend: | ||
| service: | ||
| name: prom-grafana | ||
| name: grafana | ||
| port: | ||
| number: 80 | ||
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,25 @@ | ||
| # This includes all resources expanded from the grafana-operator chart using | ||
| # the values in ../grafana-cloud.values.yaml. | ||
| # Some pseudo-variables that were inserted there are replaced with actual runtime values. | ||
| # NOTE: The order here is important. The domain and project might be part of other values and | ||
| # need to be replaced last. | ||
| {{- $data := .Files.Get "files/grafana-operator-chart.cloud.yaml" -}} | ||
| # Pre-process variables | ||
| {{- $data = $data | replace "${CR_GF_INGRESS_AUTH_URL}" .Values.gf_ingress_auth_url -}} | ||
| {{- $data = $data | replace "${CR_GF_INGRESS_AUTH_SIGNIN}" .Values.gf_ingress_auth_signin -}} | ||
| {{- $data = $data | replace "${CR_GF_INGRESS_ERROR_PAGE_403}" .Values.gf_ingress_error_page_403 -}} | ||
| {{- $data = $data | replace "${CR_GF_SERVER_DOMAIN}" .Values.gf_server_domain -}} | ||
| {{- $data = $data | replace "${CR_GF_SERVER_ROOT_URL}" .Values.gf_server_root_url -}} | ||
| {{- $data = $data | replace "${CR_GF_CSRF_TRUSTED_ORIGINS}" .Values.gf_csrf_trusted_origins -}} | ||
| {{- $data = $data | replace "${CR_GF_SMTP_ENABLED}" .Values.gf_smtp_enabled -}} | ||
| {{- $data = $data | replace "${CR_GF_SMTP_HOST}" .Values.gf_smtp_host -}} | ||
| {{- $data = $data | replace "${CR_GF_SMTP_USER}" .Values.gf_smtp_user -}} | ||
| {{- $data = $data | replace "${CR_GF_SMTP_PASSWORD}" .Values.gf_smtp_password -}} | ||
| {{- $data = $data | replace "${CR_GF_SMTP_FROM_ADDRESS}" .Values.gf_smtp_from_address -}} | ||
| {{- $data = $data | replace "${CR_GF_SMTP_FROM_NAME}" .Values.gf_smtp_from_name -}} | ||
| {{- $data = $data | replace "${CR_GF_SMTP_SKIP_VERIFY}" .Values.gf_smtp_skip_verify -}} | ||
| {{- $data = $data | replace "HELM-NAMESPACE" .Release.Namespace -}} | ||
| {{- $data = $data | replace "${CLOUD_ROBOTICS_DOMAIN}" .Values.domain -}} | ||
| {{- $data = $data | replace "${GCP_PROJECT_ID}" .Values.project -}} | ||
| {{ $data }} |
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,69 @@ | ||
| nameOverride: kube | ||
| fullnameOverride: kube | ||
| kubeTargetVersionOverride: "1.23.8" | ||
| # We use the kube-prometheus-stack chart instead of the standalone grafana chart | ||
| # because the stack chart natively bundles and updates a large collection of standard | ||
| # kubernetes monitoring dashboards (via kubernetes-mixin, node-exporter-mixin, etc.) | ||
| # as ConfigMaps. By disabling the rest of the backend components and keeping only Grafana | ||
| # enabled, we get a fully configured standalone Grafana with all the rich Kubernetes | ||
| # observability dashboards maintained for us out of the box. | ||
| grafana: | ||
| # default password used by old releases, deployed behind auth-proxy so this | ||
| # is not a secret. | ||
| # we could also use "auth proxy authentication" but the second login defends | ||
| # against unintentional edits to dashboards. | ||
| adminPassword: "prom-operator" | ||
| testFramework: | ||
| enabled: false | ||
| env: | ||
| GF_SERVER_DOMAIN: "${CR_GF_SERVER_DOMAIN}" | ||
| GF_SERVER_ROOT_URL: "${CR_GF_SERVER_ROOT_URL}" | ||
| GF_AUTH_ANONYMOUS_ENABLED: "true" | ||
| # Load dashboards from configmaps with a given label across all namespaces. | ||
| sidecar: | ||
| dashboards: | ||
| enabled: true | ||
| label: grafana # Label our own legacy grafana-operator uses. | ||
| searchNamespace: ALL | ||
| multicluster: | ||
| global: | ||
| enabled: true | ||
| etcd: | ||
| enabled: true | ||
| grafana.ini: | ||
| analytics: | ||
| check_for_updates: false | ||
| security: | ||
| csrf_trusted_origins: "${CR_GF_CSRF_TRUSTED_ORIGINS}" | ||
| smtp: | ||
| enabled: "${CR_GF_SMTP_ENABLED}" | ||
| host: "${CR_GF_SMTP_HOST}" | ||
| user: "${CR_GF_SMTP_USER}" | ||
| password: "${CR_GF_SMTP_PASSWORD}" | ||
| from_address: "${CR_GF_SMTP_FROM_ADDRESS}" | ||
| from_name: "${CR_GF_SMTP_FROM_NAME}" | ||
| skip_verify: "${CR_GF_SMTP_SKIP_VERIFY}" | ||
| serviceMonitor: | ||
| relabelings: | ||
| - sourceLabels: [__meta_kubernetes_pod_node_name] | ||
| targetLabel: instance | ||
| gf_ingress_auth_url: "${CR_GF_INGRESS_AUTH_URL}" | ||
| gf_ingress_auth_signin: "${CR_GF_INGRESS_AUTH_SIGNIN}" | ||
| gf_ingress_error_page_403: "${CR_GF_INGRESS_ERROR_PAGE_403}" | ||
| # Disable all non-Grafana components | ||
| defaultRules: | ||
| create: false | ||
| alertmanager: | ||
| enabled: false | ||
| prometheus: | ||
| enabled: false | ||
| kubeStateMetrics: | ||
| enabled: false | ||
| nodeExporter: | ||
| enabled: false | ||
| prometheusOperator: | ||
| enabled: false |
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,43 @@ | ||
| # Enable toggle for the standalone app components | ||
| grafana: | ||
| enabled: true | ||
| # Grafana HTTP configuration | ||
| gf_server_domain: "${CLOUD_ROBOTICS_DOMAIN}" | ||
| gf_server_root_url: "https://${CLOUD_ROBOTICS_DOMAIN}/grafana" | ||
| gf_csrf_trusted_origins: "" | ||
| # Grafana Ingress configuration. Does not use the same replace as the values above. | ||
| gf_ingress_auth_url: "http://oauth2-proxy.default.svc.cluster.local/apis/core.token-vendor/v1/token.verify" | ||
| # Header modification for Istio/HTTPRoutes support. | ||
| gf_ingress_auth_url_header: "" | ||
| gf_ingress_auth_url_headervalue: "" | ||
| gf_ingress_auth_signin: "https://{{ .Values.domain }}/oauth2/start?rd=$escaped_request_uri" | ||
| gf_ingress_error_page_403: "https://{{ .Values.domain }}/oauth2/start?rd=$escaped_request_uri" | ||
| gf_auth_backend: | ||
| protocol: "http" | ||
| service: "oauth2-proxy" | ||
| namespace: "default" | ||
| port: 80 | ||
| path: "/oauth2/auth" | ||
| contextExtensions: {} | ||
| authProxy: | ||
| authHeaders: | ||
| - authorization | ||
| - cookie | ||
| - x-forwarded-access-token | ||
| - x-forwarded-host | ||
| - apikey-token | ||
| - x-server-name | ||
| # Grafana SMTP configuration | ||
| # Notes: these need to be all string, since we apply them using the template funtion "replace" | ||
| gf_smtp_enabled: "false" | ||
| gf_smtp_host: "smtp-host" | ||
| gf_smtp_user: "smtp-user" | ||
| gf_smtp_password: "smtp-api-key" | ||
| gf_smtp_from_address: "from-address@example.com" | ||
| gf_smtp_from_name: "from-name" | ||
| gf_smtp_skip_verify: "true" | ||
| # Fallback prometheus datasource namespace | ||
| prometheusNamespace: "app-prometheus" |
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
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.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
MERGE AFTER: