Skip to content

Commit

Permalink
feat(components): add monitoring to the unifi controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonemms committed Dec 10, 2024
1 parent 510b613 commit b94a1d2
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 0 deletions.
Empty file.
36 changes: 36 additions & 0 deletions registry/components/unifi/example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"monitoring.coreos.com/v1","kind":"PodMonitor","metadata":{"annotations":{},"labels":{"app":"reloader-reloader","app.kubernetes.io/managed-by":"Helm","argocd.argoproj.io/instance":"reloader","chart":"reloader-1.1.0","heritage":"Helm","prometheus":"enabled","release":"reloader"},"name":"reloader-reloader","namespace":"reloader"},"spec":{"jobLabel":"reloader-reloader","namespaceSelector":{"matchNames":["reloader"]},"podMetricsEndpoints":[{"honorLabels":true,"path":"/metrics","port":"http"}],"selector":{"matchLabels":{"app":"reloader-reloader","app.kubernetes.io/managed-by":"Helm","chart":"reloader-1.1.0","heritage":"Helm","release":"reloader"}}}}
creationTimestamp: "2024-12-10T17:39:20Z"
generation: 1
labels:
app: reloader-reloader
app.kubernetes.io/managed-by: Helm
argocd.argoproj.io/instance: reloader
chart: reloader-1.1.0
heritage: Helm
prometheus: enabled
release: reloader
name: reloader-reloader
namespace: reloader
resourceVersion: "778576"
uid: 3b3f587c-dd15-4771-b2f0-1bb945ad2490
spec:
jobLabel: reloader-reloader
namespaceSelector:
matchNames:
- reloader
podMetricsEndpoints:
- honorLabels: true
path: /metrics
port: http
selector:
matchLabels:
app: reloader-reloader
app.kubernetes.io/managed-by: Helm
chart: reloader-1.1.0
heritage: Helm
release: reloader
4 changes: 4 additions & 0 deletions registry/components/unifi/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- application.yaml
- dashboard.yaml
- monitoring.yaml
- namespace.yaml
- poller.yaml
- secret.yaml
18 changes: 18 additions & 0 deletions registry/components/unifi/monitoring.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: unifi
namespace: unifi
labels:
prometheus: enabled
annotations:
argocd.argoproj.io/sync-wave: "10"
spec:
jobLabel: unifi-poller
selector:
matchLabels:
app.kubernetes.io/instance: unpoller │
app.kubernetes.io/name: unifi-poller
podMetricsEndpoints:
- port: metrics
path: /metrics
2 changes: 2 additions & 0 deletions registry/components/unifi/namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ apiVersion: v1
kind: Namespace
metadata:
name: unifi
labels:
prometheus: enabled
annotations:
argocd.argoproj.io/sync-wave: "-1"
52 changes: 52 additions & 0 deletions registry/components/unifi/poller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: unpoller
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "10"
spec:
project: default
source:
chart: unifi-poller
repoURL: https://k8s-at-home.com/charts/
targetRevision: 11.1.2
helm:
valuesObject:
image:
repository: ghcr.io/unpoller/unpoller
tag: v2.11.2
env:
- name: TZ
value: UTC
- name: UP_UNIFI_DEFAULT_URL
value: https://unifi:8443
- name: UP_UNIFI_DEFAULT_USER
valueFrom:
secretKeyRef:
name: unifi-poller
key: username
- name: UP_UNIFI_DEFAULT_PASS
valueFrom:
secretKeyRef:
name: unifi-poller
key: password
- name: UP_UNIFI_DEFAULT_VERIFY_SSL
value: false
- name: UP_PROMETHEUS_DISABLE
value: false
- name: UP_INFLUXDB_DISABLE
value: "true"
- name: UP_PROMETHEUS_REPORT_ERRORS
value: "true"
- name: UP_PROMETHEUS_NAMESPACE
value: unifi
destination:
server: https://kubernetes.default.svc
namespace: unifi
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
21 changes: 21 additions & 0 deletions registry/components/unifi/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: unifi-poller
namespace: unifi
annotations:
argocd.argoproj.io/sync-wave: "10"
spec:
refreshInterval: 10s
secretStoreRef:
kind: ClusterSecretStore
name: infisical
target:
name: unifi-poller
data:
- secretKey: username
remoteRef:
key: UNIFI_CONTROLLER_READONLY_USERNAME
- secretKey: password
remoteRef:
key: UNIFI_CONTROLLER_READONLY_PASSWORD

0 comments on commit b94a1d2

Please sign in to comment.