From 5e2b25e0cfa74f9f5e9606fe4e01a00e2b12a093 Mon Sep 17 00:00:00 2001 From: Diana Sari <122408329+diana-sari@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:06:30 -0700 Subject: [PATCH 1/6] updating to the most recent thanos version (#74) * updating to the most recent thanos version * updating the helm chart version --- charts/aro-thanos-af/Chart.yaml | 2 +- charts/aro-thanos-af/templates/thanos/thanos-querier.yaml | 2 +- charts/aro-thanos-af/templates/thanos/thanos-receive.yaml | 2 +- charts/aro-thanos-af/templates/thanos/thanos-store.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/aro-thanos-af/Chart.yaml b/charts/aro-thanos-af/Chart.yaml index 766a7ac..af7644c 100644 --- a/charts/aro-thanos-af/Chart.yaml +++ b/charts/aro-thanos-af/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: aro-thanos-af description: A Helm chart for Kubernetes type: application -version: 0.6.3 +version: 0.6.4 dependencies: - name: grafana-cr version: "0.4.0" diff --git a/charts/aro-thanos-af/templates/thanos/thanos-querier.yaml b/charts/aro-thanos-af/templates/thanos/thanos-querier.yaml index d443513..aaaf1f8 100644 --- a/charts/aro-thanos-af/templates/thanos/thanos-querier.yaml +++ b/charts/aro-thanos-af/templates/thanos/thanos-querier.yaml @@ -27,7 +27,7 @@ spec: # fsGroup: 65534 containers: - name: thanos - image: quay.io/thanos/thanos:v0.24.0-rc.2 + image: quay.io/thanos/thanos:v0.34.1 args: - query - --query.replica-label=replica diff --git a/charts/aro-thanos-af/templates/thanos/thanos-receive.yaml b/charts/aro-thanos-af/templates/thanos/thanos-receive.yaml index c55406e..e6e0874 100644 --- a/charts/aro-thanos-af/templates/thanos/thanos-receive.yaml +++ b/charts/aro-thanos-af/templates/thanos/thanos-receive.yaml @@ -23,7 +23,7 @@ spec: fsGroup: 65534 containers: - name: thanos-receive - image: quay.io/thanos/thanos:v0.24.0-rc.2 + image: quay.io/thanos/thanos:v0.34.1 args: - receive - --tsdb.path=/data/remote-write-receive-data diff --git a/charts/aro-thanos-af/templates/thanos/thanos-store.yaml b/charts/aro-thanos-af/templates/thanos/thanos-store.yaml index aafe831..2fb1a80 100644 --- a/charts/aro-thanos-af/templates/thanos/thanos-store.yaml +++ b/charts/aro-thanos-af/templates/thanos/thanos-store.yaml @@ -24,7 +24,7 @@ spec: fsGroup: 65534 containers: - name: thanos - image: quay.io/thanos/thanos:v0.24.0-rc.2 + image: quay.io/thanos/thanos:v0.34.1 args: - store - --data-dir=/data From 727c71887b47a2fabcf42c34385191a1230dbec8 Mon Sep 17 00:00:00 2001 From: Diana Sari <122408329+diana-sari@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:34:09 -0700 Subject: [PATCH 2/6] updating fluentbit to the most recent version (#75) * updating fluentbit to the most recent version * updating app version --- charts/aro-clf-am/Chart.yaml | 2 +- charts/aro-clf-am/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/aro-clf-am/Chart.yaml b/charts/aro-clf-am/Chart.yaml index 5a9e05f..3f06a8e 100644 --- a/charts/aro-clf-am/Chart.yaml +++ b/charts/aro-clf-am/Chart.yaml @@ -3,7 +3,7 @@ name: aro-clf-am description: A Helm chart for Kubernetes type: application -version: 0.1.1 +version: 0.1.2 home: "https://rh-mobb.github.io/helm-charts/" diff --git a/charts/aro-clf-am/values.yaml b/charts/aro-clf-am/values.yaml index 41b7b7d..f666f29 100644 --- a/charts/aro-clf-am/values.yaml +++ b/charts/aro-clf-am/values.yaml @@ -18,7 +18,7 @@ image: repository: fluent/fluent-bit pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: 1.6 + tag: 2.2 nameOverride: "" fullnameOverride: "" From d38a2cb235f13765751b0030a5f5b479102926a1 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Tue, 30 Apr 2024 19:43:28 +0200 Subject: [PATCH 3/6] add support for tags (#76) Signed-off-by: David J. M. Karlsen --- charts/aro-machinesets/Chart.yaml | 2 +- charts/aro-machinesets/templates/machineset.yaml | 3 +++ charts/aro-machinesets/values.yaml | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/charts/aro-machinesets/Chart.yaml b/charts/aro-machinesets/Chart.yaml index fc7f914..a33634b 100644 --- a/charts/aro-machinesets/Chart.yaml +++ b/charts/aro-machinesets/Chart.yaml @@ -3,7 +3,7 @@ name: aro-machinesets description: A Helm chart to configure machinesets for ARO type: application -version: 0.4.0 +version: 0.5.0 maintainers: - name: paulczar home: https://github.com/rh-mobb/helm-charts diff --git a/charts/aro-machinesets/templates/machineset.yaml b/charts/aro-machinesets/templates/machineset.yaml index 1ec107e..455e238 100644 --- a/charts/aro-machinesets/templates/machineset.yaml +++ b/charts/aro-machinesets/templates/machineset.yaml @@ -60,6 +60,9 @@ spec: publicLoadBalancer: {{ $machineSetSpec.publicLoadBalancer }} resourceGroup: {{ $machineSetSpec.resourceGroup }} subnet: {{ $machineSetSpec.subnet }} + {{- if $machineSetSpec.tags }} + tags: {{ $machineSetSpec.tags | toYaml | nindent 12 }} + {{- end }} userDataSecret: name: worker-user-data vmSize: {{ $.Values.vmSize }} diff --git a/charts/aro-machinesets/values.yaml b/charts/aro-machinesets/values.yaml index 94061ca..c6436f8 100644 --- a/charts/aro-machinesets/values.yaml +++ b/charts/aro-machinesets/values.yaml @@ -51,6 +51,10 @@ machineSetSpec: resourceGroup: aro-cddajpe1 subnet: aro-cluster-machine-subnet vnet: aro-cluster-vnet + ## uncomment to add tags on the vms + # tags: + # key1: value1 + # key2: value2 ## spotVMOptions - optionally declare spotVMOptions when setting enableSpot to true as described on ## https://docs.openshift.com/container-platform/4.12/machine_management/creating_machinesets/creating-machineset-azure.html#machineset-non-guaranteed-instance_creating-machineset-azure # spotVMOptions: From 98dc4b59c34b7940b46d74c4ba044ea2bd3fcba8 Mon Sep 17 00:00:00 2001 From: Shane Snyder <95644687+shane-snyder@users.noreply.github.com> Date: Tue, 14 May 2024 12:27:38 -0400 Subject: [PATCH 4/6] Updated grafana-cr to use grafanav5 operator (#79) --- charts/grafana-cr/Chart.yaml | 2 +- charts/grafana-cr/templates/configmap.yaml | 7 + charts/grafana-cr/templates/dashboards.yaml | 7 +- charts/grafana-cr/templates/grafana.yaml | 176 +++++++++++--------- charts/grafana-cr/templates/rbac.yaml | 2 +- 5 files changed, 109 insertions(+), 85 deletions(-) create mode 100644 charts/grafana-cr/templates/configmap.yaml diff --git a/charts/grafana-cr/Chart.yaml b/charts/grafana-cr/Chart.yaml index 4099095..edfeee6 100644 --- a/charts/grafana-cr/Chart.yaml +++ b/charts/grafana-cr/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: grafana-cr description: A Helm chart for Deploying Grafana instances using the Grafana Operator type: application -version: 0.4.0 +version: 0.5.0 home: https://github.com/rh-mobb/helm-charts maintainers: - name: paulczar diff --git a/charts/grafana-cr/templates/configmap.yaml b/charts/grafana-cr/templates/configmap.yaml new file mode 100644 index 0000000..a749b2b --- /dev/null +++ b/charts/grafana-cr/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "grafana-cr.fullname" . }}-certs + labels: + config.openshift.io/inject-trusted-cabundle: "true" + name: {{ include "grafana-cr.fullname" . }}-certs \ No newline at end of file diff --git a/charts/grafana-cr/templates/dashboards.yaml b/charts/grafana-cr/templates/dashboards.yaml index d0fcdab..7140dfe 100644 --- a/charts/grafana-cr/templates/dashboards.yaml +++ b/charts/grafana-cr/templates/dashboards.yaml @@ -1,12 +1,13 @@ {{ range .Values.dashboards }} --- -apiVersion: integreatly.org/v1alpha1 +apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard metadata: name: {{ .name }} - labels: - app: grafana spec: + instanceSelector: + matchLabels: + dashboards: "grafana" json: {{ .json }} {{ end }} diff --git a/charts/grafana-cr/templates/grafana.yaml b/charts/grafana-cr/templates/grafana.yaml index ab41464..ce763d4 100644 --- a/charts/grafana-cr/templates/grafana.yaml +++ b/charts/grafana-cr/templates/grafana.yaml @@ -1,103 +1,119 @@ --- -apiVersion: integreatly.org/v1alpha1 +apiVersion: grafana.integreatly.org/v1beta1 kind: Grafana metadata: name: {{ include "grafana-cr.fullname" . }} labels: + dashboards: "grafana" {{- include "grafana-cr.labels" . | nindent 4 }} spec: + route: + spec: + port: + targetPort: https + tls: + termination: reencrypt + to: + kind: Service + name: {{ include "grafana-cr.fullname" . }}-service + weight: 100 + wildcardPolicy: None deployment: - skipCreateAdminAccount: True - envFrom: - - secretRef: - name: {{ include "grafana-cr.fullname" . }}-creds + spec: + template: + spec: + volumes: + - name: {{ include "grafana-cr.fullname" . }}-tls + secret: + secretName: {{ include "grafana-cr.fullname" . }}-tls + - name: {{ include "grafana-cr.fullname" . }}-proxy + secret: + secretName: {{ include "grafana-cr.fullname" . }}-proxy + - name: {{ include "grafana-cr.fullname" . }}-certs + configMap: + name: {{ include "grafana-cr.fullname" . }}-certs + containers: + - image: 'quay.io/openshift/origin-oauth-proxy:4.12' + name: grafana-proxy + args: + - -provider=openshift + - -https-address=:9091 + - -http-address= + - -email-domain=* + - -upstream=http://localhost:3000 + - '-openshift-sar={"resource": "namespaces", "verb": "get"}' + - '-openshift-delegate-urls={"/": {"resource": "namespaces", "verb": "get"}}' + - -tls-cert=/etc/tls/private/tls.crt + - -tls-key=/etc/tls/private/tls.key + - -client-secret-file=/var/run/secrets/kubernetes.io/serviceaccount/token + - -openshift-service-account={{ include "grafana-cr.fullname" . }}-sa + - -openshift-ca=/etc/pki/tls/cert.pem + - -openshift-ca=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt + - -openshift-ca=/etc/proxy/certs/ca-bundle.crt + - -cookie-secret-file=/etc/proxy/secrets/session_secret + - -cookie-expire=24h + - -scope=user:info user:check-access user:list-projects + - -pass-access-token=true + - -pass-basic-auth=false + - -skip-provider-button=true + - -skip-auth-regex=^/metrics + envFrom: + - secretRef: + name: {{ include "grafana-cr.fullname" . }}-creds + ports: + - containerPort: 9091 + name: https + resources: {} + volumeMounts: + - mountPath: /etc/tls/private + name: {{ include "grafana-cr.fullname" . }}-tls + readOnly: false + - mountPath: /etc/proxy/secrets + name: {{ include "grafana-cr.fullname" . }}-proxy + readOnly: false + - mountPath: /etc/proxy/certs + name: {{ include "grafana-cr.fullname" . }}-certs + readOnly: false config: - analytics: - check_for_updates: false - reporting_enabled: false + auth.anonymous: + enabled: "True" auth: - disable_login_form: true - disable_signout_menu: true - sigv4_auth_enabled: true + disable_login_form: "False" + disable_signout_menu: "True" auth.basic: - enabled: false + enabled: "True" auth.proxy: - auto_sign_up: true - enabled: true - header_name: X-Forwarded-User + auto_sign_up: "True" + enabled: "True" + enable_login_token: "True" + header_property: "username" + header_name: "X-Forwarded-User" log: level: {{ .Values.logLevel }} mode: console - security: - admin_user: system:does-not-exist - cookie_secure: true users: - auto_assign_org: true + auto_assign_org: "True" auto_assign_org_role: {{ .Values.oauthProxy.orgRoleAssigned }} - default_theme: light - editors_can_admin: true - viewers_can_edit: true - containers: - - image: 'quay.io/openshift/origin-oauth-proxy:4.12' - name: grafana-proxy - args: - - -provider=openshift - - -https-address=:9091 - - -http-address= - - -email-domain=* - - -upstream=http://localhost:3000 - - '-openshift-sar={"resource": "namespaces", "verb": "get"}' - - '-openshift-delegate-urls={"/": {"resource": "namespaces", "verb": "get"}}' - - -tls-cert=/etc/tls/private/tls.crt - - -tls-key=/etc/tls/private/tls.key - - -client-secret-file=/var/run/secrets/kubernetes.io/serviceaccount/token - - -openshift-service-account=grafana-serviceaccount - - -openshift-ca=/etc/pki/tls/cert.pem - - -openshift-ca=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt - - -cookie-secret-file=/etc/proxy/secrets/session_secret - - -cookie-expire=24h - - -scope=user:info user:check-access user:list-projects - - -pass-access-token=true - - -pass-basic-auth=false - - -display-htpasswd-form=false - - -htpasswd-file=/etc/proxy/htpasswd/auth - - -skip-provider-button=true - ports: - - containerPort: 9091 - name: grafana-proxy - resources: {} - volumeMounts: - - mountPath: /etc/tls/private - name: secret-{{ include "grafana-cr.fullname" . }}-tls - readOnly: false - - mountPath: /etc/proxy/secrets - name: secret-{{ include "grafana-cr.fullname" . }}-proxy - readOnly: false - - mountPath: /etc/proxy/htpasswd - name: secret-{{ include "grafana-cr.fullname" . }}-htpasswd - readOnly: true + default_theme: dark + editors_can_admin: "True" + viewers_can_edit: "True" secrets: - {{ include "grafana-cr.fullname" . }}-tls - {{ include "grafana-cr.fullname" . }}-proxy - {{ include "grafana-cr.fullname" . }}-htpasswd service: - ports: - - name: grafana-proxy - port: 9091 - protocol: TCP - targetPort: grafana-proxy - annotations: - service.alpha.openshift.io/serving-cert-secret-name: {{ include "grafana-cr.fullname" . }}-tls - ingress: - enabled: True - targetPort: grafana-proxy - termination: reencrypt + metadata: + annotations: + service.beta.openshift.io/serving-cert-secret-name: {{ include "grafana-cr.fullname" . }}-tls + spec: + ports: + - name: https + port: 9091 + protocol: TCP + targetPort: https + client: + preferIngress: false serviceAccount: - annotations: - serviceaccounts.openshift.io/oauth-redirectreference.primary: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"grafana-route"}}' - {{- with .Values.serviceAccountAnnotations }} - {{- toYaml . | nindent 6 }} - {{- end }} - dashboardLabelSelector: - - matchExpressions: - - { key: "app", operator: In, values: ['grafana'] } + metadata: + annotations: + serviceaccounts.openshift.io/oauth-redirectreference.primary: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"{{ include "grafana-cr.fullname" . }}-route"}}' diff --git a/charts/grafana-cr/templates/rbac.yaml b/charts/grafana-cr/templates/rbac.yaml index 30a2c6b..1116bf7 100644 --- a/charts/grafana-cr/templates/rbac.yaml +++ b/charts/grafana-cr/templates/rbac.yaml @@ -27,5 +27,5 @@ roleRef: name: {{ include "grafana-cr.fullname" . }} subjects: - kind: ServiceAccount - name: grafana-serviceaccount + name: {{ include "grafana-cr.fullname" . }}-sa namespace: {{ .Release.Namespace }} From c69f9fc4bfcd2f4e803fb7806255ffd426388b76 Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Wed, 15 May 2024 14:18:25 -0400 Subject: [PATCH 5/6] Rosa thano s3 alloy (#82) * allow setting storage class for aro-clf-blob Signed-off-by: Paul Czarkowski * update rosa-thanos-s3 to grafana5 operator, and grafana-alloy Signed-off-by: Paul Czarkowski --------- Signed-off-by: Paul Czarkowski --- charts/rosa-thanos-s3/Chart.yaml | 8 +- charts/rosa-thanos-s3/files/operatorhub.yaml | 16 +- .../templates/grafana/agent.yaml | 208 ------------------ .../templates/grafana/alloy.yaml | 50 +++++ .../templates/grafana/dashboards.yaml | 5 +- .../templates/grafana/grafanadatasource.yaml | 25 ++- charts/rosa-thanos-s3/values.yaml | 7 + 7 files changed, 88 insertions(+), 231 deletions(-) delete mode 100644 charts/rosa-thanos-s3/templates/grafana/agent.yaml create mode 100644 charts/rosa-thanos-s3/templates/grafana/alloy.yaml diff --git a/charts/rosa-thanos-s3/Chart.yaml b/charts/rosa-thanos-s3/Chart.yaml index 474ae4f..0fd95a7 100644 --- a/charts/rosa-thanos-s3/Chart.yaml +++ b/charts/rosa-thanos-s3/Chart.yaml @@ -4,14 +4,16 @@ description: A Helm chart for Kubernetes type: application -version: 0.1.0 +version: 0.3.0 dependencies: - name: grafana-cr - version: "0.1.1" + version: "0.5.0" repository: "https://rh-mobb.github.io/helm-charts/" # repository: file://../grafana-cr - + - name: alloy + repository: https://grafana.github.io/helm-charts + version: "0.2.0" home: "https://rh-mobb.github.io/helm-charts/" maintainers: diff --git a/charts/rosa-thanos-s3/files/operatorhub.yaml b/charts/rosa-thanos-s3/files/operatorhub.yaml index 0252a9c..234c4bf 100644 --- a/charts/rosa-thanos-s3/files/operatorhub.yaml +++ b/charts/rosa-thanos-s3/files/operatorhub.yaml @@ -1,6 +1,6 @@ subscriptions: - name: grafana-operator - channel: v4 + channel: v5 installPlanApproval: Automatic source: community-operators sourceNamespace: openshift-marketplace @@ -13,14 +13,14 @@ subscriptions: operatorGroups: - name: federated-metrics - targetNamespace: ~ + targetNamespace: all # - name: resource-locker # namespace: resource-locker-operator # targetNamespace: resource-locker-operator -catalogSources: - - name: community-operators - sourceType: grpc - image: quay.io/operator-framework/upstream-community-operators:latest - displayName: Community Operators - publisher: OperatorHub.io +# catalogSources: +# - name: community-operators +# sourceType: grpc +# image: quay.io/operator-framework/upstream-community-operators:latest +# displayName: Community Operators +# publisher: OperatorHub.io diff --git a/charts/rosa-thanos-s3/templates/grafana/agent.yaml b/charts/rosa-thanos-s3/templates/grafana/agent.yaml deleted file mode 100644 index eb5c64c..0000000 --- a/charts/rosa-thanos-s3/templates/grafana/agent.yaml +++ /dev/null @@ -1,208 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - labels: - {{- include "rosa-thanos-s3.labels" . | nindent 4 }} ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - labels: - {{- include "rosa-thanos-s3.labels" . | nindent 4 }} -rules: -- apiGroups: - - "" - resources: - - nodes - - nodes/proxy - - services - - endpoints - - pods - - namespaces - verbs: - - get - - list - - watch -- nonResourceURLs: - - /metrics - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - labels: - {{- include "rosa-thanos-s3.labels" . | nindent 4 }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent -subjects: -- kind: ServiceAccount - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - namespace: {{ .Release.Namespace }} ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - labels: - {{- include "rosa-thanos-s3.labels" . | nindent 4 }} -spec: - minReadySeconds: 10 - replicas: 1 - revisionHistoryLimit: 10 - selector: - matchLabels: - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - template: - metadata: - labels: - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - spec: - containers: - - args: - - -config.file=/etc/agent/agent.yaml - command: - - /bin/agent - env: - - name: HOSTNAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - image: grafana/agent:v0.20.0 - imagePullPolicy: IfNotPresent - name: agent - ports: - - containerPort: 12345 - name: http-metrics - volumeMounts: - - mountPath: /etc/agent - name: grafana-agent - serviceAccount: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - volumes: - - configMap: - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - name: grafana-agent ---- -kind: ConfigMap -metadata: - name: {{ include "rosa-thanos-s3.fullname" . }}-grafana-agent - labels: - {{- include "rosa-thanos-s3.labels" . | nindent 4 }} -apiVersion: v1 -data: - agent.yaml: | - server: - http_listen_port: 12345 - prometheus: - wal_directory: /tmp/grafana-agent-wal - global: - scrape_interval: 15s - external_labels: - cluster: {{ .Values.rosa.clusterName }} - configs: - - name: integrations - remote_write: - - url: "http://thanos-receive.{{ .Release.Namespace }}.svc.cluster.local:9091/api/v1/receive" - queue_config: - max_samples_per_send: 1000 - max_shards: 200 - capacity: 2500 - scrape_configs: - - job_name: cluster-monitoring - honor_labels: true - params: - 'match[]': - - '{job!=""}' - scrape_interval: 30s - scrape_timeout: 30s - metrics_path: /federate - scheme: https - kubernetes_sd_configs: - - role: endpoints - namespaces: - names: - - openshift-monitoring - bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - tls_config: - insecure_skip_verify: true - relabel_configs: - - source_labels: [job] - separator: ; - regex: (.*) - target_label: __tmp_prometheus_job_name - replacement: $1 - action: replace - - source_labels: [__meta_kubernetes_service_label_prometheus] - separator: ; - regex: k8s - replacement: $1 - action: keep - - source_labels: [__meta_kubernetes_endpoint_port_name] - separator: ; - regex: web - replacement: $1 - action: keep - - source_labels: [__meta_kubernetes_endpoint_address_target_kind, __meta_kubernetes_endpoint_address_target_name] - separator: ; - regex: Node;(.*) - target_label: node - replacement: ${1} - action: replace - - source_labels: [__meta_kubernetes_endpoint_address_target_kind, __meta_kubernetes_endpoint_address_target_name] - separator: ; - regex: Pod;(.*) - target_label: pod - replacement: ${1} - action: replace - - source_labels: [__meta_kubernetes_namespace] - separator: ; - regex: (.*) - target_label: namespace - replacement: $1 - action: replace - - source_labels: [__meta_kubernetes_service_name] - separator: ; - regex: (.*) - target_label: service - replacement: $1 - action: replace - - source_labels: [__meta_kubernetes_pod_name] - separator: ; - regex: (.*) - target_label: pod - replacement: $1 - action: replace - - source_labels: [__meta_kubernetes_pod_container_name] - separator: ; - regex: (.*) - target_label: container - replacement: $1 - action: replace - - source_labels: [__meta_kubernetes_service_name] - separator: ; - regex: (.*) - target_label: job - replacement: ${1} - action: replace - - separator: ; - regex: (.*) - target_label: endpoint - replacement: web - action: replace - - source_labels: [__address__] - separator: ; - regex: (.*) - modulus: 1 - target_label: __tmp_hash - replacement: $1 - action: hashmod - - source_labels: [__tmp_hash] - separator: ; - regex: "0" - replacement: $1 - action: keep diff --git a/charts/rosa-thanos-s3/templates/grafana/alloy.yaml b/charts/rosa-thanos-s3/templates/grafana/alloy.yaml new file mode 100644 index 0000000..65e3f50 --- /dev/null +++ b/charts/rosa-thanos-s3/templates/grafana/alloy.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + name: grafana-alloy-config +data: + config.alloy: |- + prometheus.scrape "cluster_metrics" { + job_name = "cluster-monitoring" + forward_to = [prometheus.remote_write.cluster_metrics.receiver] + targets = [ + { + "__address__" = "prometheus-k8s.openshift-monitoring.svc.cluster.local:9091", + "__scheme__" = "https", + "__metrics_path__" = "/federate", + }, + ] + honor_labels = true + params = { + "match[]" = ["{job!=\"\"}"], + } + scrape_interval = "30s" + scrape_timeout = "30s" + metrics_path = "/federate" + scheme = "https" + + authorization { + type = "Bearer" + credentials_file = "/var/run/secrets/kubernetes.io/serviceaccount/token" + } + tls_config { + insecure_skip_verify = true + } + } + + prometheus.remote_write "cluster_metrics" { + external_labels = { + cluster = "{{ .Values.rosa.clusterName }}", + } + endpoint { + name = "thanos-receive" + url = "http://thanos-receive.{{ .Release.Namespace }}.svc.cluster.local:9091/api/v1/receive" + queue_config { + capacity = 2500 + max_shards = 200 + max_samples_per_send = 1000 + } + metadata_config { } + } + } diff --git a/charts/rosa-thanos-s3/templates/grafana/dashboards.yaml b/charts/rosa-thanos-s3/templates/grafana/dashboards.yaml index 0bba029..74c230e 100644 --- a/charts/rosa-thanos-s3/templates/grafana/dashboards.yaml +++ b/charts/rosa-thanos-s3/templates/grafana/dashboards.yaml @@ -1,11 +1,14 @@ {{ range $path, $_ := .Files.Glob "files/dashboards/*.json" }} --- -apiVersion: integreatly.org/v1alpha1 +apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard metadata: name: {{ base $path }} labels: app: grafana spec: + instanceSelector: + matchLabels: + dashboards: "grafana" json: {{ $.Files.Get $path }} {{ end }} diff --git a/charts/rosa-thanos-s3/templates/grafana/grafanadatasource.yaml b/charts/rosa-thanos-s3/templates/grafana/grafanadatasource.yaml index d8015fd..610780b 100644 --- a/charts/rosa-thanos-s3/templates/grafana/grafanadatasource.yaml +++ b/charts/rosa-thanos-s3/templates/grafana/grafanadatasource.yaml @@ -1,17 +1,20 @@ -apiVersion: integreatly.org/v1alpha1 -kind: GrafanaDataSource +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDatasource metadata: name: {{ include "rosa-thanos-s3.fullname" . }}-prometheus labels: {{- include "rosa-thanos-s3.labels" . | nindent 4 }} spec: name: {{ include "rosa-thanos-s3.fullname" . }}.yaml - datasources: - - access: proxy - editable: false - isDefault: true - jsonData: - timeInterval: 5s - name: prometheus - type: prometheus - url: 'http://thanos-querier.{{ .Release.Namespace }}.svc.cluster.local:9090' + instanceSelector: + matchLabels: + dashboards: grafana + datasource: + name: prometheus + access: proxy + editable: false + isDefault: true + jsonData: + timeInterval: 5s + type: prometheus + url: 'http://thanos-querier.{{ .Release.Namespace }}.svc.cluster.local:9090' diff --git a/charts/rosa-thanos-s3/values.yaml b/charts/rosa-thanos-s3/values.yaml index 06c70a7..3815beb 100644 --- a/charts/rosa-thanos-s3/values.yaml +++ b/charts/rosa-thanos-s3/values.yaml @@ -26,3 +26,10 @@ grafana-cr: basicAuthUsername: "admin" basicAuthPassword: "password" # serviceAccountAnnotations: {} + +alloy: + alloy: + configMap: + create: false + name: grafana-alloy-config + key: config.alloy From 9e69b79f8605c5d5c63c9e8592abc21d14249406 Mon Sep 17 00:00:00 2001 From: Shane Snyder <95644687+shane-snyder@users.noreply.github.com> Date: Wed, 15 May 2024 14:19:04 -0400 Subject: [PATCH 6/6] Updating thanos to use grafanav5 (#81) --- charts/aro-thanos-af/Chart.yaml | 5 ++-- ...uster_metrics.ocp411.grafanadashboard.yaml | 7 ++--- ...infra_metrics.ocp411.grafanadashboard.yaml | 7 ++--- .../aro-thanos-af/files/grafana-operator.yaml | 2 +- .../templates/grafana/dashboards.yaml | 7 ++--- .../templates/grafana/grafanadatasource.yaml | 26 ++++++++++--------- 6 files changed, 29 insertions(+), 25 deletions(-) diff --git a/charts/aro-thanos-af/Chart.yaml b/charts/aro-thanos-af/Chart.yaml index af7644c..0feca2f 100644 --- a/charts/aro-thanos-af/Chart.yaml +++ b/charts/aro-thanos-af/Chart.yaml @@ -2,12 +2,11 @@ apiVersion: v2 name: aro-thanos-af description: A Helm chart for Kubernetes type: application -version: 0.6.4 +version: 0.7.0 dependencies: - name: grafana-cr - version: "0.4.0" + version: "0.5.0" repository: "https://rh-mobb.github.io/helm-charts/" - # repository: file://../grafana-cr home: "https://rh-mobb.github.io/helm-charts/" maintainers: - name: rh-mobb diff --git a/charts/aro-thanos-af/files/dashboards/cluster_metrics.ocp411.grafanadashboard.yaml b/charts/aro-thanos-af/files/dashboards/cluster_metrics.ocp411.grafanadashboard.yaml index 74276c5..fc4ab28 100644 --- a/charts/aro-thanos-af/files/dashboards/cluster_metrics.ocp411.grafanadashboard.yaml +++ b/charts/aro-thanos-af/files/dashboards/cluster_metrics.ocp411.grafanadashboard.yaml @@ -1,10 +1,11 @@ -apiVersion: integreatly.org/v1alpha1 +apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard metadata: - labels: - app: grafana name: cluster-metrics spec: + instanceSelector: + matchLabels: + dashboards: "grafana" json: | { "annotations": { diff --git a/charts/aro-thanos-af/files/dashboards/infra_metrics.ocp411.grafanadashboard.yaml b/charts/aro-thanos-af/files/dashboards/infra_metrics.ocp411.grafanadashboard.yaml index ee5dbb5..4db3218 100644 --- a/charts/aro-thanos-af/files/dashboards/infra_metrics.ocp411.grafanadashboard.yaml +++ b/charts/aro-thanos-af/files/dashboards/infra_metrics.ocp411.grafanadashboard.yaml @@ -1,10 +1,11 @@ -apiVersion: integreatly.org/v1alpha1 +apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard metadata: - labels: - app: grafana name: infra-metrics spec: + instanceSelector: + matchLabels: + dashboards: "grafana" json: | { "annotations": { diff --git a/charts/aro-thanos-af/files/grafana-operator.yaml b/charts/aro-thanos-af/files/grafana-operator.yaml index 4897a37..e634812 100644 --- a/charts/aro-thanos-af/files/grafana-operator.yaml +++ b/charts/aro-thanos-af/files/grafana-operator.yaml @@ -1,6 +1,6 @@ subscriptions: - name: grafana-operator - channel: v4 + channel: v5 installPlanApproval: Automatic source: community-operators sourceNamespace: openshift-marketplace diff --git a/charts/aro-thanos-af/templates/grafana/dashboards.yaml b/charts/aro-thanos-af/templates/grafana/dashboards.yaml index 0bba029..fcb6d2c 100644 --- a/charts/aro-thanos-af/templates/grafana/dashboards.yaml +++ b/charts/aro-thanos-af/templates/grafana/dashboards.yaml @@ -1,11 +1,12 @@ {{ range $path, $_ := .Files.Glob "files/dashboards/*.json" }} --- -apiVersion: integreatly.org/v1alpha1 +apiVersion: grafana.integreatly.org/v1beta1 kind: GrafanaDashboard metadata: name: {{ base $path }} - labels: - app: grafana spec: + instanceSelector: + matchLabels: + dashboards: "grafana" json: {{ $.Files.Get $path }} {{ end }} diff --git a/charts/aro-thanos-af/templates/grafana/grafanadatasource.yaml b/charts/aro-thanos-af/templates/grafana/grafanadatasource.yaml index 94b20c4..8e8ece7 100644 --- a/charts/aro-thanos-af/templates/grafana/grafanadatasource.yaml +++ b/charts/aro-thanos-af/templates/grafana/grafanadatasource.yaml @@ -1,17 +1,19 @@ -apiVersion: integreatly.org/v1alpha1 -kind: GrafanaDataSource +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDatasource metadata: name: {{ include "aro-thanos-af.fullname" . }}-prometheus labels: {{- include "aro-thanos-af.labels" . | nindent 4 }} spec: - name: {{ include "aro-thanos-af.fullname" . }}.yaml - datasources: - - access: proxy - editable: false - isDefault: true - jsonData: - timeInterval: 5s - name: prometheus - type: prometheus - url: 'http://thanos-querier.{{ .Release.Namespace }}.svc.cluster.local:9090' + instanceSelector: + matchLabels: + dashboards: grafana + datasource: + access: proxy + editable: false + isDefault: true + jsonData: + timeInterval: 5s + name: prometheus + type: prometheus + url: 'http://thanos-querier.{{ .Release.Namespace }}.svc.cluster.local:9090'