Skip to content

Commit b18ee20

Browse files
feat: namespace resources, add GrafanaDashboard
1 parent 0cf55e7 commit b18ee20

File tree

10 files changed

+94
-3
lines changed

10 files changed

+94
-3
lines changed

charts/subgraph-availability-oracle/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.7.2
18+
version: 0.8.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/subgraph-availability-oracle/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Deploy a Subgraph Availability Oracle into your Kubernetes stack
44

5-
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.7.2](https://img.shields.io/badge/Version-0.7.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.4.0](https://img.shields.io/badge/AppVersion-1.4.0-informational?style=flat-square)
5+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.8.0](https://img.shields.io/badge/Version-0.8.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.4.0](https://img.shields.io/badge/AppVersion-1.4.0-informational?style=flat-square)
66

77
## Introduction
88

@@ -52,6 +52,14 @@ We do not recommend that you upgrade the application by overriding `image.tag`.
5252
| grafana.dashboards | Enable creation of Grafana dashboards. [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart) must be configured to search this namespace, see `sidecar.dashboards.searchNamespace` | bool | `false` |
5353
| grafana.dashboardsConfigMapLabel | Must match `sidecar.dashboards.label` value for the [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart) | string | `"grafana_dashboard"` |
5454
| grafana.dashboardsConfigMapLabelValue | Must match `sidecar.dashboards.labelValue` value for the [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart) | string | `"1"` |
55+
| grafana.operatorDashboards | Create GrafanaDashboard CRDs via Grafana Operator from files in `dashboards/` | object | `{"allowCrossNamespaceImport":false,"annotations":{},"enabled":false,"extraSpec":{},"folder":"","folderUID":"","instanceSelector":{"matchLabels":{}},"labels":{},"namespace":"","resyncPeriod":"","suspend":false,"uid":""}` |
56+
| grafana.operatorDashboards.allowCrossNamespaceImport | Allow matching Grafana instances outside current namespace | bool | `false` |
57+
| grafana.operatorDashboards.extraSpec | Additional spec fields to merge into GrafanaDashboard.spec | object | `{}` |
58+
| grafana.operatorDashboards.folder | Optional folder metadata | string | `""` |
59+
| grafana.operatorDashboards.instanceSelector | Selector to match Grafana instances managed by the operator | object | `{"matchLabels":{}}` |
60+
| grafana.operatorDashboards.labels | Extra labels and annotations on the GrafanaDashboard resources | object | `{}` |
61+
| grafana.operatorDashboards.namespace | Optional target namespace for the GrafanaDashboard CRDs (defaults to release namespace) | string | `""` |
62+
| grafana.operatorDashboards.resyncPeriod | Operator sync behavior | string | `""` |
5563
| image | Image for subgraph-radio | object | `{"pullPolicy":"Always","repository":"ghcr.io/graphprotocol/availability-oracle","tag":"latest"}` |
5664
| image.tag | Overrides the image tag | string | Chart.appVersion |
5765
| imagePullSecrets | Pull secrets required to fetch the Image | list | `[]` |
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{{- $g := $.Values.grafana -}}
2+
{{- if and $g.operatorDashboards $g.operatorDashboards.enabled -}}
3+
{{- $op := $g.operatorDashboards -}}
4+
{{- $namespace := default $.Release.Namespace $op.namespace -}}
5+
{{- $files := .Files.Glob "dashboards/*" -}}
6+
{{- range $path, $_ := $files }}
7+
---
8+
apiVersion: grafana.integreatly.org/v1beta1
9+
kind: GrafanaDashboard
10+
metadata:
11+
name: {{ include "subgraph-availability-oracle.fullname" $ }}-{{ base $path | replace "." "-" | trunc 63 | trimSuffix "-" }}
12+
namespace: {{ $namespace }}
13+
labels:
14+
{{- include "subgraph-availability-oracle.labels" $ | nindent 4 }}
15+
{{- with $.Values.extraLabels }}
16+
{{- toYaml . | nindent 4 }}
17+
{{- end }}
18+
{{- with $op.labels }}
19+
{{- toYaml . | nindent 4 }}
20+
{{- end }}
21+
{{- with $op.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
allowCrossNamespaceImport: {{ default false $op.allowCrossNamespaceImport }}
27+
{{- with $op.instanceSelector }}
28+
instanceSelector:
29+
{{- toYaml . | nindent 4 }}
30+
{{- end }}
31+
{{- with $op.folder }}
32+
folder: {{ . }}
33+
{{- end }}
34+
{{- with $op.folderUID }}
35+
folderUID: {{ . }}
36+
{{- end }}
37+
{{- with $op.uid }}
38+
uid: {{ . }}
39+
{{- end }}
40+
{{- with $op.resyncPeriod }}
41+
resyncPeriod: {{ . }}
42+
{{- end }}
43+
{{- if hasKey $op "suspend" }}
44+
suspend: {{ $op.suspend }}
45+
{{- end }}
46+
{{- with $op.extraSpec }}
47+
{{- toYaml . | nindent 2 }}
48+
{{- end }}
49+
json: |
50+
{{- $.Files.Get $path | nindent 4 }}
51+
{{- end }}
52+
{{- end }}

charts/subgraph-availability-oracle/templates/dashboards.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ apiVersion: v1
44
kind: ConfigMap
55
metadata:
66
name: {{ include "subgraph-availability-oracle.fullname" . }}-dashboards
7+
namespace: {{ .Release.Namespace }}
78
labels:
89
{{- include "subgraph-availability-oracle.labels" . | nindent 4 }}
910
{{- with .Values.extraLabels }}
@@ -12,4 +13,4 @@ metadata:
1213
{{ $values.dashboardsConfigMapLabel }}: {{ $values.dashboardsConfigMapLabelValue | quote }}
1314
data:
1415
{{- (.Files.Glob "dashboards/*").AsConfig | nindent 2 }}
15-
{{- end }}
16+
{{- end }}

charts/subgraph-availability-oracle/templates/rbac.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ apiVersion: rbac.authorization.k8s.io/v1
44
kind: Role
55
metadata:
66
name: {{ include "subgraph-availability-oracle.serviceAccountName" . }}
7+
namespace: {{ .Release.Namespace }}
78
labels:
89
{{- include "subgraph-availability-oracle.labels" . | nindent 4 }}
910
{{- with .Values.extraLabels }}
@@ -16,6 +17,7 @@ apiVersion: rbac.authorization.k8s.io/v1
1617
kind: RoleBinding
1718
metadata:
1819
name: {{ include "subgraph-availability-oracle.serviceAccountName" . }}
20+
namespace: {{ .Release.Namespace }}
1921
labels:
2022
{{- include "subgraph-availability-oracle.labels" . | nindent 4 }}
2123
{{- with .Values.extraLabels }}
@@ -28,6 +30,7 @@ roleRef:
2830
subjects:
2931
- kind: ServiceAccount
3032
name: {{ include "subgraph-availability-oracle.serviceAccountName" . }}
33+
namespace: {{ .Release.Namespace }}
3134
---
3235
apiVersion: rbac.authorization.k8s.io/v1
3336
kind: ClusterRole

charts/subgraph-availability-oracle/templates/serviceaccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: ServiceAccount
44
metadata:
55
name: {{ include "subgraph-availability-oracle.serviceAccountName" . }}
6+
namespace: {{ .Release.Namespace }}
67
labels:
78
{{- include "subgraph-availability-oracle.labels" . | nindent 4 }}
89
{{- with .Values.extraLabels }}

charts/subgraph-availability-oracle/templates/subgraph-availability-oracle/service.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: Service
44
metadata:
55
name: {{ include "subgraph-availability-oracle.fullname" . }}-headless
6+
namespace: {{ .Release.Namespace }}
67
labels:
78
{{- include "subgraph-availability-oracle.labels" . | nindent 4 }}
89
{{- with $values.extraLabels }}
@@ -22,6 +23,7 @@ metadata:
2223
service.kubernetes.io/topology-aware-hints: "auto"
2324
{{- end }}
2425
name: {{ include "subgraph-availability-oracle.fullname" . }}
26+
namespace: {{ .Release.Namespace }}
2527
labels:
2628
{{- include "subgraph-availability-oracle.labels" . | nindent 4 }}
2729
{{- with $values.extraLabels }}

charts/subgraph-availability-oracle/templates/subgraph-availability-oracle/servicemonitor.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ apiVersion: monitoring.coreos.com/v1
55
kind: ServiceMonitor
66
metadata:
77
name: {{ include "subgraph-availability-oracle.fullname" . }}
8+
namespace: {{ .Release.Namespace }}
89
labels:
910
{{- include "subgraph-availability-oracle.labels" . | nindent 4 }}
1011
{{- with $values.extraLabels }}

charts/subgraph-availability-oracle/templates/subgraph-availability-oracle/statefulset.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ apiVersion: apps/v1
55
kind: StatefulSet # StatefulSet is better behaved when trying to maintain a single instance
66
metadata:
77
name: {{ include "subgraph-availability-oracle.fullname" . }}
8+
namespace: {{ .Release.Namespace }}
89
labels:
910
{{- include "subgraph-availability-oracle.labels" . | nindent 4 }}
1011
{{- with $values.extraLabels }}

charts/subgraph-availability-oracle/values.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,28 @@ grafana:
6161
dashboardsConfigMapLabel: grafana_dashboard
6262
# -- Must match `sidecar.dashboards.labelValue` value for the [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart)
6363
dashboardsConfigMapLabelValue: "1"
64+
# -- Create GrafanaDashboard CRDs via Grafana Operator from files in `dashboards/`
65+
operatorDashboards:
66+
enabled: false
67+
# -- Optional target namespace for the GrafanaDashboard CRDs (defaults to release namespace)
68+
namespace: ""
69+
# -- Extra labels and annotations on the GrafanaDashboard resources
70+
labels: {}
71+
annotations: {}
72+
# -- Selector to match Grafana instances managed by the operator
73+
instanceSelector:
74+
matchLabels: {}
75+
# -- Allow matching Grafana instances outside current namespace
76+
allowCrossNamespaceImport: false
77+
# -- Optional folder metadata
78+
folder: ""
79+
folderUID: ""
80+
uid: ""
81+
# -- Operator sync behavior
82+
resyncPeriod: ""
83+
suspend: false
84+
# -- Additional spec fields to merge into GrafanaDashboard.spec
85+
extraSpec: {}
6486

6587
serviceAccount:
6688
# -- Specifies whether a service account should be created

0 commit comments

Comments
 (0)