-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Armin Schlegel <armin.schlegel@gmx.de>
- Loading branch information
Showing
9 changed files
with
1,971 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 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 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,39 @@ | ||
{ | ||
"branches": [ | ||
{ | ||
"name": "main" | ||
}, | ||
{ | ||
"name": "beta", | ||
"prerelease": true | ||
} | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "cd charts/grafana-dashboards/scripts/ && ./edge_nodes.sh" | ||
} | ||
], | ||
[ | ||
"semantic-release-helm3", | ||
{ | ||
"chartPath": "./charts/grafana-dashboards", | ||
"registry": "ghcr.io/edgefarm/grafana-dashboards" | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": [ | ||
"charts/grafana-dashboards/Chart.yaml", | ||
"charts/grafana-dashboards/templates/dashboard-edge-nodes.yaml" | ||
], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
], | ||
"@semantic-release/github" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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,15 @@ | ||
apiVersion: v2 | ||
name: grafana-dashboards | ||
description: This chart contains a bunch of grafana dashboards that are loaded into grafana by the grafana-operator. | ||
type: application | ||
version: 0.1.0 | ||
appVersion: 0.1.0 | ||
keywords: | ||
- edgefarm.monitor | ||
- grafana | ||
- dashboards | ||
sources: | ||
- https://github.com/edgefarm/grafana-dashboards | ||
maintainers: | ||
- name: Armin Schlegel | ||
email: armin.schlegel@gmx.de |
This file contains 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,53 @@ | ||
#!/bin/bash | ||
# This script is supposed to be called from the location of the script (charts/grafana-dashboards/scripts) | ||
|
||
set -e | ||
|
||
function createDashboardTemplate() { | ||
# Parameters | ||
local configmap_name=$1 | ||
local file_path=$2 | ||
local output_file=$3 | ||
|
||
# Extract the filename from the file path to use as the key in the ConfigMap | ||
local file_name=$(basename "$file_path") | ||
|
||
# Create a temporary yaml file | ||
local temp_file=$(mktemp) | ||
|
||
echo "{{- if.Values.dashboards.edgeNodes.enabled }}" >"$temp_file" | ||
|
||
# Write the ConfigMap to the temporary file | ||
cat <<EOF >>$temp_file | ||
--- | ||
# This file is generated by charts/grafana-dashboards/scripts/edge_nodes.sh | ||
# Do not edit this file manually | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: $configmap_name | ||
namespace: "{{ .Release.Namespace }}" | ||
labels: | ||
grafana_dashboard: "" | ||
{{- include "grafana-dashboards.labels" . | nindent 4 }} | ||
data: | ||
$file_name: |- | ||
EOF | ||
|
||
# Append the contents of the file to the ConfigMap | ||
sed 's/^/ /' "$file_path" >>"$temp_file" | ||
|
||
echo -e "\n{{- end }}" >>"$temp_file" | ||
|
||
## Search and Replace the legendFormat if it contains variables like {{ variable}} to | ||
## make them work with helm (put raw string around them {{ ` raw string ` }}) | ||
## example: "legendFormat": "{{chip}}-{{sensor}}" to "legendFormat": {{`"{{chip}}-{{sensor}}",`}} | ||
sed -ri 's#\"legendFormat\": \"(.*)\",#\"legendFormat\": \{\{`\"\1\",`\}\}#g' "$temp_file" | ||
|
||
cat "$temp_file" >"$output_file" | ||
|
||
# Remove the temporary file | ||
rm "$temp_file" | ||
} | ||
|
||
createDashboardTemplate "dashboard-edge-nodes" "../../../dashboards/edge_nodes.json" "../templates/dashboard-edge-nodes.yaml" |
This file contains 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,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "grafana-dashboards.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "grafana-dashboards.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "grafana-dashboards.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "grafana-dashboards.labels" -}} | ||
helm.sh/chart: {{ include "grafana-dashboards.chart" . }} | ||
{{ include "grafana-dashboards.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "grafana-dashboards.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "grafana-dashboards.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "grafana-dashboards.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "grafana-dashboards.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.