From 18a1f7e6009e9ccf69a24199d5223c8bfb601545 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Mon, 4 Aug 2025 13:55:04 -0400 Subject: [PATCH] adjusting git --- charts/apps/torrents/Chart.yaml | 6 ++++ charts/apps/torrents/templates/chart.yaml | 26 ++++++++++++++++ charts/apps/torrents/templates/vpn-creds.yaml | 29 +++++++++++++++++ charts/apps/torrents/values.yaml | 0 charts/infrastructure/Chart.yaml | 2 +- .../templates/_helpers/git-repos.tpl | 17 ++++++++++ .../infrastructure/templates/argocd-repo.yaml | 31 +++++++++---------- charts/infrastructure/values.yaml | 7 +++++ tf-modules.tf | 4 +++ tf-variables.tf | 3 ++ 10 files changed, 108 insertions(+), 17 deletions(-) create mode 100644 charts/apps/torrents/Chart.yaml create mode 100644 charts/apps/torrents/templates/chart.yaml create mode 100644 charts/apps/torrents/templates/vpn-creds.yaml create mode 100644 charts/apps/torrents/values.yaml create mode 100644 charts/infrastructure/templates/_helpers/git-repos.tpl diff --git a/charts/apps/torrents/Chart.yaml b/charts/apps/torrents/Chart.yaml new file mode 100644 index 0000000..e123dee --- /dev/null +++ b/charts/apps/torrents/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: torrents +description: An apps service for homelab +type: application +version: 0.1.0 +dependencies: [] diff --git a/charts/apps/torrents/templates/chart.yaml b/charts/apps/torrents/templates/chart.yaml new file mode 100644 index 0000000..a263295 --- /dev/null +++ b/charts/apps/torrents/templates/chart.yaml @@ -0,0 +1,26 @@ +# --- +# apiVersion: argoproj.io/v1alpha1 +# kind: Application +# metadata: +# name: "{{ $name }}" +# namespace: {{ $.Values.ns.argocd }} +# spec: +# project: main +# source: +# path: 'charts/compose-app' +# repoURL: {{ $.Values.repo }} +# targetRevision: {{ $.Values.revision }} +# helm: +# values: |- +# global: +# {{ $.Values.global | toYaml | nindent 20 }} +# {{ $data | toYaml | nindent 16 }} +# destination: +# namespace: {{ .Release.Namespace }} +# server: https://kubernetes.default.svc +# syncPolicy: +# syncOptions: +# - CreateNamespace=true +# automation: +# prune: true +# selfHeal: true \ No newline at end of file diff --git a/charts/apps/torrents/templates/vpn-creds.yaml b/charts/apps/torrents/templates/vpn-creds.yaml new file mode 100644 index 0000000..4744d98 --- /dev/null +++ b/charts/apps/torrents/templates/vpn-creds.yaml @@ -0,0 +1,29 @@ +--- +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: vpn-creds +spec: + refreshInterval: 1h + secretStoreRef: + kind: ClusterSecretStore + name: secrets + target: + name: vpn-credentials + data: + - secretKey: SERVER_COUNTRIES + remoteRef: + key: vpn-credentials + property: country + - secretKey: OPENVPN_USER + remoteRef: + key: vpn-credentials + property: user + - secretKey: OPENVPN_PASSWORD + remoteRef: + key: vpn-credentials + property: password + - secretKey: VPN_SERVICE_PROVIDER + remoteRef: + key: vpn-credentials + property: provider diff --git a/charts/apps/torrents/values.yaml b/charts/apps/torrents/values.yaml new file mode 100644 index 0000000..e69de29 diff --git a/charts/infrastructure/Chart.yaml b/charts/infrastructure/Chart.yaml index c2c34d3..b2c1326 100644 --- a/charts/infrastructure/Chart.yaml +++ b/charts/infrastructure/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 name: cluster description: An infrastructure collection of manifests for homelab type: application -version: 0.1.12 +version: 0.1.15 diff --git a/charts/infrastructure/templates/_helpers/git-repos.tpl b/charts/infrastructure/templates/_helpers/git-repos.tpl new file mode 100644 index 0000000..01e7f4b --- /dev/null +++ b/charts/infrastructure/templates/_helpers/git-repos.tpl @@ -0,0 +1,17 @@ +{{ define "git-repo" }} +--- +apiVersion: v1 +kind: Secret +metadata: + labels: + argocd.argoproj.io/secret-type: repository + name: {{ .name }} + namespace: "{{ .namespace }}" +type: Opaque +stringData: + name: {{ .name }} + type: {{ .type | default "git" }} + url: {{ .url }} +data: + sshPrivateKey: "{{ .sshkey | b64enc }}" +{{ end }} \ No newline at end of file diff --git a/charts/infrastructure/templates/argocd-repo.yaml b/charts/infrastructure/templates/argocd-repo.yaml index 395100e..f022523 100644 --- a/charts/infrastructure/templates/argocd-repo.yaml +++ b/charts/infrastructure/templates/argocd-repo.yaml @@ -1,16 +1,15 @@ ---- -apiVersion: v1 -kind: Secret -metadata: - labels: - argocd.argoproj.io/secret-type: repository - name: homelab - namespace: "{{ .Values.ns.argocd }}" -type: Opaque -stringData: - name: homelab - type: git - username: git - url: {{ .Values.gitops.repo }} -data: - sshPrivateKey: "{{ .Values.gitops.sshkey | b64enc }}" +{{ include "git-repo" (dict + "name" "homelab" + "namespace" $.Values.ns.argocd + "sshkey" $.Values.gitops.sshkey + "url" $.Values.gitops.repo +)}} + + + +{{- range $name, $val := .Values.additionalRepos }} +{{ include "git-repo" (merge $val (dict + "name" $name + "namespace" $.Values.ns.argocd +))}} +{{ end -}} \ No newline at end of file diff --git a/charts/infrastructure/values.yaml b/charts/infrastructure/values.yaml index 4f2b3cc..f41336f 100644 --- a/charts/infrastructure/values.yaml +++ b/charts/infrastructure/values.yaml @@ -13,6 +13,13 @@ gitops: repo: "ssh://gitea@minipc1.lab.internal/ari/homelab.git" sshkey: "" +additionalRepos: + github-helm-charts: + type: git + username: git + url: git@github.com:asosnovsky/helm-charts.git + sshkey: "" + metallb: addresses: - 10.0.100.1-10.0.100.255 diff --git a/tf-modules.tf b/tf-modules.tf index 4e4eb72..a8ca289 100644 --- a/tf-modules.tf +++ b/tf-modules.tf @@ -15,6 +15,10 @@ resource "helm_release" "local-chart-infrastructure" { { name = "gitops.sshkey" value = var.ssh_key + }, + { + name = "additionalRepos.github-helm-charts.sshkey" + value = var.github_ssh_key } ] values = [ diff --git a/tf-variables.tf b/tf-variables.tf index 8396636..a5d871d 100644 --- a/tf-variables.tf +++ b/tf-variables.tf @@ -24,6 +24,9 @@ variable "domain_mappings" { variable "ssh_key" { sensitive = true } +variable "github_ssh_key" { + sensitive = true +} variable "tailscale" { type = object({ client_id = string,