-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Grafana as an Observability Stack component.
- Loading branch information
1 parent
0e19681
commit 1cce36a
Showing
3 changed files
with
158 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package grafana | ||
|
||
import ( | ||
"k8s.io/api/core/v1" | ||
"stakpak.dev/devx/k8s" | ||
) | ||
|
||
#KubeVersion: [=~"^8\\.5\\.2"]: minor: >=21 | ||
#Values: [=~"^8\\.5\\.2"]: { | ||
|
||
// Default values for deploying Grafana using Helm | ||
|
||
// Image settings | ||
image: { | ||
repository: string | *"grafana/grafana" | ||
tag: string | *"8.5.1" // Specify the version you want to deploy | ||
pullPolicy: v1.#enumPullPolicy | *"IfNotPresent" | ||
} | ||
|
||
// Admin user configuration | ||
adminUser: string | *"admin" // Default admin username | ||
adminPassword: string | *"admin" // Default admin password | ||
existingSecret: string | *"" | ||
|
||
// Service settings | ||
service: { | ||
type: string | *"ClusterIP" | ||
port: k8s.#Port | *3000 | ||
} | ||
|
||
// Persistence settings | ||
persistence: { | ||
enabled: bool | *true // Enable persistent storage | ||
size: string | *"10Gi" // Size of persistent volume | ||
storageClass: string | *"" | ||
accessMode: string | *"ReadWriteOnce" | ||
existingClaim: string | *"" | ||
} | ||
|
||
livenessProbe: { | ||
enabled: bool | *true | ||
initialDelaySeconds: uint | *300 | ||
periodSeconds: uint | *1 | ||
timeoutSeconds: uint | *5 | ||
failureThreshold: uint | *3 | ||
successThreshold: uint | *1 | ||
} | ||
|
||
readinessProbe: { | ||
enabled: bool | *true | ||
initialDelaySeconds: uint | *30 | ||
periodSeconds: uint | *10 | ||
timeoutSeconds: uint | *1 | ||
failureThreshold: uint | *3 | ||
successThreshold: uint | *1 | ||
} | ||
|
||
// Ingress settings | ||
ingress:{ | ||
enabled: bool | *false // Enable ingress to expose Grafana externally | ||
annotations: k8s.#Annotations | ||
hosts: string | *"grafana.local" // Example hostname for your ingress | ||
tls: bool | *false | ||
} | ||
|
||
resources: v1.#ResourceRequirements | *{} | ||
|
||
// Dashboard provisioning (optional) | ||
dashboards: { | ||
enabled: bool | *true // Enable provisioning of dashboards | ||
defaultFolderName: string | *"grafana-dashboards" // Default folder for imported dashboards | ||
dashboardProviders: [{ | ||
name: string | *"default" // Name of the dashboard provider | ||
orgId: int | *1 // Organization ID | ||
folder: string | *"" // Folder for dashboards | ||
type: string | *"file" // Provider type (e.g., file) | ||
disableDeletion: bool | *false // Disable dashboard deletion | ||
editable: bool | *true // Whether the dashboards are editable | ||
updateIntervalSeconds: int | *10 // Time interval for updates in seconds | ||
options: { | ||
path: string | *"/var/lib/grafana/dashboards" // Path for the dashboards | ||
} | ||
}] | ||
} | ||
|
||
// Datasource provisioning (optional) | ||
datasources: { | ||
enabled: bool | *true // Enable provisioning of datasources | ||
datasources: [{ | ||
name: string | *"Prometheus" // Name of the datasource | ||
type: string | *"prometheus" // Type of the datasource | ||
url: string & =~"^http(s)?://[a-zA-Z0-9.-]+(:[0-9]+)?(/.*)?$" | *"http://prometheus:9090" | "https://prometheus:9090" // URL with validation and two default options | ||
access: string | *"proxy" // Access mode for the datasource | ||
isDefault: bool | *true // Marks the datasource as the default one | ||
}] | ||
} | ||
|
||
|
||
// Node selector, tolerations, and affinity for pod scheduling | ||
affinity: v1.#Affinity | ||
nodeSelector: k8s.#Labels | ||
tolerations: [...v1.#Toleration] | ||
|
||
// Annotations for Grafana pod | ||
podAnnotations: k8s.#Annotations | ||
|
||
// Additional volumes and volume mounts | ||
extraVolumes: [...v1.#Volume] | ||
extraVolumeMounts: [...v1.#VolumeMount] | ||
} |
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,29 @@ | ||
package grafana | ||
|
||
import ( | ||
"stakpak.dev/devx/v1" | ||
"stakpak.dev/devx/v1/traits" | ||
) | ||
|
||
#GrafanaChart: { | ||
traits.#Helm | ||
k8s: "version": (v1.getMatch & { | ||
match: helm.version | ||
input: #KubeVersion | ||
}).result | ||
helm: { | ||
repoType: "default" | ||
url: "https://grafana.github.io/helm-charts" | ||
chart: "grafana" | ||
|
||
version: string | *"6.22.0" | ||
|
||
namespace: string | *"monitoring" | ||
release: string | ||
|
||
values: (v1.getMatch & { | ||
match: version | ||
input: #Values | ||
}).result | ||
} | ||
} |
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,19 @@ | ||
package stacks | ||
|
||
import ( | ||
"stakpak.dev/devx/v1" | ||
"stakpak.dev/devx/k8s/services/grafana" | ||
) | ||
|
||
ObservabilityStack: v1.#Stack & { | ||
$metadata: stack: "ObservabilityStack" | ||
components: { | ||
grafana: grafana.#Grafana & { | ||
helm: { | ||
version: "8.5.2" | ||
release: "grafana" | ||
values: {} | ||
} | ||
} | ||
} | ||
} |