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(capacitor): add capacitor helm release and kustomization #2696

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

tyriis
Copy link
Owner

@tyriis tyriis commented Mar 15, 2024

No description provided.

@tyriis-automation
Copy link
Contributor

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 3 0 0.01s
✅ REPOSITORY gitleaks yes no 2.05s
✅ YAML prettier 3 0 0.54s
✅ YAML yamllint 3 0 0.27s

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

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@tyriis-automation
Copy link
Contributor

--- kubernetes/talos-flux/apps Kustomization: flux-system/apps-sync Kustomization: flux-system/capacitor

+++ kubernetes/talos-flux/apps Kustomization: flux-system/apps-sync Kustomization: flux-system/capacitor

@@ -1,31 +0,0 @@

----
-apiVersion: kustomize.toolkit.fluxcd.io/v1
-kind: Kustomization
-metadata:
-  labels:
-    kustomize.toolkit.fluxcd.io/name: apps-sync
-    kustomize.toolkit.fluxcd.io/namespace: flux-system
-  name: capacitor
-  namespace: flux-system
-spec:
-  decryption:
-    provider: sops
-    secretRef:
-      name: sops-age
-  interval: 1h
-  path: ./
-  postBuild:
-    substituteFrom:
-    - kind: ConfigMap
-      name: cluster-settings
-    - kind: Secret
-      name: cluster-secrets
-  prune: true
-  retryInterval: 2m
-  sourceRef:
-    kind: OCIRepository
-    name: capacitor-manifests
-  targetNamespace: flux-system
-  timeout: 5m
-  wait: true
-
--- kubernetes/talos-flux/apps Kustomization: flux-system/apps-sync Kustomization: flux-system/apps-capacitor

+++ kubernetes/talos-flux/apps Kustomization: flux-system/apps-sync Kustomization: flux-system/apps-capacitor

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

+---
+apiVersion: kustomize.toolkit.fluxcd.io/v1
+kind: Kustomization
+metadata:
+  labels:
+    kustomize.toolkit.fluxcd.io/name: apps-sync
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: apps-capacitor
+  namespace: flux-system
+spec:
+  decryption:
+    provider: sops
+    secretRef:
+      name: sops-age
+  interval: 30m
+  path: ./kubernetes/talos-flux/apps/flux-system/capacitor/app
+  postBuild:
+    substituteFrom:
+    - kind: ConfigMap
+      name: cluster-settings
+    - kind: Secret
+      name: cluster-secrets
+  prune: true
+  sourceRef:
+    kind: GitRepository
+    name: home-ops
+  timeout: 3m
+  wait: true
+
--- kubernetes/talos-flux/apps/flux-system/capacitor/app Kustomization: flux-system/apps-capacitor ServiceAccount: flux-system/capacitor

+++ kubernetes/talos-flux/apps/flux-system/capacitor/app Kustomization: flux-system/apps-capacitor ServiceAccount: flux-system/capacitor

@@ -0,0 +1,12 @@

+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  labels:
+    app.kubernetes.io/instance: capacitor
+    app.kubernetes.io/name: capacitor
+    kustomize.toolkit.fluxcd.io/name: apps-capacitor
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: capacitor
+  namespace: flux-system
+
--- kubernetes/talos-flux/apps/flux-system/capacitor/app Kustomization: flux-system/apps-capacitor ClusterRole: flux-system/capacitor

+++ kubernetes/talos-flux/apps/flux-system/capacitor/app Kustomization: flux-system/apps-capacitor ClusterRole: flux-system/capacitor

@@ -0,0 +1,44 @@

+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+  labels:
+    app.kubernetes.io/instance: capacitor
+    app.kubernetes.io/name: capacitor
+    kustomize.toolkit.fluxcd.io/name: apps-capacitor
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: capacitor
+rules:
+- apiGroups:
+  - networking.k8s.io
+  - apps
+  - ''
+  resources:
+  - pods
+  - pods/log
+  - ingresses
+  - deployments
+  - services
+  - secrets
+  - events
+  - configmaps
+  verbs:
+  - get
+  - watch
+  - list
+- apiGroups:
+  - source.toolkit.fluxcd.io
+  - kustomize.toolkit.fluxcd.io
+  - helm.toolkit.fluxcd.io
+  resources:
+  - gitrepositories
+  - ocirepositories
+  - buckets
+  - kustomizations
+  - helmreleases
+  verbs:
+  - get
+  - watch
+  - list
+  - patch
+
--- kubernetes/talos-flux/apps/flux-system/capacitor/app Kustomization: flux-system/apps-capacitor ClusterRoleBinding: flux-system/capacitor

+++ kubernetes/talos-flux/apps/flux-system/capacitor/app Kustomization: flux-system/apps-capacitor ClusterRoleBinding: flux-system/capacitor

@@ -0,0 +1,19 @@

+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+  labels:
+    app.kubernetes.io/instance: capacitor
+    app.kubernetes.io/name: capacitor
+    kustomize.toolkit.fluxcd.io/name: apps-capacitor
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: capacitor
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: capacitor
+subjects:
+- kind: ServiceAccount
+  name: capacitor
+  namespace: flux-system
+
--- kubernetes/talos-flux/apps/flux-system/capacitor/app Kustomization: flux-system/apps-capacitor HelmRelease: flux-system/capacitor

+++ kubernetes/talos-flux/apps/flux-system/capacitor/app Kustomization: flux-system/apps-capacitor HelmRelease: flux-system/capacitor

@@ -0,0 +1,111 @@

+---
+apiVersion: helm.toolkit.fluxcd.io/v2beta2
+kind: HelmRelease
+metadata:
+  labels:
+    app.kubernetes.io/instance: capacitor
+    app.kubernetes.io/name: capacitor
+    kustomize.toolkit.fluxcd.io/name: apps-capacitor
+    kustomize.toolkit.fluxcd.io/namespace: flux-system
+  name: capacitor
+  namespace: flux-system
+spec:
+  chart:
+    spec:
+      chart: app-template
+      sourceRef:
+        kind: HelmRepository
+        name: bjw-s-charts
+        namespace: flux-system
+      version: 3.0.4
+  install:
+    createNamespace: true
+    remediation:
+      retries: 3
+  interval: 15m
+  upgrade:
+    remediation:
+      retries: 3
+  values:
+    controllers:
+      capacitor:
+        containers:
+          app:
+            env:
+              TZ: ${SETTING_TZ}
+            image:
+              repository: ghcr.io/gimlet-io/capacitor
+              tag: v0.3.2@sha256:e9961dd344271da18e9df9d931fd9087406fa98f354d2d28cc61deab9cd7f8f5
+            probes:
+              liveness:
+                custom: true
+                enabled: true
+                spec:
+                  failureThreshold: 3
+                  httpGet:
+                    path: /
+                    port: 9000
+                    scheme: HTTP
+                  initialDelaySeconds: 0
+                  periodSeconds: 10
+                  timeoutSeconds: 1
+              readiness:
+                custom: true
+                enabled: true
+                spec:
+                  failureThreshold: 3
+                  httpGet:
+                    path: /
+                    port: 9000
+                    scheme: HTTP
+                  initialDelaySeconds: 0
+                  periodSeconds: 10
+                  timeoutSeconds: 1
+              startup:
+                enabled: false
+            resources:
+              requests:
+                cpu: 200m
+                memory: 200Mi
+            securityContext:
+              allowPrivilegeEscalation: false
+              capabilities:
+                drop:
+                - ALL
+              readOnlyRootFilesystem: true
+        pod:
+          securityContext:
+            fsGroup: 999
+        replicas: 1
+    ingress:
+      app:
+        annotations:
+          cert-manager.io/cluster-issuer: letsencrypt-production
+          hajimari.io/enable: 'true'
+          hajimari.io/icon: simple-icons:flux
+          kubernetes.io/tls-acme: 'true'
+          nginx.ingress.kubernetes.io/force-ssl-redirect: 'true'
+          nginx.ingress.kubernetes.io/ssl-redirect: 'true'
+        className: nginx
+        enabled: true
+        hosts:
+        - host: '{{ .Release.Name }}.${SECRET_DOMAIN}'
+          paths:
+          - path: /
+            pathType: Prefix
+            service:
+              identifier: app
+              port: http
+        tls:
+        - hosts:
+          - '{{ .Release.Name }}.${SECRET_DOMAIN}'
+          secretName: '{{ .Release.Name }}-tls'
+    service:
+      app:
+        controller: capacitor
+        ports:
+          http:
+            enabled: true
+            port: 9000
+            protocol: HTTP
+

@tyriis-automation
Copy link
Contributor

--- HelmRelease: flux-system/capacitor Service: flux-system/capacitor

+++ HelmRelease: flux-system/capacitor Service: flux-system/capacitor

@@ -0,0 +1,22 @@

+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: capacitor
+  labels:
+    app.kubernetes.io/instance: capacitor
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: capacitor
+    app.kubernetes.io/service: capacitor
+spec:
+  type: ClusterIP
+  ports:
+  - port: 9000
+    targetPort: 9000
+    protocol: TCP
+    name: http
+  selector:
+    app.kubernetes.io/component: capacitor
+    app.kubernetes.io/instance: capacitor
+    app.kubernetes.io/name: capacitor
+
--- HelmRelease: flux-system/capacitor Deployment: flux-system/capacitor

+++ HelmRelease: flux-system/capacitor Deployment: flux-system/capacitor

@@ -0,0 +1,71 @@

+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: capacitor
+  labels:
+    app.kubernetes.io/component: capacitor
+    app.kubernetes.io/instance: capacitor
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: capacitor
+spec:
+  revisionHistoryLimit: 3
+  replicas: 1
+  strategy:
+    type: Recreate
+  selector:
+    matchLabels:
+      app.kubernetes.io/component: capacitor
+      app.kubernetes.io/name: capacitor
+      app.kubernetes.io/instance: capacitor
+  template:
+    metadata:
+      labels:
+        app.kubernetes.io/component: capacitor
+        app.kubernetes.io/instance: capacitor
+        app.kubernetes.io/name: capacitor
+    spec:
+      enableServiceLinks: false
+      serviceAccountName: default
+      automountServiceAccountToken: true
+      securityContext:
+        fsGroup: 999
+      hostIPC: false
+      hostNetwork: false
+      hostPID: false
+      dnsPolicy: ClusterFirst
+      containers:
+      - env:
+        - name: TZ
+          value: ${SETTING_TZ}
+        image: ghcr.io/gimlet-io/capacitor:v0.3.2@sha256:e9961dd344271da18e9df9d931fd9087406fa98f354d2d28cc61deab9cd7f8f5
+        livenessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /
+            port: 9000
+            scheme: HTTP
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          timeoutSeconds: 1
+        name: app
+        readinessProbe:
+          failureThreshold: 3
+          httpGet:
+            path: /
+            port: 9000
+            scheme: HTTP
+          initialDelaySeconds: 0
+          periodSeconds: 10
+          timeoutSeconds: 1
+        resources:
+          requests:
+            cpu: 200m
+            memory: 200Mi
+        securityContext:
+          allowPrivilegeEscalation: false
+          capabilities:
+            drop:
+            - ALL
+          readOnlyRootFilesystem: true
+
--- HelmRelease: flux-system/capacitor Ingress: flux-system/capacitor

+++ HelmRelease: flux-system/capacitor Ingress: flux-system/capacitor

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

+---
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: capacitor
+  labels:
+    app.kubernetes.io/instance: capacitor
+    app.kubernetes.io/managed-by: Helm
+    app.kubernetes.io/name: capacitor
+  annotations:
+    cert-manager.io/cluster-issuer: letsencrypt-production
+    hajimari.io/enable: 'true'
+    hajimari.io/icon: simple-icons:flux
+    kubernetes.io/tls-acme: 'true'
+    nginx.ingress.kubernetes.io/force-ssl-redirect: 'true'
+    nginx.ingress.kubernetes.io/ssl-redirect: 'true'
+spec:
+  ingressClassName: nginx
+  tls:
+  - hosts:
+    - capacitor.${SECRET_DOMAIN}
+    secretName: capacitor-tls
+  rules:
+  - host: capacitor.${SECRET_DOMAIN}
+    http:
+      paths:
+      - path: /
+        pathType: Prefix
+        backend:
+          service:
+            name: capacitor
+            port:
+              number: 9000
+

@tyriis tyriis merged commit b0e9f13 into main Mar 15, 2024
15 checks passed
@tyriis tyriis deleted the feature/capacitor branch March 15, 2024 23:24
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