Setup linting

This commit is contained in:
2026-01-07 23:41:08 +01:00
commit 87ea6d4ba1
39 changed files with 626 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

23
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--allow-multiple-documents] # Required for K8s multi-resource files
- id: check-added-large-files
- repo: https://github.com/adrienverge/yamllint
rev: v1.37.1
hooks:
- id: yamllint
args: [-c, .yamllint.yaml]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types: [yaml]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.0
hooks:
- id: gitleaks

6
.prettierrc Normal file
View File

@@ -0,0 +1,6 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false
}

12
.yamllint.yaml Normal file
View File

@@ -0,0 +1,12 @@
extends: default
rules:
indentation:
spaces: 2
indent-sequences: true
line-length:
max: 120
allow-non-breakable-words: true
truthy:
allowed-values: ["true", "false"] # Fixes issues with 'yes/no' in K8s
document-start: disable # Kubernetes YAMLs often omit '---'

View File

@@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitea
namespace: gitea
spec:
replicas: 1
selector:
matchLabels:
app: gitea
template:
metadata:
labels:
app: gitea
spec:
containers:
- name: gitea
image: gitea/gitea:latest
imagePullPolicy: Always
ports:
- name: gitea-http
containerPort: 3000
- name: gitea-ssh
containerPort: 22
volumeMounts:
- name: gitea-data
mountPath: /data
volumes:
- name: gitea-data
persistentVolumeClaim:
claimName: gitea-pvc

View File

@@ -0,0 +1,29 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: gitea-tls
namespace: gitea
spec:
secretName: gitea-tls
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
dnsNames:
- gitea.frankoslaw.top
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: gitea-tls-ingress
namespace: gitea
spec:
entryPoints:
- websecure
routes:
- match: Host(`gitea.frankoslaw.top`)
kind: Rule
services:
- name: gitea
port: gitea-http
tls:
secretName: gitea-tls

View File

@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: gitea
resources:
- namespace.yaml
- pvc.yaml
- deployment.yaml
- service.yaml
- ingress.yaml

View File

@@ -0,0 +1,4 @@
kind: Namespace
apiVersion: v1
metadata:
name: gitea

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitea-pvc
namespace: gitea
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 5Gi

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: gitea
namespace: gitea
spec:
selector:
app: gitea
ports:
- name: gitea-http
port: 3000
targetPort: 3000
- name: gitea-ssh
port: 22
targetPort: 22

View File

@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- whoami
- nginx-test
- gitea
- uptime-kuma

View File

@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: nginx-test
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80

View File

@@ -0,0 +1,30 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: nginx-test-tls
namespace: nginx-test
spec:
commonName: nginx-test.frankoslaw.top
secretName: nginx-test-tls
issuerRef:
name: letsencrypt-staging
kind: ClusterIssuer
dnsNames:
- nginx-test.frankoslaw.top
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: nginx-tls-ingress
namespace: nginx-test
spec:
entryPoints:
- websecure
routes:
- match: Host(`nginx-test.frankoslaw.top`)
kind: Rule
services:
- name: nginx-service
port: http
tls:
secretName: nginx-test-tls

View File

@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: nginx-test
resources:
- namespace.yaml
- deployment.yaml
- service.yaml
- ingress.yaml

View File

@@ -0,0 +1,4 @@
kind: Namespace
apiVersion: v1
metadata:
name: nginx-test

View File

@@ -0,0 +1,13 @@
kind: Service
apiVersion: v1
metadata:
name: nginx-service
namespace: nginx-test
spec:
selector:
app: nginx
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80

View File

@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: uptime-kuma
namespace: kuma
spec:
replicas: 1
serviceName: uptime-kuma-service
selector:
matchLabels:
app: uptime-kuma
template:
metadata:
labels:
app: uptime-kuma
spec:
containers:
- name: uptime-kuma
image: louislam/uptime-kuma:1.23.7
env:
- name: UPTIME_KUMA_PORT
value: "3001"
- name: PORT
value: "3001"
ports:
- name: uptime-kuma
containerPort: 3001
protocol: TCP
volumeMounts:
- name: kuma-data
mountPath: /app/data
volumes:
- name: kuma-data
persistentVolumeClaim:
claimName: uptime-kuma-pvc

View File

@@ -0,0 +1,30 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: uptime-kuma-tls
namespace: kuma
spec:
secretName: uptime-kuma-tls
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
dnsNames:
- uptime.frankoslaw.top
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: uptime-kuma-tls-ingress
namespace: kuma
spec:
entryPoints:
- web
- websecure
routes:
- match: Host(`uptime.frankoslaw.top`)
kind: Rule
services:
- name: uptime-kuma-service
port: uptime-kuma
tls:
secretName: uptime-kuma-tls

View File

@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kuma
resources:
- namespace.yaml
- pvc.yaml
- deployment.yaml
- service.yaml
- ingress.yaml

View File

@@ -0,0 +1,4 @@
kind: Namespace
apiVersion: v1
metadata:
name: kuma

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: uptime-kuma-pvc
namespace: kuma
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 1Gi

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: uptime-kuma-service
namespace: kuma
spec:
selector:
app: uptime-kuma
ports:
- name: uptime-kuma
port: 3001

View File

@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami
namespace: whoami
spec:
selector:
matchLabels:
app: whoami
replicas: 1
template:
metadata:
labels:
app: whoami
spec:
containers:
- name: whoami
image: traefik/whoami:v1.9.0
ports:
- containerPort: 80

View File

@@ -0,0 +1,29 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: whoami-tls
namespace: whoami
spec:
secretName: whoami-tls
issuerRef:
name: letsencrypt-staging
kind: ClusterIssuer
dnsNames:
- whoami.frankoslaw.top
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: whoami-tls-ingress
namespace: whoami
spec:
entryPoints:
- websecure
routes:
- match: Host(`whoami.frankoslaw.top`)
kind: Rule
services:
- name: whoami
port: 5678
tls:
secretName: whoami-tls

View File

@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: whoami
resources:
- namespace.yaml
- deployment.yaml
- service.yaml
- ingress.yaml

View File

@@ -0,0 +1,4 @@
kind: Namespace
apiVersion: v1
metadata:
name: whoami

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: whoami
namespace: whoami
spec:
type: ClusterIP
ports:
- port: 5678
targetPort: 80
selector:
app: whoami

View File

@@ -0,0 +1,41 @@
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: selfsigned
namespace: cert-manager
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-staging
namespace: cert-manager
spec:
acme:
server: https://acme-staging-v02.api.letsencrypt.org/directory
email: franopusz2006@gmail.com
privateKeySecretRef:
name: letsencrypt-staging
solvers:
- selector: {}
http01:
ingress:
class: traefik
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
namespace: cert-manager
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: franopusz2006@gmail.com
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- selector: {}
http01:
ingress:
class: traefik

View File

@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: cert-manager
resources:
- https://github.com/cert-manager/cert-manager/releases/download/v1.19.2/cert-manager.yaml
- cert-issuer.yaml

View File

@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cert-manager
- traefik
- longhorn-system

View File

@@ -0,0 +1,29 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: longhorn-tls
namespace: longhorn-system
spec:
secretName: longhorn-tls
issuerRef:
name: letsencrypt-staging # TODO: change to letsencrypt-prod after timeout
kind: ClusterIssuer
dnsNames:
- longhorn.frankoslaw.top
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: longhorn-tls-ingress
namespace: longhorn-system
spec:
entryPoints:
- websecure
routes:
- match: Host(`longhorn.frankoslaw.top`)
kind: Rule
services:
- name: longhorn-frontend
port: 80
tls:
secretName: longhorn-tls

View File

@@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: longhorn-system
resources:
- https://raw.githubusercontent.com/longhorn/longhorn/v1.10.1/deploy/longhorn.yaml
- ingress.yaml
patches:
- path: namespace.yaml
configMapGenerator:
- name: longhorn-storageclass
behavior: merge
namespace: longhorn-system
files:
- storageclass.yaml

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: longhorn-system

View File

@@ -0,0 +1,15 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: longhorn
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: driver.longhorn.io
allowVolumeExpansion: true
reclaimPolicy: Delete
volumeBindingMode: Immediate
parameters:
numberOfReplicas: "1"
staleReplicaTimeout: "2880"
dataLocality: "best-effort"
fsType: "ext4"

View File

@@ -0,0 +1,27 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: traefik-tls
spec:
secretName: traefik-tls
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
dnsNames:
- traefik.frankoslaw.top
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: dashboard
spec:
entryPoints:
- websecure
routes:
- match: Host(`traefik.frankoslaw.top`)
kind: Rule
services:
- name: api@internal
kind: TraefikService
tls:
secretName: traefik-tls

View File

@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- traefik-config.yaml
- traefik-redirect.yaml
- traefik-dashboard.yaml
- ingress.yaml

View File

@@ -0,0 +1,44 @@
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
image:
name: traefik
ports:
web:
port: 80
expose:
default: true
exposedPort: 80
protocol: TCP
redirections:
entryPoint:
to: websecure
scheme: https
permanent: true
websecure:
port: 443
expose:
default: true
exposedPort: 443
protocol: TCP
tls:
enabled: true
ingressRoute:
dashboard:
enabled: false
persistence:
enabled: true
path: /certs
size: 128Mi
securityContext:
capabilities:
drop: [ALL]
add: [NET_BIND_SERVICE]
readOnlyRootFilesystem: true
runAsGroup: 0
runAsNonRoot: false
runAsUser: 0

View File

@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: traefik-dashboard
namespace: kube-system
labels:
app.kubernetes.io/instance: traefik
app.kubernetes.io/name: traefik-dashboard
spec:
type: ClusterIP
ports:
- name: traefik
port: 9000
targetPort: traefik
protocol: TCP
selector:
app.kubernetes.io/instance: traefik-kube-system
app.kubernetes.io/name: traefik

View File

@@ -0,0 +1,8 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: redirect-https
spec:
redirectScheme:
scheme: https
permanent: true