Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds kromgo configurations to the cluster #1338

Merged
merged 2 commits into from
Aug 29, 2024
Merged

feat: adds kromgo configurations to the cluster #1338

merged 2 commits into from
Aug 29, 2024

Conversation

axeII
Copy link
Owner

@axeII axeII commented Aug 29, 2024

Description of the change

Adds kromgo project.
Benefits or applicable issues

Able to have metadata on the readme page.

@bot-akira
Copy link
Contributor

bot-akira bot commented Aug 29, 2024

--- kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/kromgo

+++ kubernetes/apps Kustomization: flux-system/cluster-apps Kustomization: flux-system/kromgo

@@ -0,0 +1,34 @@

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: cluster-apps
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: kromgo
+  namespace: flux-system
+spec:
+  commonMetadata:
+    labels:
+      app.kubernetes.io/name: kromgo
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  interval: 30m
+  path: ./kubernetes/apps/monitoring/kromgo/app
+  postBuild:
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-settings
+    - kind: Secret
+      name: cluster-secrets
+  prune: true
+  retryInterval: 1m
+  sourceRef:
+    kind: GitRepository
+    name: home-kubernetes
+  targetNamespace: monitoring
+  timeout: 5m
+  wait: true
+
--- kubernetes/apps/monitoring/kromgo/app Kustomization: flux-system/kromgo HelmRelease: monitoring/kromgo

+++ kubernetes/apps/monitoring/kromgo/app Kustomization: flux-system/kromgo HelmRelease: monitoring/kromgo

@@ -0,0 +1,138 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/name: kromgo
+    kustomize.toolkit.fluxcd.io/name: kromgo
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: kromgo
+  namespace: monitoring
+spec:
+  chart:
+    spec:
+      chart: app-template
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s-charts
+        namespace: flux-system
+      version: 3.4.0
+  install:
+    remediation:
+      retries: 3
+  interval: 30m
+  upgrade:
+    cleanupOnFail: true
+    remediation:
+      retries: 3
+      strategy: rollback
+  values:
+    controllers:
+      kromgo:
+        annotations:
+          reloader.stakater.com/auto: 'true'
+        containers:
+          app:
+            env:
+              HEALTH_HOST: 0.0.0.0
+              HEALTH_PORT: 8888
+              PROMETHEUS_URL: http://thanos-query-frontend.monitoring.svc.cluster.local:10902
+              SERVER_HOST: 0.0.0.0
+              SERVER_PORT: 8080
+            image:
+              repository: ghcr.io/kashalls/kromgo
+              tag: v0.4.1@sha256:237e6ac3f3bc791343e1ee84122ce9b97abf7eed86cd522d8bf4cba10a041e9f
+            probes:
+              liveness:
+                custom: true
+                enabled: true
+                spec:
+                  failureThreshold: 3
+                  httpGet:
+                    path: /-/ready
+                    port: 8888
+                  initialDelaySeconds: 0
+                  periodSeconds: 10
+                  timeoutSeconds: 1
+              readiness:
+                custom: true
+                enabled: true
+                spec:
+                  failureThreshold: 3
+                  httpGet:
+                    path: /-/ready
+                    port: 8888
+                  initialDelaySeconds: 0
+                  periodSeconds: 10
+                  timeoutSeconds: 1
+            resources:
+              limits:
+                memory: 64Mi
+              requests:
+                cpu: 10m
+            securityContext:
+              allowPrivilegeEscalation: false
+              capabilities:
+                drop:
+                - ALL
+              readOnlyRootFilesystem: true
+        replicas: 2
+        strategy: RollingUpdate
+    defaultPodOptions:
+      dnsConfig:
+        options:
+        - name: ndots
+          value: '1'
+      securityContext:
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+      topologySpreadConstraints:
+      - labelSelector:
+          matchLabels:
+            app.kubernetes.io/name: kromgo
+        maxSkew: 1
+        topologyKey: kubernetes.io/hostname
+        whenUnsatisfiable: DoNotSchedule
+    ingress:
+      app:
+        annotations:
+          gatus.io/status-code: '404'
+          hajimari.io/enable: 'false'
+        className: external
+        hosts:
+        - host: '{{ .Release.Name }}...PLACEHOLDER..'
+          paths:
+          - path: /
+            service:
+              identifier: app
+              port: http
+        tls:
+        - hosts:
+          - '{{ .Release.Name }}...PLACEHOLDER..'
+    persistence:
+      config:
+        globalMounts:
+        - path: /kromgo/config.yaml
+          readOnly: true
+          subPath: config.yaml
+        name: kromgo-configmap
+        type: configMap
+    service:
+      app:
+        controller: kromgo
+        ports:
+          health:
+            port: 8888
+          http:
+            port: 8080
+    serviceMonitor:
+      app:
+        endpoints:
+        - interval: 1m
+          path: /metrics
+          port: health
+          scheme: http
+          scrapeTimeout: 10s
+        serviceName: kromgo
+
--- kubernetes/apps/monitoring/kromgo/app Kustomization: flux-system/kromgo ConfigMap: monitoring/kromgo-configmap

+++ kubernetes/apps/monitoring/kromgo/app Kustomization: flux-system/kromgo ConfigMap: monitoring/kromgo-configmap

@@ -0,0 +1,72 @@

+---
+apiVersion: v1
+data:
+  config.yaml: |
+    ---
+    metrics:
+      - name: cluster_node_count
+        query: count(count by (node) (kube_node_status_condition{condition="Ready"}))
+        colors:
+          - { color: green, min: 0, max: 9999 }
+
+      - name: cluster_pod_count
+        query: sum(kube_pod_status_phase{phase="Running"})
+        colors:
+          - { color: green, min: 0, max: 9999 }
+
+      - name: cluster_cpu_usage
+        query: round(avg(cluster:node_cpu:ratio_rate5m) * 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 - node_memory_MemAvailable_bytes) / sum(node_memory_MemTotal_bytes) * 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(upsHighPrecOutputLoad, 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)) / 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 - node_boot_time_seconds) / 86400)
+        suffix: d
+        colors:
+          - { color: green, min: 0, max: 180 }
+          - { color: orange, min: 181, max: 360 }
+          - { color: red, min: 361, max: 9999 }
+
+      - name: kubernetes_version
+        query: kubernetes_build_info{service="kubernetes"}
+        label: git_version
+
+      # - name: talos_version
+      #   query: node_os_info{name="Talos"}
+      #   label: version_id
+kind: ConfigMap
+metadata:
+  labels:
+    app.kubernetes.io/name: kromgo
+    kustomize.toolkit.fluxcd.io/name: kromgo
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: kromgo-configmap
+  namespace: monitoring
+

@bot-akira
Copy link
Contributor

bot-akira bot commented Aug 29, 2024

--- HelmRelease: monitoring/kromgo Service: monitoring/kromgo

+++ HelmRelease: monitoring/kromgo Service: monitoring/kromgo

@@ -0,0 +1,26 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: kromgo
+  labels:
+    app.kubernetes.io/instance: kromgo
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: kromgo
+    app.kubernetes.io/service: kromgo
+spec:
+  type: ClusterIP
+  ports:
+  - port: 8888
+    targetPort: 8888
+    protocol: TCP
+    name: health
+  - port: 8080
+    targetPort: 8080
+    protocol: TCP
+    name: http
+  selector:
+    app.kubernetes.io/component: kromgo
+    app.kubernetes.io/instance: kromgo
+    app.kubernetes.io/name: kromgo
+
--- HelmRelease: monitoring/kromgo Deployment: monitoring/kromgo

+++ HelmRelease: monitoring/kromgo Deployment: monitoring/kromgo

@@ -0,0 +1,102 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: kromgo
+  labels:
+    app.kubernetes.io/component: kromgo
+    app.kubernetes.io/instance: kromgo
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: kromgo
+  annotations:
+    reloader.stakater.com/auto: 'true'
+spec:
+  revisionHistoryLimit: 3
+  replicas: 2
+  strategy:
+    type: RollingUpdate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: kromgo
+      app.kubernetes.io/name: kromgo
+      app.kubernetes.io/instance: kromgo
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: kromgo
+        app.kubernetes.io/instance: kromgo
+        app.kubernetes.io/name: kromgo
+    spec:
+      enableServiceLinks: false
+      serviceAccountName: default
+      automountServiceAccountToken: true
+      securityContext:
+        runAsGroup: 1000
+        runAsNonRoot: true
+        runAsUser: 1000
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      dnsConfig:
+        options:
+        - name: ndots
+          value: '1'
+      topologySpreadConstraints:
+      - labelSelector:
+          matchLabels:
+            app.kubernetes.io/name: kromgo
+        maxSkew: 1
+        topologyKey: kubernetes.io/hostname
+        whenUnsatisfiable: DoNotSchedule
+      containers:
+      - env:
+        - name: HEALTH_HOST
+          value: 0.0.0.0
+        - name: HEALTH_PORT
+          value: '8888'
+        - name: PROMETHEUS_URL
+          value: http://thanos-query-frontend.monitoring.svc.cluster.local:10902
+        - name: SERVER_HOST
+          value: 0.0.0.0
+        - name: SERVER_PORT
+          value: '8080'
+        image: ghcr.io/kashalls/kromgo:v0.4.1@sha256:237e6ac3f3bc791343e1ee84122ce9b97abf7eed86cd522d8bf4cba10a041e9f
+        livenessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /-/ready
+            port: 8888
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          timeoutSeconds: 1
+        name: app
+        readinessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /-/ready
+            port: 8888
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          timeoutSeconds: 1
+        resources:
+          limits:
+            memory: 64Mi
+          requests:
+            cpu: 10m
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+        volumeMounts:
+        - mountPath: /kromgo/config.yaml
+          name: config
+          readOnly: true
+          subPath: config.yaml
+      volumes:
+      - configMap:
+          name: kromgo-configmap
+        name: config
+
--- HelmRelease: monitoring/kromgo Ingress: monitoring/kromgo

+++ HelmRelease: monitoring/kromgo Ingress: monitoring/kromgo

@@ -0,0 +1,29 @@

+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: kromgo
+  labels:
+    app.kubernetes.io/instance: kromgo
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: kromgo
+  annotations:
+    gatus.io/status-code: '404'
+    hajimari.io/enable: 'false'
+spec:
+  ingressClassName: external
+  tls:
+  - hosts:
+    - kromgo...PLACEHOLDER..
+  rules:
+  - host: kromgo...PLACEHOLDER..
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: kromgo
+            port:
+              number: 8080
+
--- HelmRelease: monitoring/kromgo ServiceMonitor: monitoring/kromgo

+++ HelmRelease: monitoring/kromgo ServiceMonitor: monitoring/kromgo

@@ -0,0 +1,26 @@

+---
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  name: kromgo
+  labels:
+    app.kubernetes.io/instance: kromgo
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: kromgo
+spec:
+  jobLabel: kromgo
+  namespaceSelector:
+    matchNames:
+    - monitoring
+  selector:
+    matchLabels:
+      app.kubernetes.io/service: kromgo
+      app.kubernetes.io/name: kromgo
+      app.kubernetes.io/instance: kromgo
+  endpoints:
+  - interval: 1m
+    path: /metrics
+    port: health
+    scheme: http
+    scrapeTimeout: 10s
+

@axeII
Copy link
Owner Author

axeII commented Aug 29, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@axeII axeII merged commit 6aaeda7 into main Aug 29, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant