Skip to content

Commit

Permalink
feat(kromgo): add helm release
Browse files Browse the repository at this point in the history
  • Loading branch information
tyriis committed Apr 7, 2024
1 parent 8551104 commit f34f22b
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 0 deletions.
112 changes: 112 additions & 0 deletions kubernetes/talos-flux/apps/observability/kromgo/app/helm-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: &app kromgo
spec:
interval: 30m
chart:
spec:
chart: app-template
version: 3.1.0
sourceRef:
kind: HelmRepository
name: bjw-s-charts
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
strategy: rollback
retries: 3
values:
controllers:
kromgo:
replicas: 2
strategy: RollingUpdate
annotations:
reloader.stakater.com/auto: "true"
containers:
app:
image:
repository: ghcr.io/kashalls/kromgo
tag: 0.3.1@sha256:5ba40b2fda00ab7adb039c0be955161b84febfe9e9e7816d5f1f87d9ab41f173
env:
PROMETHEUS_URL: http://prometheus-thanos-discovery.observability.svc.cluster.local:10902
PORT: &port 80
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /-/ready
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
resources:
requests:
cpu: 10m
limits:
memory: 64Mi
pod:
securityContext:
runAsUser: 568
runAsGroup: 568
runAsNonRoot: true
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/name: *app
service:
app:
controller: kromgo
ports:
http:
port: *port
ingress:
app:
className: traefik
annotations:
cert-manager.io/cluster-issuer: letsencrypt-production
kubernetes.io/tls-acme: "true"
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/affinity: "true"
traefik.ingress.kubernetes.io/router.tls: "true"
# external-dns.alpha.kubernetes.io/target: "${SECRET_CLOUDFLARE_TUNNEL_ID}.cfargotunnel.com"
# hajimari.io/icon: video-input-antenna
# hajimari.io/enable: "true"
hosts:
- host: &host "{{ .Release.Name }}.techtales.io"
paths:
- path: /
service:
identifier: app
port: http
tls:
- hosts:
- *host
secretName: "{{ .Release.Name }}-tls"
persistence:
config-file:
type: configMap
name: kromgo-configmap
globalMounts:
- path: /kromgo/config.yaml
subPath: config.yaml
readOnly: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helm-release.yaml
configMapGenerator:
- name: kromgo-configmap
files:
- config.yaml=./resources/config.yaml
generatorOptions:
disableNameSuffixHash: true
labels:
app.kubernetes.io/name: kromgo
app.kubernetes.io/instance: kromgo
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/component: kromgo
app.kubernetes.io/part-of: observability
commonLabels:
app.kubernetes.io/name: kromgo
app.kubernetes.io/instance: kromgo
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/kashalls/kromgo/main/config.schema.json
metrics:
- name: talos_version
query: node_os_info{cluster="main", name="Talos"}
label: version_id

- name: kubernetes_version
query: kubernetes_build_info{cluster="main", service="kubernetes"}
label: git_version

- name: cluster_node_count
query: count(count by (node) (kube_node_status_condition{cluster="main", condition="Ready"}))
colors:
- { color: "green", min: 0, max: 9999 }

- name: cluster_pod_count
query: sum(kube_pod_status_phase{cluster="main", phase="Running"})
colors:
- { color: "green", min: 0, max: 9999 }

- name: cluster_cpu_usage
query: round(avg(instance:node_cpu_utilisation:rate5m{cluster="main"}) * 100, 0.1)
suffix: "%"
colors:
- { color: "green", min: 0, max: 35 }
- { color: "orange", min: 36, max: 75 }
- { color: "red", min: 76, max: 9999 }

- name: cluster_memory_usage
query: round(sum(node_memory_MemTotal_bytes{cluster="main"} - node_memory_MemAvailable_bytes{cluster="main"}) / sum(node_memory_MemTotal_bytes{cluster="main"}) * 100, 0.1)
suffix: "%"
colors:
- { color: green, min: 0, max: 35 }
- { color: orange, min: 36, max: 75 }
- { color: red, min: 76, max: 9999 }

- name: cluster_power_usage
query: round(upsHighPrecOutputCurrent * upsHighPrecOutputVoltage * 0.01, 0.1)
suffix: "w"
colors:
- { color: "green", min: 0, max: 400 }
- { color: "orange", min: 401, max: 750 }
- { color: "red", min: 751, max: 9999 }

- name: cluster_age_days
query: round((time() - min(kube_node_created{cluster="main"}) ) / 86400)
suffix: "d"
colors:
- { color: "green", min: 0, max: 180 }
- { color: "orange", min: 181, max: 360 }
- { color: "red", min: 361, max: 9999 }

- name: cluster_uptime_days
query: round(avg(node_time_seconds{cluster="main"} - node_boot_time_seconds{cluster="main"}) / 86400)
suffix: "d"
colors:
- { color: "green", min: 0, max: 180 }
- { color: "orange", min: 181, max: 360 }
- { color: "red", min: 361, max: 9999 }

- name: prometheus_active_alerts
query: count(ALERTS{alertstate="firing"})
colors:
- { color: "green", min: 0, max: 1 }
- { color: "orange", min: 2, max: 4 }
- { color: "red", min: 5, max: 9999 }
21 changes: 21 additions & 0 deletions kubernetes/talos-flux/apps/observability/kromgo/flux-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/kustomization-kustomize-v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: apps-kromgo
namespace: flux-system
spec:
interval: 10m
path: ./kubernetes/talos-flux/apps/observability/kromgo/app
prune: true
sourceRef:
kind: GitRepository
name: home-ops
targetNamespace: observability
commonMetadata:
labels:
app.kubernetes.io/name: kromgo
wait: true
dependsOn:
- name: apps-kube-prometheus-stack
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ resources:
- ./alertmanager-discord/flux-sync.yaml
- ./botkube/flux-sync.yaml
- ./grafana/flux-sync.yaml
- ./kromgo/flux-sync.yaml
- ./kube-prometheus-stack/flux-sync.yaml
- ./loki/flux-sync.yaml
- ./promtail/flux-sync.yaml
Expand Down

0 comments on commit f34f22b

Please sign in to comment.