Skip to content

Commit e211835

Browse files
adapt networkpolicy and restic
1 parent 5aec93f commit e211835

File tree

10 files changed

+143
-21
lines changed

10 files changed

+143
-21
lines changed

apps/miniflux/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# miniflux
2+
3+
## secrets
4+
Secret referenced from miniflux is named `miniflux`
5+
6+
### env vars
7+
| Name | Description | Example | Required |
8+
|----------------|--------------------------|--------------------------------------------------------|----------|
9+
| DATABASE_URL | Postgres DSN | postgres://miniflux:secret@db/miniflux?sslmode=disable | yes |
10+
| ADMIN_USERNAME | Admin username to create | miniflux | no |
11+
| ADMIN_PASSWORD | Admin password | secret123 | no |
12+
13+
14+
## configmaps
15+
Configmap that is referenced by default is named `miniflux` and is created by kustomize configMapGenerator.
16+
17+
| Name | Description | Example | Required |
18+
|----------------|-------------------|---------|----------|
19+
| RUN_MIGRATIONS | Run db migrations | 1 | no |
20+
| CREATE_ADMIN | Create admin user | 1 | no |
21+
22+
23+
## external links
24+
- https://miniflux.app/docs/docker.html

apps/miniflux/components/postgres-pvc/postgres-pvc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
apiVersion: v1
33
kind: PersistentVolumeClaim
44
metadata:
5-
name: mealie-postgres
5+
name: "miniflux-postgres"
66
spec:
77
accessModes:
8-
- ReadWriteOnce
8+
- "ReadWriteOnce"
99
resources:
1010
requests:
11-
storage: 1Gi
11+
storage: "512Mi"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# miniflux-postgres
2+
3+
## secrets
4+
5+
Secret references is named `miniflux-postgres`
6+
7+
### env variables
8+
9+
| Name | Description | Example | Required |
10+
|-------------------|------------------------------------|-----------|----------|
11+
| POSTGRES_USER | User to create to access Postgres | miniflux | no |
12+
| POSTGRES_PASSWORD | Password for user to be created | secret123 | yes |
13+
| POSTGRES_DB | Name of the database to be created | miniflux | no |
14+
15+
### configmap
16+
17+
| Name | Description | Example | Required |
18+
|-------------------|------------------------------------|-----------|----------|
19+
| POSTGRES_DB | Name of the database to be created | miniflux | no |

apps/miniflux/components/postgres/kustomization.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,16 @@ kind: Component
44
resources:
55
- postgres-deployment.yaml
66
- postgres-service.yaml
7+
- networkpolicy.yaml
8+
patches:
9+
- target:
10+
kind: "NetworkPolicy"
11+
name: "miniflux"
12+
patch: |-
13+
- op: "add"
14+
path: "/spec/egress/-"
15+
value:
16+
to:
17+
- podSelector:
18+
matchLabels:
19+
app.kubernetes.io/name: postgres
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
apiVersion: networking.k8s.io/v1
3+
kind: NetworkPolicy
4+
metadata:
5+
name: postgres
6+
spec:
7+
podSelector:
8+
matchLabels:
9+
app: postgres
10+
policyTypes:
11+
- Ingress
12+
- Egress
13+
ingress:
14+
- ports:
15+
- protocol: TCP
16+
port: postgres
17+
from:
18+
- podSelector:
19+
matchLabels:
20+
app.kubernetes.io/name: miniflux

apps/miniflux/components/postgres/postgres-deployment.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
type: RuntimeDefault
3939
containers:
4040
- name: postgres
41-
image: postgres:16.7
41+
image: postgres:17.4
4242
securityContext:
4343
runAsUser: 999
4444
runAsGroup: 999
@@ -69,7 +69,6 @@ spec:
6969
resources:
7070
limits:
7171
memory: "1Gi"
72-
cpu: "500m"
7372
requests:
7473
memory: "256Mi"
7574
cpu: "50m"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1alpha1
3+
kind: Component
4+
resources:
5+
- ../../../../infra/restic-postgres
6+
patches:
7+
- target:
8+
kind: "CronJob"
9+
patch: |
10+
- op: "replace"
11+
path: "/spec/jobTemplate/spec/template/spec/containers/0/envFrom"
12+
value:
13+
- configMapRef:
14+
name: "miniflux-restic-postgres"
15+
- secretRef:
16+
name: "miniflux-restic-postgres"
17+
- op: "replace"
18+
path: "/spec/jobTemplate/spec/template/metadata/labels/restic~1name"
19+
value: "miniflux"
20+
- target:
21+
kind: "CronJob"
22+
name: "restic-postgres-backup"
23+
patch: |
24+
- op: "replace"
25+
path: "/spec/schedule"
26+
value: "5 6 * * *"
27+
- op: "replace"
28+
path: "/spec/jobTemplate/spec/template/spec/containers/0/env/0/valueFrom/secretKeyRef/name"
29+
value: "miniflux-postgres"
30+
- op: "add"
31+
path: "/spec/jobTemplate/spec/template/spec/containers/0/envFrom/-"
32+
value:
33+
secretRef:
34+
name: "miniflux-postgres"
35+
- target:
36+
kind: "CronJob"
37+
name: "restic-postgres-prune"
38+
patch: |-
39+
- op: "replace"
40+
path: "/spec/schedule"
41+
value: "5 22 * * *"
42+
- target:
43+
kind: "NetworkPolicy"
44+
name: "postgres"
45+
patch: |-
46+
- op: "add"
47+
path: "/spec/ingress/-"
48+
value:
49+
ports:
50+
- protocol: "TCP"
51+
port: "postgres"
52+
from:
53+
- podSelector:
54+
matchLabels:
55+
app.kubernetes.io/name: "restic"

apps/miniflux/deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ kind: Deployment
44
metadata:
55
name: miniflux
66
labels:
7+
name: miniflux
78
app.kubernetes.io/name: miniflux
89
app.kubernetes.io/instance: miniflux-prod
910
app.kubernetes.io/component: server

apps/miniflux/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ resources:
77
- networkpolicy.yaml
88
configMapGenerator:
99
- name: miniflux
10-
files:
11-
- miniflux.properties
10+
literals:
11+
- RUN_MIGRATIONS=1

apps/miniflux/networkpolicy.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ kind: NetworkPolicy
44
metadata:
55
name: miniflux
66
spec:
7-
podSelector: {}
7+
podSelector:
8+
matchLabels:
9+
app: miniflux
810
policyTypes:
911
- Ingress
1012
- Egress
@@ -22,13 +24,9 @@ spec:
2224
egress:
2325
- to:
2426
- ipBlock:
25-
cidr: 192.168.0.0/16
26-
ports:
27-
- port: 5432
28-
protocol: TCP
29-
- to:
27+
cidr: 0.0.0.0/0
3028
- ipBlock:
31-
cidr: 192.168.0.0/16
29+
cidr: ::/0
3230
ports:
3331
- port: 443
3432
protocol: TCP
@@ -49,10 +47,3 @@ spec:
4947
podSelector:
5048
matchLabels:
5149
k8s-app: kube-dns
52-
- to:
53-
- namespaceSelector:
54-
matchLabels:
55-
name: keycloak
56-
podSelector:
57-
matchLabels:
58-
app.kubernetes.io/name: keycloak

0 commit comments

Comments
 (0)