removed legacy

This commit is contained in:
Ariel Sosnovsky committed 2023-04-18 11:33:12 -04:00
1 parent a4e1497f3b
commit 1dadbefa30
75 files changed
-1865

No files matched your search

-34
View File
@@ -1,34 +0,0 @@
#!/bin/bash
set -e
full_path=${1}
deployment=${2:-dev}
app=$(basename $full_path)
location=$(dirname $full_path)
tmp_path=".tmp/$location/$deployment-$app.yaml"
argocd_values_path=$(realpath k8s/argocd/values.yaml)
argocd_values_deployment_path=$(realpath k8s/argocd/values-$deployment.yaml)
echo "> writing $location/$app to $tmp_path"
echo "> using argo values of $argocd_values_path"
cat $argocd_values_path | yq
mkdir -p $(dirname $tmp_path)
pushd $full_path &> /dev/null
helm dependency update &> /dev/null
popd &> /dev/null
if [ -f "$tmp_path" ]; then
echo "found existing file"
echo "renaming old file to "$tmp_path".old"
mv $tmp_path $tmp_path".old"
fi
helm template $app $full_path --namespace $app \
--debug \
--values $argocd_values_path \
--values $argocd_values_deployment_path \
--values $full_path/values.yaml \
--values $full_path/values-$deployment.yaml \
> $tmp_path
echo $tmp_path
-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
mkdir -p .tmp
helm template argocd k8s/argocd \
--namespace argocd \
--create-namespace \
--values k8s/argocd/values.yaml \
--values k8s/argocd/values-dev.yaml \
--set selfapp.enabled="true" \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)" \
> .tmp/argocd.yaml
-33
View File
@@ -1,33 +0,0 @@
#!/bin/bash
set -e
pushd k8s/argocd
helm dependency update
DEPLOYMENT=${1:-dev}
popd
helm install argocd k8s/argocd \
--namespace argocd \
--create-namespace \
--values k8s/argocd/values.yaml \
--values k8s/argocd/values-$DEPLOYMENT.yaml \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)"
watch -n1 "kubectl -n argocd get all"
argocd login cd.argoproj.io --core
kubectl config set-context --current --namespace argocd
argocd admin initial-password
helm upgrade argocd k8s/argocd \
--namespace argocd \
--create-namespace \
--values k8s/argocd/values.yaml \
--values k8s/argocd/values-$DEPLOYMENT.yaml \
--set selfapp.enabled="true" \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)"
argocd app sync argocd/argocd
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
set -e
minikube start
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash
set -e
full_path=${1}
deployment=${2:-dev}
app=$(basename $full_path)
location=$(dirname $full_path)
tmp_path=".tmp/$location/$deployment-$app.yaml"
argocd_values_path=$(realpath k8s/argocd/values-$deployment.yaml)
echo "> writing $location/$app to $tmp_path"
echo "> using argo values of $argocd_values_path"
cat $argocd_values_path | yq
mkdir -p $(dirname $tmp_path)
pushd $full_path &> /dev/null
helm dependency update &> /dev/null
popd &> /dev/null
helm upgrade $app $full_path --namespace $app \
--debug \
--values $argocd_values_path \
--values $full_path/values.yaml \
--values $full_path/values-$deployment.yaml \
> $tmp_path
-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
DEPLOYMENT=dev
helm upgrade argocd k8s/argocd \
--debug \
--namespace argocd \
--create-namespace \
--values k8s/argocd/values.yaml \
--values k8s/argocd/values-$DEPLOYMENT.yaml \
--set selfapp.enabled="true" \
--set selfapp.sshkey="$(cat ~/.ssh/id_rsa)"
View File
Whitespace-only changes.
-23
View File
@@ -1,23 +0,0 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
-9
View File
@@ -1,9 +0,0 @@
apiVersion: v2
name: argocd
description: Homelab Infra
type: application
version: 0.1.0
dependencies:
- name: argo-cd
version: 5.22.1
repository: https://argoproj.github.io/argo-helm
@@ -1,24 +0,0 @@
{{- if .Values.selfapp.enabled -}}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "charts"
namespace: "{{ .Release.Namespace }}"
spec:
project: default
source:
repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git"
targetRevision: "{{ .Values.selfapp.commit }}"
path: k8s/charts
helm:
values: |-
global:
{{- .Values.global | toYaml | nindent 28 }}
valueFiles:
- values.yaml
- values-{{ .Values.global.deployment }}.yaml
destination:
server: https://kubernetes.default.svc
namespace: "{{ .Release.Namespace }}"
{{- end -}}
-26
View File
@@ -1,26 +0,0 @@
{{- if .Values.selfapp.enabled -}}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "{{ .Release.Name }}"
namespace: "{{ .Release.Namespace }}"
spec:
project: default
source:
repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git"
targetRevision: "{{ .Values.selfapp.commit }}"
path: k8s/argocd
helm:
valueFiles:
- values.yaml
- values-{{ .Values.global.deployment }}.yaml
parameters:
- name: "selfapp.enabled"
value: "true"
- name: "selfapp.sshkey"
value: {{ .Values.selfapp.sshkey | quote }}
destination:
server: https://kubernetes.default.svc
namespace: "{{ .Release.Namespace }}"
{{- end -}}
@@ -1,37 +0,0 @@
{{- if .Values.selfapp.enabled -}}
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: "applications"
spec:
generators:
- git:
repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git"
revision: "{{ .Values.selfapp.commit }}"
directories:
- path: k8s/applications/*
template:
metadata:
name: '{{ `{{path.basename}}` }}'
spec:
project: "applications"
source:
repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git"
targetRevision: "{{ .Values.selfapp.commit }}"
path: '{{ `{{path}}` }}'
helm:
values: |-
global:
{{- .Values.global | toYaml | nindent 28 }}
valueFiles:
- values.yaml
- values-{{ .Values.global.deployment }}.yaml
destination:
server: https://kubernetes.default.svc
namespace: 'app-{{ `{{path.basename}}` }}'
syncPolicy:
syncOptions:
- CreateNamespace=true
{{- end -}}
@@ -1,37 +0,0 @@
{{- if .Values.selfapp.enabled -}}
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: "infra"
spec:
generators:
- git:
repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git"
revision: "{{ .Values.selfapp.commit }}"
directories:
- path: k8s/infra/*
template:
metadata:
name: '{{ `{{path.basename}}` }}'
spec:
project: "infrastructure"
source:
repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git"
targetRevision: "{{ .Values.selfapp.commit }}"
path: '{{ `{{path}}` }}'
helm:
values: |-
global:
{{- .Values.global | toYaml | nindent 28 }}
valueFiles:
- values.yaml
- values-{{ .Values.global.deployment }}.yaml
destination:
server: https://kubernetes.default.svc
namespace: '{{ `{{path.basename}}` }}'
syncPolicy:
syncOptions:
- CreateNamespace=true
{{- end -}}
@@ -1,31 +0,0 @@
{{ if .Values.debugger.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: debugger
spec:
selector:
matchLabels:
k8s-app: debugger
template:
metadata:
labels:
k8s-app: debugger
spec:
serviceAccount: argocd-application-controller
restartPolicy: Always
containers:
- image: bitnami/kubectl
name: debugger
command:
- sleep
- infinity
resources:
limits:
cpu: "200m"
memory: "500M"
requests:
cpu: "200m"
memory: "500M"
{{- end -}}
@@ -1,23 +0,0 @@
{{- if .Values.selfapp.enabled -}}
---
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: applications
namespace: "{{ .Release.Namespace }}"
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
description: "homelab applications"
orphanedResources:
warn: false
sourceRepos:
- "git@github.com:{{ .Values.selfapp.repo }}.git"
destinations:
- server: "*"
namespace: 'app-*'
name: '*'
clusterResourceWhitelist:
- group: "*"
kind: "*"
{{- end -}}
@@ -1,23 +0,0 @@
{{- if .Values.selfapp.enabled -}}
---
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: meta-infrastructure
namespace: "{{ .Release.Namespace }}"
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
description: "meta infra services such as base helm charts"
orphanedResources:
warn: false
sourceRepos:
- "*"
destinations:
- server: "*"
namespace: '*'
name: '*'
clusterResourceWhitelist:
- group: "*"
kind: "*"
{{- end -}}
@@ -1,14 +0,0 @@
---
apiVersion: v1
kind: Secret
metadata:
name: argo-repo-main
namespace: "{{ .Release.Namespace }}"
labels:
argocd.argoproj.io/secret-type: repository
annotations:
link.argocd.argoproj.io/external-link: "https://github.com/{{ .Values.selfapp.repo }}"
stringData:
type: git
url: "git@github.com:{{ .Values.selfapp.repo }}.git"
sshPrivateKey: {{ .Values.selfapp.sshkey | quote }}
-3
View File
@@ -1,3 +0,0 @@
global:
deployment: dev
domain: "me.local"
-10
View File
@@ -1,10 +0,0 @@
global:
deployment: prod
domain: "home.sosnovsky.ca"
tls:
enabled: true
issuer: "letsencrypt"
nfs:
server: "192.168.8.107"
debugger:
enabled: true
-33
View File
@@ -1,33 +0,0 @@
argo-cd:
configs:
cm:
exec.enabled: true
params:
server.insecure: true
server.basehref: /
server.rootpath: ""
crds:
install: true
keep: false
server:
ingress:
enabled: false
ingressGrpc:
enabled: false
debugger:
enabled: false
selfapp:
commit: "stable"
repo: "asosnovsky/homelab"
sshkey: ""
global:
email: "ariel@sosnovsky.ca"
tls:
enabled: false
issuer: ""
secretName: ""
domain: ""
deployment: ""
nfs:
server: "changme"
timezone: America/Toronto
-6
View File
@@ -1,6 +0,0 @@
apiVersion: v2
name: charts
description: An infra service for homelab
type: application
version: 0.1.0
dependencies: []
@@ -1,24 +0,0 @@
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "cert-manager"
namespace: "{{ .Release.Namespace }}"
spec:
project: default
source:
chart: cert-manager
repoURL: "https://charts.jetstack.io"
targetRevision: "{{ .Values.chartVersions.certManager }}"
helm:
values: |-
installCRDs: true
releaseName: cert-manager
destination:
server: https://kubernetes.default.svc
namespace: "cert-manager"
syncPolicy:
automated:
selfHeal: true
syncOptions:
- CreateNamespace=true
@@ -1,24 +0,0 @@
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "external-secrets"
namespace: "{{ .Release.Namespace }}"
spec:
project: default
source:
chart: external-secrets
repoURL: "https://charts.external-secrets.io"
targetRevision: "{{ .Values.chartVersions.externalSecrets }}"
helm:
values: |-
installCRDs: true
releaseName: external-secrets
destination:
server: https://kubernetes.default.svc
namespace: "external-secrets"
syncPolicy:
automated:
selfHeal: true
syncOptions:
- CreateNamespace=true
@@ -1,29 +0,0 @@
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "nfs-generic"
namespace: "{{ .Release.Namespace }}"
spec:
project: meta-infrastructure
source:
chart: nfs-subdir-external-provisioner
repoURL: "https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/"
targetRevision: "{{ .Values.chartVersions.nfs }}"
helm:
releaseName: nfs-subdir-external-provisioner
parameters:
- name: nfs.server
value: "{{ .Values.global.nfs.server }}"
- name: nfs.path
value: "{{ .Values.nfs.share }}"
- name: storageClass.name
value: "{{ .Values.global.nfsStorageClass }}"
destination:
server: https://kubernetes.default.svc
namespace: "nfs-subdir-external-provisioner"
syncPolicy:
automated:
selfHeal: true
syncOptions:
- CreateNamespace=true
@@ -1,92 +0,0 @@
{{- $prometheusHost := "monitor.core" -}}
{{- $prometheusNamespace := "monitor" -}}
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ $prometheusNamespace }}
{{ if .Values.global.tls.enabled }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: "tls-{{$prometheusHost}}.{{.Values.global.domain}}"
namespace: "{{ $prometheusNamespace }}"
spec:
secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}"
issuerRef:
kind: ClusterIssuer
name: "{{ .Values.global.tls.issuer }}"
commonName: "{{$prometheusHost}}.{{.Values.global.domain}}"
dnsNames:
- "{{$prometheusHost}}.{{.Values.global.domain}}"
{{ end }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "monitoring-prometheus"
namespace: "{{ .Release.Namespace }}"
spec:
project: meta-infrastructure
source:
chart: prometheus
repoURL: "https://prometheus-community.github.io/helm-charts"
targetRevision: "{{ .Values.chartVersions.prometheus }}"
helm:
releaseName: prometheus
values: |-
configmapReload:
prometheus:
enabled: false
alertmanager:
persistence:
enabled: true
size: 8Gi
storageClass: "local-path"
ingress:
enabled: false
ingressClassName: traefik
annotations: {}
hosts:
- host: "{{$prometheusHost}}.{{ .Values.global.domain }}"
paths:
- path: /alertmanager
pathType: Prefix
{{ if .Values.global.tls.enabled }}
tls:
- secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}"
hosts:
- "{{$prometheusHost}}.{{ .Values.global.domain }}"
{{ end }}
server:
{{ if .Values.global.tls.enabled }}
baseURL: "https://{{$prometheusHost}}.{{ .Values.global.domain }}"
{{ else }}
baseURL: "http://{{$prometheusHost}}.{{ .Values.global.domain }}"
{{ end }}
persistentVolume:
enabled: true
size: 8Gi
storageClass: "local-path"
ingress:
enabled: true
ingressClassName: traefik
annotations:
traefik.ingress.kubernetes.io/router.middlewares: ingresses-chain-authelia
hosts:
- "{{$prometheusHost}}.{{ .Values.global.domain }}"
{{ if .Values.global.tls.enabled }}
tls:
- secretName: "tls-{{$prometheusHost}}.{{.Values.global.domain}}"
hosts:
- "{{$prometheusHost}}.{{ .Values.global.domain }}"
{{ end }}
destination:
server: https://kubernetes.default.svc
namespace: {{ $prometheusNamespace }}
# syncPolicy:
# automated:
# selfHeal: true
@@ -1,22 +0,0 @@
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: "kubernetes-secret-generator"
namespace: "{{ .Release.Namespace }}"
spec:
project: meta-infrastructure
source:
chart: kubernetes-secret-generator
repoURL: "https://helm.mittwald.de"
targetRevision: "{{ .Values.chartVersions.kubernetesSecretGenerator }}"
helm:
releaseName: kubernetes-secret-generator
destination:
server: https://kubernetes.default.svc
namespace: "kubernetes-secret-generator"
syncPolicy:
automated:
selfHeal: true
syncOptions:
- CreateNamespace=true
View File
Whitespace-only changes.
-2
View File
@@ -1,2 +0,0 @@
nfs:
share: "/mnt/EightTerra/k3s-cluster"
-10
View File
@@ -1,10 +0,0 @@
nfs:
share: "/"
chartVersions:
prometheus: "20.2.0"
kubernetesSecretGenerator: "v3.4.0"
nfs: "v4.0.2"
externalSecrets: "0.7.2"
certManager: "1.10.2"
global:
nfsStorageClass: "nfs-generic"
-12
View File
@@ -1,12 +0,0 @@
apiVersion: v2
name: authella
description: An infra service for homelab
type: application
version: 0.1.0
dependencies:
- name: authelia
repository: https://charts.authelia.com
version: "0.8.57"
- name: redis
repository: https://charts.bitnami.com/bitnami
version: "17.9.2"
@@ -1,15 +0,0 @@
{{ if .Values.global.tls.enabled }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: "tls-{{.Values.authelia.ingress.subdomain}}.{{.Values.authelia.domain}}"
spec:
secretName: "{{.Values.authelia.ingress.tls.secret}}"
issuerRef:
kind: ClusterIssuer
name: "{{ .Values.global.tls.issuer }}"
commonName: "{{.Values.authelia.ingress.subdomain}}.{{.Values.authelia.domain}}"
dnsNames:
- "{{.Values.authelia.ingress.subdomain}}.{{.Values.authelia.domain}}"
{{ end }}
@@ -1,83 +0,0 @@
{{ if .Values.smtp_configs }}
---
apiVersion: v1
kind: Secret
metadata:
name: "postfix-smtp-env"
type: Opaque
data:
SERVER_HOSTNAME: "{{ .Values.global.domain | b64enc }}"
{{ range $k, $v := .Values.smtp_configs }}
{{ $k }}: "{{ $v | b64enc }}"
{{ end }}
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "postfix-smtp"
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: secrets
target:
name: "postfix-smtp-env"
creationPolicy: Merge
data:
- secretKey: "SMTP_PASSWORD"
remoteRef:
key: "smtp"
property: password
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postfix
labels:
app: postfix
spec:
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
app: postfix
template:
metadata:
labels:
app: postfix
annotations:
postfix/env-checksum: "{{ .Values.smtp_configs | toJson | sha256sum }}"
spec:
containers:
- image: juanluisbaptiste/postfix:alpine
name: postfix
resources:
requests:
cpu: "20m"
memory: "55M"
limits:
cpu: "20m"
memory: "55M"
envFrom:
- secretRef:
name: postfix-smtp-env
ports:
- containerPort: 25
name: smtp
---
kind: Service
apiVersion: v1
metadata:
name: postfix
spec:
selector:
app: postfix
type: ClusterIP
ports:
- name: smtp
port: 25
targetPort: 25
{{ end }}
@@ -1,46 +0,0 @@
---
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Values.authelia.secret.existingSecret }}"
annotations:
secret-generator.v1.mittwald.de/autogenerate: SESSION_ENCRYPTION_KEY,REDIS_PASSWORD,JWT_TOKEN,STORAGE_ENCRYPTION_KEY
data:
dummy_values: ""
type: Opaque
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "{{ .Values.authelia.secret.existingSecret }}-db"
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: database
target:
name: "{{ .Values.authelia.secret.existingSecret }}"
creationPolicy: Merge
data:
- secretKey: "STORAGE_PASSWORD"
remoteRef:
key: "password.pg.authelia"
property: password
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "{{ .Values.authelia.secret.existingSecret }}-smtp"
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: secrets
target:
name: "{{ .Values.authelia.secret.existingSecret }}"
creationPolicy: Merge
data:
- secretKey: "SMTP_PASSWORD"
remoteRef:
key: "smtp"
property: password
@@ -1,4 +0,0 @@
authelia:
domain: "me.local"
configMap:
default_redirection_url: "http://me.local"
@@ -1,39 +0,0 @@
authelia:
domain: "home.sosnovsky.ca"
configMap:
default_redirection_url: "https://auth.core.home.sosnovsky.ca"
notifier:
disable_startup_check: false
smtp:
enabled: true
enabledSecret: false
host: postfix.authelia.svc.cluster.local
port: 25
sender: ariel.sosnovsky@gmail.com
startup_check_address: ariel.sosnovsky@gmail.com
disable_require_tls: true
# username: ariel.sosnovsky@gmail.com
# identifier: ariel.sosnovsky@gmail.com
# host: smtp.gmail.com
# port: 587
filesystem:
enabled: false
ingress:
enabled: true
certManager: true
tls:
enabled: true
traefikCRD:
enabled: true
disableIngressRoute: true
sticky: true
middlewares:
chains:
ingressRoute:
before:
- name: "https-redirect"
namespace: "apps-ingresses"
smtp_configs:
SMTP_SERVER: "smtp.gmail.com"
SMTP_PORT: "587"
SMTP_USERNAME: "ariel.sosnovsky@gmail.com"
-234
View File
@@ -1,234 +0,0 @@
authelia:
nameOverride: main-authelia
image:
registry: ghcr.io
repository: authelia/authelia
tag: ""
pullPolicy: IfNotPresent
ingress:
enabled: true
annotations: {}
certManager: true
className: traefik
subdomain: auth.core
tls:
enabled: false
secret: authelia-tls
traefikCRD:
enabled: true
disableIngressRoute: false
sticky: true
pod:
kind: DaemonSet
replicas: 1
revisionHistoryLimit: 1
env:
- name: TZ
value: America/Toronto
resources:
limits:
cpu: "4.00"
memory: 125Mi
requests:
cpu: "0.25"
memory: 50Mi
persistence:
enabled: true
readOnly: false
storageClass: "nfs-generic"
accessModes:
- ReadWriteMany
size: 100Mi
configMap:
enabled: true
theme: dark
default_2fa_method: totp
access_control:
secret:
enabled: true
key: configuration.acl.yaml
## Default policy can either be 'bypass', 'one_factor', 'two_factor' or 'deny'. It is the policy applied to any
default_policy: two_factor
networks: []
# networks:
# - name: private
# networks:
# - 10.0.0.0/8
# - 172.16.0.0/12
# - 192.168.0.0/16
# - name: vpn
# networks:
# - 10.9.0.0/16
rules: []
# rules:
# - domain_regex: '^.*\.example.com$'
# policy: bypass
# - domain: public.example.com
# policy: bypass
# - domain: "*.example.com"
# policy: bypass
# methods:
# - OPTIONS
# - domain: secure.example.com
# policy: one_factor
# networks:
# - private
# - vpn
# - 192.168.1.0/24
# - 10.0.0.1
# - domain:
# - secure.example.com
# - private.example.com
# policy: two_factor
# - domain: singlefactor.example.com
# policy: one_factor
# - domain: "mx2.mail.example.com"
# subject: "group:admins"
# policy: deny
# - domain: "*.example.com"
# subject:
# - "group:admins"
# - "group:moderators"
# policy: two_factor
# - domain: dev.example.com
# resources:
# - "^/groups/dev/.*$"
# subject: "group:dev"
# policy: two_factor
# - domain: dev.example.com
# resources:
# - "^/users/john/.*$"
# subject:
# - ["group:dev", "user:john"]
# - "group:admins"
# policy: two_factor
# - domain: "{user}.example.com"
# policy: bypass
authentication_backend:
ldap:
enabled: false
file:
enabled: true
path: /config/users_database.yml
watch: true
search:
email: true
case_insensitive: true
storage:
postgres:
enabled: true
host: postgres.database.svc.cluster.local
port: 5432
database: authelia
schema: public
username: authelia
timeout: 5s
notifier:
disable_startup_check: true
smtp:
enabled: false
filesystem:
enabled: true
filename: /config/notification.txt
session:
name: authelia_session
same_site: lax
expiration: 1h
inactivity: 5m
remember_me_duration: 1M
redis:
enabled: true
enabledSecret: true
host: redis-authelia-headless.authelia.svc.cluster.local
port: 6379
database_index: 0
maximum_active_connections: 8
minimum_idle_connections: 0
secret:
existingSecret: authelia
mountPath: /secrets
excludeVolumeAndMounts: false
storage:
key: STORAGE_PASSWORD
session:
key: SESSION_ENCRYPTION_KEY
redis:
key: REDIS_PASSWORD
smtp:
key: SMTP_PASSWORD
jwt:
key: JWT_TOKEN
storageEncryptionKey:
key: STORAGE_ENCRYPTION_KEY
redis:
image:
registry: docker.io
repository: bitnami/redis
tag: 7.0.10-debian-11-r2
pullPolicy: IfNotPresent
fullnameOverride: "redis-authelia"
architecture: replication
auth:
enabled: true
existingSecret: "authelia"
existingSecretPasswordKey: "REDIS_PASSWORD"
usePasswordFiles: false
master:
count: 1
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
persistence:
enabled: true
size: "8Gi"
storageClass: ""
accessModes:
- ReadWriteOnce
service:
type: ClusterIP
ports:
redis: 6379
replica:
replicaCount: 1
containerPorts:
redis: 6379
resources:
limits:
cpu: 250m
memory: 256Mi
requests:
cpu: 250m
memory: 256Mi
persistence:
enabled: true
storageClass: ""
accessModes:
- ReadWriteOnce
size: 8Gi
service:
type: ClusterIP
ports:
redis: 6379
autoscaling:
enabled: true
minReplicas: 1
maxReplicas: 4
targetCPU: "80"
targetMemory: "80"
-10
View File
@@ -1,10 +0,0 @@
apiVersion: v2
name: authentik
description: An infra service for homelab
type: application
version: 0.1.0
dependencies:
- name: authentik
repository: https://charts.goauthentik.io
version: "2023.3.1"
alias: auth
@@ -1,46 +0,0 @@
---
apiVersion: v1
kind: Secret
metadata:
name: "authentik-env"
annotations:
secret-generator.v1.mittwald.de/autogenerate: AUTHENTIK_SECRET_KEY
data:
_placeholder: ""
type: Opaque
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "authentik-env-db"
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: database
target:
name: "authentik-env"
creationPolicy: Merge
data:
- secretKey: "AUTHENTIK_POSTGRESQL__PASSWORD"
remoteRef:
key: "password.pg.authentik"
property: password
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "authentik-env-smtp"
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: secrets
target:
name: "authentik-env"
creationPolicy: Merge
data:
- secretKey: "AUTHENTIK_EMAIL__PASSWORD"
remoteRef:
key: "smtp"
property: password
Whitespace-only changes.
@@ -1,9 +0,0 @@
auth:
authentik:
cookie_domain: authentik.core.home.sosnovsky.ca
email:
from: "ariel.sosnovsky@gmail.com"
host: smtp.gmail.com
port: 465
username: ariel.sosnovsky@gmail.com
use_ssl: true
-16
View File
@@ -1,16 +0,0 @@
authentik: {}
auth:
authentik:
postgresql:
host: postgres.database.svc.cluster.local
name: authentik
user: authentik
nameOverride: "authentik"
fullnameOverride: "authentik"
postgresql:
enabled: false
redis:
enabled: true
envFrom:
- secretRef:
name: authentik-env
-23
View File
@@ -1,23 +0,0 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
-5
View File
@@ -1,5 +0,0 @@
apiVersion: v2
name: dashboard
description: k8s dashboard
type: application
version: 0.1.0
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
-9
View File
@@ -1,9 +0,0 @@
apiVersion: v2
name: database
description: An infra service for homelab
type: application
version: 0.1.0
dependencies:
- name: postgresql
version: "12.1.8"
repository: "https://charts.bitnami.com/bitnami"
@@ -1,10 +0,0 @@
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: "{{ .Values.postgresql.auth.existingSecret }}"
annotations:
secret-generator.v1.mittwald.de/autogenerate: password
data:
username: cG9zdGdyZXM=
@@ -1,19 +0,0 @@
---
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: database
spec:
provider:
kubernetes:
remoteNamespace: "{{ .Release.Namespace }}"
server:
caProvider:
type: ConfigMap
name: kube-root-ca.crt
key: ca.crt
namespace: "{{ .Release.Namespace }}"
auth:
serviceAccount:
name: "{{ .Release.Namespace }}"
namespace: "{{ .Release.Namespace }}"
@@ -1,9 +0,0 @@
{{- define "pg-users.entry" -}}
#!/bin/sh
cp -r /app /tmp/app
cd /tmp/app && \
terraform init && \
terraform apply -auto-approve -input=false -var-file="/app/users.tfvars" -lock=false
{{- end -}}
@@ -1,46 +0,0 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["list", "create"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "update", "create", "patch", "delete"]
resourceNames:
- "tfstate-default-{{ .Release.Name }}"
{{ range $user := .Values.userGeneration.users }}
- "password.pg.{{ $user }}"
{{ end }}
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "update", "create", "patch", "delete"]
resourceNames: ["lock-tfstate-default-{{ .Release.Name }}"]
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["create"]
---
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ .Release.Name }}
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
@@ -1,83 +0,0 @@
{{- define "pg-users.terraform" -}}
variable "db_host" {}
variable "db_username" {}
variable "db_password" {}
variable "db_users" {
type = list(string)
}
terraform {
required_providers {
postgresql = {
source = "cyrilgdn/postgresql"
version = "1.18.0"
}
}
}
terraform {
backend "kubernetes" {
secret_suffix = "{{ .Release.Name }}"
in_cluster_config = true
namespace = "{{ .Release.Namespace }}"
}
}
provider "postgresql" {
host = var.db_host
port = 5432
username = var.db_username
password = var.db_password
connect_timeout = 15
sslmode = "disable"
}
resource "random_password" "pg_users_pswd" {
count = length(var.db_users)
length = 16
special = true
override_special = "!#$%&"
}
locals {
users = {
for u, pwd in random_password.pg_users_pswd :
var.db_users[u] => pwd.result
}
}
resource "kubernetes_secret" "pg_users" {
for_each = local.users
metadata {
name = "password.pg.${each.key}"
namespace = "{{ .Release.Namespace }}"
annotations = {
"managed-by": "job/user-generation"
}
}
data = {
username = each.key
password = each.value
}
type = "Opaque"
}
resource "postgresql_role" "u" {
for_each = local.users
name = each.key
password = each.value
login = true
}
resource "postgresql_database" "db" {
for_each = local.users
name = each.key
owner = postgresql_role.u[each.key].id
}
{{- end -}}
@@ -1,51 +0,0 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: "user-generation"
namespace: "{{ .Release.Namespace }}"
annotations:
checksum/run-sh: "{{ include "pg-users.entry" . | sha256sum }}"
checksum/main-tf: "{{ include "pg-users.terraform" . | sha256sum }}"
checksum/users-tfvars: "{{ (print "db_users = " ( .Values.userGeneration.users | toJson )) | sha256sum }}"
spec:
template:
spec:
serviceAccount: "{{ .Release.Name }}"
serviceAccountName: "{{ .Release.Name }}"
volumes:
- name: tffiles
secret:
secretName: "user-generation-tf"
containers:
- name: base
image: "hashicorp/terraform:{{ .Values.userGeneration.tfVersion }}"
command:
- sh
- /app/run.sh
volumeMounts:
- mountPath: /app
name: tffiles
env:
- name: TF_LOG_PATH
value: /tmp/terraform.log
- name: TF_INPUT
value: "0"
- name: TF_DATA_DIR
value: /tmp/.terraform
- name: TF_IN_AUTOMATION
value: "1"
- name: TF_VAR_db_host
value: "postgres.{{ .Release.Namespace }}.svc.cluster.local"
- name: TF_VAR_db_username
valueFrom:
secretKeyRef:
name: "{{ .Values.postgresql.auth.existingSecret }}"
key: "username"
- name: TF_VAR_db_password
valueFrom:
secretKeyRef:
name: "{{ .Values.postgresql.auth.existingSecret }}"
key: "password"
restartPolicy: Never
backoffLimit: 2
@@ -1,11 +0,0 @@
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: "user-generation-tf"
namespace: "{{ .Release.Namespace }}"
data:
run.sh: "{{ include "pg-users.entry" . | b64enc }}"
main.tf: "{{ include "pg-users.terraform" . | b64enc }}"
users.tfvars: "{{ (print "db_users = " ( .Values.userGeneration.users | toJson )) | b64enc }}"
Whitespace-only changes.
Whitespace-only changes.
-27
View File
@@ -1,27 +0,0 @@
postgresql:
fullnameOverride: "postgres"
image:
tag: 15.1.0-debian-11-r19
repository: bitnami/postgresql
pullPolicy: IfNotPresent
auth:
secretKeys:
adminPasswordKey: password
existingSecret: "pg.password"
architecture: standalone
postgresqlDataDir: /bitnami/postgresql/data
primary:
persistence:
enabled: true
mountPath: /bitnami/postgresql
storageClass: "nfs-generic"
accessModes:
- ReadWriteMany
readReplicas:
replicaCount: 0
userGeneration:
tfVersion: "1.3.7"
users:
- nextcloud
- authelia
- authentik
-23
View File
@@ -1,23 +0,0 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
-5
View File
@@ -1,5 +0,0 @@
apiVersion: v2
name: reverse-proxy
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
@@ -1,63 +0,0 @@
{{- define "homelab.ingress" }}
#
# Input:
# prefix: str
# service: str
# namespace: str
# global: map (should be .global)
# port: int = 80
# path: str = "/"
# middleware: str = "https-redirect"
#
{{ if .global.tls.enabled }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: "tls-{{.prefix}}.{{.global.domain}}"
namespace: {{ .namespace }}
spec:
secretName: "tls-{{.prefix}}.{{.global.domain}}"
issuerRef:
kind: ClusterIssuer
name: "{{ .global.tls.issuer }}"
commonName: "{{.prefix}}.{{.global.domain}}"
dnsNames:
- "{{.prefix}}.{{.global.domain}}"
{{ end }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: "{{.prefix}}.{{.global.domain}}"
namespace: {{ .namespace }}
annotations:
homelab-ingress/managing-app-namespace: "apps-ingresses"
traefik.ingress.kubernetes.io/router.middlewares: {{ .middleware | default "ingresses-https-redirect"}}@kubernetescrd
{{ range $k, $v := (.annotations | default (dict )) }}
{{ $k }}: {{ $v }}
{{ end }}
spec:
rules:
- host: "{{.prefix}}.{{.global.domain}}"
http:
paths:
- backend:
service:
name: "{{.service}}"
port:
number: {{.port | default 80}}
path: {{ .path | default "/" }}
pathType: Prefix
{{ if .global.tls.enabled }}
tls:
- secretName: "tls-{{.prefix}}.{{.global.domain}}"
hosts:
- "{{.prefix}}.{{.global.domain}}"
{{ end }}
{{- end -}}
@@ -1,18 +0,0 @@
{{ if .Values.global.tls.enabled }}
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: {{ .Values.global.tls.issuer }}
spec:
acme:
server: {{ .Values.acmeServer }}
skipTLSVerify: {{ .Values.skipTLSVerify }}
email: {{ .Values.global.email }}
privateKeySecretRef:
name: {{ .Values.global.tls.issuer }}
solvers:
- http01:
ingress:
class: traefik
{{ end }}
@@ -1,41 +0,0 @@
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: dummy-app
namespace: "{{ .Release.Namespace }}"
spec:
replicas: 1
selector:
matchLabels:
app: dummy
release: "{{ .Release.Name }}"
template:
metadata:
labels:
app: dummy
release: "{{ .Release.Name }}"
spec:
containers:
- name: name
image: nginxdemos/hello
resources:
limits:
cpu: 1
memory: 1Gi
ports:
- containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: dummy-app
spec:
selector:
app: dummy
release: "{{ .Release.Name }}"
type: ClusterIP
ports:
- name: http
port: 80
targetPort: 80
@@ -1,82 +0,0 @@
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: https-redirect
namespace: "{{ .Release.Namespace }}"
spec:
redirectScheme:
scheme: https
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: strict-transport
namespace: "{{ .Release.Namespace }}"
spec:
headers:
hostsProxyHeaders:
- "X-Forwarded-Host"
referrerPolicy: "same-origin"
stsSeconds: 15552000
stsIncludeSubdomains: true
stsPreload: true
forceSTSHeader: true
---
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: chain-authelia
namespace: "{{ .Release.Namespace }}"
spec:
chain:
middlewares:
- name: https-redirect
namespace: "{{ .Release.Namespace }}"
- name: forwardauth-authelia
namespace: "{{ .Release.Namespace }}"
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: forwardauth-authelia
namespace: "{{ .Release.Namespace }}"
labels:
app.kubernetes.io/instance: authelia
app.kubernetes.io/name: authelia
spec:
forwardAuth:
address: http://main-authelia.authelia.svc.cluster.local/api/verify?rd=https%3A%2F%2Fauth.core.{{.Values.global.domain}}%2F
authResponseHeaders:
- Remote-User
- Remote-Name
- Remote-Email
- Remote-Groups
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: forwardauth-authentik
namespace: "{{ .Release.Namespace }}"
labels:
app.kubernetes.io/instance: authentik
app.kubernetes.io/name: authentik
spec:
forwardAuth:
address: http://authentik.core.{{.Values.global.domain}}/outpost.goauthentik.io/auth/traefik
trustForwardHeader: true
authResponseHeaders:
- X-authentik-username
- X-authentik-groups
- X-authentik-email
- X-authentik-name
- X-authentik-uid
- X-authentik-jwt
- X-authentik-meta-jwks
- X-authentik-meta-outpost
- X-authentik-meta-provider
- X-authentik-meta-app
- X-authentik-meta-version
@@ -1,39 +0,0 @@
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: nextcloud
namespace: app-nextcloud
spec:
chain:
middlewares:
- name: https-redirect
namespace: "{{ .Release.Namespace }}"
- name: app-nextcloud-well-known
- name: app-nextcloud-well-known-web-finger
- name: strict-transport
namespace: "{{ .Release.Namespace }}"
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: app-nextcloud-well-known
namespace: app-nextcloud
spec:
redirectRegex:
permanent: true
regex: "https://(.*)/.well-known/(?:card|cal)dav"
replacement: "https://${1}/remote.php/dav"
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: app-nextcloud-well-known-web-finger
namespace: app-nextcloud
spec:
redirectRegex:
permanent: true
regex: "https://(.*)/.well-known/webfinger"
replacement: "https://${1}/public.php?service=webfinger"
@@ -1,27 +0,0 @@
{{ range $prefix, $data := .Values.reverseProxy }}
---
apiVersion: v1
kind: Endpoints
metadata:
name: "reverse-proxy-{{$prefix}}"
subsets:
- addresses:
- ip: "{{ $data.ip }}"
ports:
- port: {{ $data.port }}
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: "reverse-proxy-{{$prefix}}"
spec:
type: ClusterIP
ports:
- port: 80
protocol: TCP
targetPort: {{ $data.port }}
{{ include "homelab.ingress" (dict "service" (printf "reverse-proxy-%s" $prefix) "prefix" $prefix "global" $.Values.global "namespace" $.Release.Namespace )}}
{{ end }}
@@ -1,3 +0,0 @@
{{ range $svc := .Values.services }}
{{ include "homelab.ingress" (merge $svc (dict "global" $.Values.global)) }}
{{ end }}
@@ -1,7 +0,0 @@
reverseProxy:
home:
port: "8123"
ip: "192.168.0.20"
yellow:
port: "8123"
ip: "192.168.0.23"
@@ -1,12 +0,0 @@
reverseProxy:
main:
port: "8123"
ip: "192.168.0.20"
yellow:
port: "8123"
ip: "192.168.0.23"
nas:
ip: "192.168.8.107"
port: "80"
acmeServer: "https://acme-v02.api.letsencrypt.org/directory"
skipTLSVerify: true
-50
View File
@@ -1,50 +0,0 @@
reverseProxy: {}
services:
- prefix: "argocd.core"
service: "argocd-server"
namespace: "argocd"
- prefix: "demo"
service: "dummy-app"
namespace: "apps-ingresses"
middleware: "ingresses-chain-authelia"
- prefix: "client.torrent"
service: "transmission"
namespace: "app-videohosting"
port: "9091"
middleware: "ingresses-chain-authelia"
- prefix: "radarr.torrent"
service: "radarr"
namespace: "app-videohosting"
port: "7878"
middleware: "ingresses-chain-authelia"
# - prefix: "q.torrent"
# service: "qbittorrent"
# namespace: "app-videohosting"
# port: "8080"
# middleware: "ingresses-chain-authelia"
- prefix: "sonarr.torrent"
service: "sonarr"
namespace: "app-videohosting"
port: "8989"
middleware: "ingresses-chain-authelia"
- prefix: "jackett.torrent"
service: "jackett"
namespace: "app-videohosting"
port: "9117"
middleware: "ingresses-chain-authelia"
- prefix: "nextcloud"
service: "nextcloud"
namespace: "app-nextcloud"
port: 8080
middleware: "app-nextcloud-nextcloud"
- prefix: "authentik.core"
service: "authentik"
namespace: "authentik"
port: 80
- prefix: "plex"
service: "plex"
namespace: "app-videohosting"
port: 32400
global: {}
acmeServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
skipTLSVerify: "false"
-6
View File
@@ -1,6 +0,0 @@
apiVersion: v2
name: secrets
description: An infra service for homelab
type: application
version: 0.1.0
dependencies: []
@@ -1,49 +0,0 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: "{{ .Release.Name }}"
namespace: "{{ .Release.Namespace }}"
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["list", "get"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: "{{ .Release.Name }}"
namespace: "{{ .Release.Namespace }}"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: "{{ .Release.Name }}"
namespace: "{{ .Release.Namespace }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: "{{ .Release.Name }}"
subjects:
- kind: ServiceAccount
name: "{{ .Release.Name }}"
namespace: "{{ .Release.Namespace }}"
---
apiVersion: external-secrets.io/v1beta1
kind: ClusterSecretStore
metadata:
name: secrets
spec:
provider:
kubernetes:
remoteNamespace: "{{ .Release.Namespace }}"
server:
caProvider:
type: ConfigMap
name: kube-root-ca.crt
key: ca.crt
namespace: "{{ .Release.Namespace }}"
auth:
serviceAccount:
name: "{{ .Release.Namespace }}"
namespace: "{{ .Release.Namespace }}"
@@ -1,9 +0,0 @@
# TODO: auto fill this from a vault
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: smtp
data:
email: "{{ .Values.smtp.emailFrom | b64enc }}"
Whitespace-only changes.
Whitespace-only changes.
-2
View File
@@ -1,2 +0,0 @@
smtp:
emailFrom: "ariel.sosnovsky@gmail.com"