diff --git a/bin/dev b/bin/dev index 7e4547a..f1fd65d 100755 --- a/bin/dev +++ b/bin/dev @@ -17,12 +17,12 @@ kubectl config use-context homelab function run-new-chart() { : Create a new helm chart : dev new-chart {path-to-chart} - + full_path=$ROOT_FOLDER/charts/apps/${1} app=$(basename $full_path) location=$(dirname $full_path) typeofapp=$(basename $location) - + mkdir -p $full_path/templates touch $full_path/values.yaml cat <> $full_path/Chart.yaml @@ -86,4 +86,10 @@ function run-template-compose-app() { # echo $out | bat -l yaml } -start_cli $@ \ No newline at end of file +function run-htpasswd() { + : Generates htpasswd file + : dev htpasswd + openssl passwd -apr1 ${@} +} + +start_cli $@ diff --git a/charts/apps/argoapps/compose-apps/smartboi.yaml b/charts/apps/argoapps/compose-apps/smartboi.yaml index 81056f0..150f33e 100644 --- a/charts/apps/argoapps/compose-apps/smartboi.yaml +++ b/charts/apps/argoapps/compose-apps/smartboi.yaml @@ -19,3 +19,4 @@ ingress: service: smartboi port: 8000 useSecondaryDomain: true + middleware: basic-auth-smartboi diff --git a/charts/apps/ingress/templates/middlewares/basic-auth.yaml b/charts/apps/ingress/templates/middlewares/basic-auth.yaml new file mode 100644 index 0000000..c975961 --- /dev/null +++ b/charts/apps/ingress/templates/middlewares/basic-auth.yaml @@ -0,0 +1,21 @@ +{{ range $user, $pass := .Values.users }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: "secret-basic-auth-{{$user}}" +type: kubernetes.io/basic-auth +stringData: + username: {{ $user }} + password: {{ $pass }} +--- +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: "basic-auth-{{$user}}" +spec: + redirectScheme: + scheme: https + basicAuth: + secret: "secret-basic-auth-{{$user}}" +{{ end }} diff --git a/charts/apps/ingress/values-dev.yaml b/charts/apps/ingress/values-dev.yaml index 430db83..d5c19ca 100644 --- a/charts/apps/ingress/values-dev.yaml +++ b/charts/apps/ingress/values-dev.yaml @@ -1,9 +1,7 @@ - - reverseProxy: - home: - port: "8123" - ip: "192.168.0.20" - yellow: - port: "8123" - ip: "192.168.0.23" \ No newline at end of file + home: + port: "8123" + ip: "192.168.0.20" + yellow: + port: "8123" + ip: "192.168.0.23" diff --git a/charts/apps/ingress/values.yaml b/charts/apps/ingress/values.yaml index ffb714b..ae869e1 100644 --- a/charts/apps/ingress/values.yaml +++ b/charts/apps/ingress/values.yaml @@ -1,17 +1,20 @@ global: - dns: - internalPrefix: k3s.internal - primary: - domain: "internal" - root: "k3s" - secondary: - domain: "local" - root: "k3s" - tls: - enabled: false + dns: + internalPrefix: k3s.internal + primary: + domain: "internal" + root: "k3s" + secondary: + domain: "local" + root: "k3s" + tls: + enabled: false reverseProxy: {} services: [] tailScaleServices: [] ns: - argocd: plugin-argo-cd + argocd: plugin-argo-cd + +users: + smartboi: "makingmoney" diff --git a/flake.nix b/flake.nix index 5ce0a91..148d87b 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ yq bat jq + openssl # k8s kubectx k3d