diff --git a/k8s/apps/firefly-iii/data-importer.yaml b/k8s/apps/firefly-iii/data-importer.yaml new file mode 100644 index 0000000..c820461 --- /dev/null +++ b/k8s/apps/firefly-iii/data-importer.yaml @@ -0,0 +1,128 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: firefly-data-importer + labels: + app.kubernetes.io/name: firefly-data-importer + annotations: + reloader.stakater.com/auto: "true" +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app.kubernetes.io/name: firefly-data-importer + template: + metadata: + labels: + app.kubernetes.io/name: firefly-data-importer + spec: + nodeSelector: + kubernetes.io/hostname: ai.tail2fe2d.ts.net + tolerations: + - key: workload + operator: Equal + value: ai + effect: NoSchedule + containers: + - name: data-importer + image: fireflyiii/data-importer:version-2.3.4 + imagePullPolicy: IfNotPresent + env: + - name: FIREFLY_III_URL + value: http://firefly-iii + - name: VANITY_URL + value: http://ff.lan + - name: TRUSTED_PROXIES + value: "**" + - name: EXPECT_SECURE_URL + value: "false" + - name: VERIFY_TLS_SECURITY + value: "true" + - name: TZ + value: Europe/London + - name: APP_ENV + value: production + - name: APP_DEBUG + value: "false" + - name: LOG_LEVEL + value: notice + - name: ENABLE_BANKING_APP_ID + valueFrom: + secretKeyRef: + name: firefly-data-importer-secrets + key: ENABLE_BANKING_APP_ID + - name: ENABLE_BANKING_PRIVATE_KEY + valueFrom: + secretKeyRef: + name: firefly-data-importer-secrets + key: ENABLE_BANKING_PRIVATE_KEY + ports: + - name: http + containerPort: 8080 + protocol: TCP + readinessProbe: + tcpSocket: + port: http + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + tcpSocket: + port: http + initialDelaySeconds: 20 + periodSeconds: 30 + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + cpu: "1" + memory: 512Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + securityContext: + seccompProfile: + type: RuntimeDefault +--- +apiVersion: v1 +kind: Service +metadata: + name: firefly-data-importer + labels: + app.kubernetes.io/name: firefly-data-importer +spec: + type: ClusterIP + selector: + app.kubernetes.io/name: firefly-data-importer + ports: + - name: http + port: 80 + targetPort: http + protocol: TCP +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: firefly-data-importer + labels: + app.kubernetes.io/name: firefly-data-importer + firefly.hexor.cy/private-ai: "true" + annotations: + kubernetes.io/ingress.class: traefik-ai +spec: + rules: + - host: import.ff.lan + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: firefly-data-importer + port: + number: 80 + diff --git a/k8s/apps/firefly-iii/external-secrets.yaml b/k8s/apps/firefly-iii/external-secrets.yaml index ea0022e..c0df82a 100644 --- a/k8s/apps/firefly-iii/external-secrets.yaml +++ b/k8s/apps/firefly-iii/external-secrets.yaml @@ -46,4 +46,39 @@ spec: remoteRef: key: a1867c81-715c-47cd-978d-14ea5bcedea9 property: fields[2].value - +--- +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: firefly-data-importer-secrets +spec: + refreshInterval: 1h + target: + name: firefly-data-importer-secrets + creationPolicy: Owner + deletionPolicy: Delete + template: + type: Opaque + data: + ENABLE_BANKING_APP_ID: |- + {{ .app_id }} + ENABLE_BANKING_PRIVATE_KEY: |- + {{ .private_key }} + data: + # fields[0]: application UUID; fields[1]: complete PEM private key. + - secretKey: app_id + sourceRef: + storeRef: + name: vaultwarden-login + kind: ClusterSecretStore + remoteRef: + key: REPLACE_WITH_ENABLE_BANKING_BITWARDEN_ITEM_ID + property: fields[0].value + - secretKey: private_key + sourceRef: + storeRef: + name: vaultwarden-login + kind: ClusterSecretStore + remoteRef: + key: REPLACE_WITH_ENABLE_BANKING_BITWARDEN_ITEM_ID + property: fields[1].value diff --git a/k8s/apps/firefly-iii/kustomization.yaml b/k8s/apps/firefly-iii/kustomization.yaml index a1411d8..d02ba29 100644 --- a/k8s/apps/firefly-iii/kustomization.yaml +++ b/k8s/apps/firefly-iii/kustomization.yaml @@ -3,6 +3,7 @@ kind: Kustomization resources: - app.yaml + - data-importer.yaml - external-secrets.yaml - postgres.yaml - storage.yaml diff --git a/k8s/apps/firefly-iii/network-policy.yaml b/k8s/apps/firefly-iii/network-policy.yaml index bda45f0..3082af4 100644 --- a/k8s/apps/firefly-iii/network-policy.yaml +++ b/k8s/apps/firefly-iii/network-policy.yaml @@ -61,3 +61,24 @@ spec: ports: - protocol: TCP port: 8000 +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: firefly-data-importer-ingress +spec: + podSelector: + matchLabels: + app.kubernetes.io/name: firefly-data-importer + policyTypes: + - Ingress + ingress: + # traefik-ai uses hostNetwork and is therefore seen as node traffic. + - from: + - ipBlock: + cidr: 192.168.1.117/32 + - ipBlock: + cidr: 100.77.155.120/32 + ports: + - protocol: TCP + port: 8080