diff --git a/charts/apps/dummy/Chart.yaml b/charts/apps/dummy/Chart.yaml new file mode 100644 index 0000000..b370869 --- /dev/null +++ b/charts/apps/dummy/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: ingress +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 +appVersion: "1.16.0" diff --git a/charts/apps/dummy/templates/dummy-pod.yaml b/charts/apps/dummy/templates/dummy-pod.yaml new file mode 100644 index 0000000..da58077 --- /dev/null +++ b/charts/apps/dummy/templates/dummy-pod.yaml @@ -0,0 +1,24 @@ +--- +kind: Deployment +apiVersion: apps/v1 +metadata: + name: dummy-app-2 + namespace: "{{ .Release.Namespace }}" +spec: + replicas: 1 + selector: + matchLabels: + app: dummy + template: + metadata: + labels: + app: dummy + spec: + containers: + - name: name + image: nginxdemos/hello + resources: + limits: + memory: 1Gi + ports: + - containerPort: 80 \ No newline at end of file diff --git a/charts/apps/dummy/values.yaml b/charts/apps/dummy/values.yaml new file mode 100644 index 0000000..e69de29 diff --git a/charts/infrastructure/Chart.yaml b/charts/infrastructure/Chart.yaml index db5fe4c..0354599 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.4 +version: 0.1.7 diff --git a/charts/infrastructure/templates/argo-repo.yaml b/charts/infrastructure/templates/argo-repo.yaml deleted file mode 100644 index eb5807b..0000000 --- a/charts/infrastructure/templates/argo-repo.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -apiVersion: v1 -kind: Secret -metadata: - name: argo-repo-main - namespace: "{{ .Values.ns.argocd }}" - labels: - argocd.argoproj.io/secret-type: repository - annotations: - link.argocd.argoproj.io/external-link: "https://github.com/{{ .Values.gitops.repo }}" -stringData: - type: git - url: "git@github.com:{{ .Values.gitops.repo }}.git" - sshPrivateKey: {{ .Values.gitops.sshkey | quote }} diff --git a/charts/infrastructure/values.yaml b/charts/infrastructure/values.yaml index 3c5a9b6..5a3ae12 100644 --- a/charts/infrastructure/values.yaml +++ b/charts/infrastructure/values.yaml @@ -13,7 +13,7 @@ ns: argocd: "change-me" gitops: - commit: "v2" + revision: "v2" repo: "asosnovsky/homelab" sshkey: "" diff --git a/infra-charts-values/pihole.yaml b/infra-charts-values/pihole.yaml deleted file mode 100644 index 5e3bba8..0000000 --- a/infra-charts-values/pihole.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# This is the values.yaml I used on my k3s raspberrypi cluster - -# if you have a problem with serviceWeb Pods not building you might need to checkout this issue: -# https://github.com/MoJo2600/pihole-kubernetes/issues/230 - -ingress: - enabled: true - -persistentVolumeClaim: - enabled: true - -serviceWeb: - loadBalancerIP: 192.168.178.201 - annotations: - metallb.universe.tf/allow-shared-ip: pihole-svc - type: LoadBalancer - -serviceDns: - loadBalancerIP: 192.168.178.201 - annotations: - metallb.universe.tf/allow-shared-ip: pihole-svc - type: LoadBalancer - -serviceDhcp: - loadBalancerIP: 192.168.178.201 - annotations: - metallb.universe.tf/allow-shared-ip: pihole-svc - type: LoadBalancer - -podDnsConfig: - enabled: true - policy: "None" - nameservers: - - 127.0.0.1 - - 8.8.8.8 - -#! use an existing secret in a prod env -adminPassword: "0n4BQ2l7Dbu3ViYgd4wu" - -resources: - limits: - cpu: 200m - memory: 256Mi - requests: - cpu: 100m - memory: 128Mi - -extraEnvVars: { - DNSMASQ_USER: "root" -} \ No newline at end of file diff --git a/tf-argocd.tf b/tf-argocd.tf new file mode 100644 index 0000000..bde776f --- /dev/null +++ b/tf-argocd.tf @@ -0,0 +1,42 @@ +resource "argocd_repository" "homelab" { + name = "homelab" + repo = "git@github.com:asosnovsky/homelab.git" + username = "git" + ssh_private_key = var.ssh_key + insecure = true +} + +resource "argocd_application_set" "apps" { + metadata { + name = "apps" + } + spec { + generator { + git { + repo_url = argocd_repository.homelab.repo + revision = "v2" + file { + path = "charts/apps/*" + } + } + } + template { + metadata { + name = "apps-{{path.basename}}" + } + + spec { + source { + repo_url = argocd_repository.homelab.repo + target_revision = "v2" + path = "{{path}}" + } + + destination { + server = "https://kubernetes.default.svc" + namespace = "{{path.basename}}" + } + } + } + } +} diff --git a/tf-provider.tf b/tf-provider.tf index 9a87cdd..646ac35 100644 --- a/tf-provider.tf +++ b/tf-provider.tf @@ -24,6 +24,10 @@ terraform { source = "cloudflare/cloudflare" version = "5.2.0" } + argocd = { + source = "argoproj-labs/argocd" + version = "7.5.2" + } } } @@ -39,3 +43,6 @@ provider "http" {} provider "cloudflare" { api_token = var.cloudflare.api_token } +provider "argocd" { + core = true +} diff --git a/tf-svc.tf b/tf-svc.tf index e93171e..b476080 100644 --- a/tf-svc.tf +++ b/tf-svc.tf @@ -4,6 +4,7 @@ resource "kubernetes_service_v1" "argocd-metallb" { namespace = module.k8s-helm-charts.namespaces.plugins.argo-cd annotations = { "metallb.universe.tf/loadBalancerIPs" : "10.0.100.2" + "metallb.io/ip-allocated-from-pool" : "homelab-pool" } } spec {