From fd7ccbcb1188db1e7de1101c286cb6b2ae782868 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sun, 11 May 2025 16:13:40 -0400 Subject: [PATCH] iupdated apps --- bin/dev | 2 +- charts/apps/argoapps/templates/nfs.yaml | 4 ++-- charts/apps/argoapps/values.yaml | 2 ++ .../infrastructure/templates/argocd-appset.yml | 4 ++-- tf-dns.tf | 5 ++++- tf-modules.tf | 16 ++-------------- tf-modules/k8s-helm-charts/charts.tf | 18 ++---------------- tf-modules/k8s-helm-charts/outputs.tf | 4 ---- tf-modules/k8s-helm-charts/variables.tf | 14 +++----------- tf-variables.tf | 3 +++ 10 files changed, 21 insertions(+), 51 deletions(-) diff --git a/bin/dev b/bin/dev index 9616236..59ca135 100755 --- a/bin/dev +++ b/bin/dev @@ -18,7 +18,7 @@ function run-new-chart() { : Create a new helm chart : dev new-chart {path-to-chart} - full_path=${1} + full_path=$ROOT_FOLDER/apps${1} app=$(basename $full_path) location=$(dirname $full_path) typeofapp=$(basename $location) diff --git a/charts/apps/argoapps/templates/nfs.yaml b/charts/apps/argoapps/templates/nfs.yaml index 7ade47c..178f938 100644 --- a/charts/apps/argoapps/templates/nfs.yaml +++ b/charts/apps/argoapps/templates/nfs.yaml @@ -4,9 +4,9 @@ apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: "nfs-storage" - namespace: argocd + namespace: {{ .Values.ns.argocd }} spec: - project: admin + project: main source: repoURL: https://github.com/asosnovsky/nfs-subdir-external-provisioner targetRevision: HEAD diff --git a/charts/apps/argoapps/values.yaml b/charts/apps/argoapps/values.yaml index e69de29..9c80d89 100644 --- a/charts/apps/argoapps/values.yaml +++ b/charts/apps/argoapps/values.yaml @@ -0,0 +1,2 @@ +ns: + argocd: plugin-argo-cd \ No newline at end of file diff --git a/charts/infrastructure/templates/argocd-appset.yml b/charts/infrastructure/templates/argocd-appset.yml index 16d8b9a..d1bf77e 100644 --- a/charts/infrastructure/templates/argocd-appset.yml +++ b/charts/infrastructure/templates/argocd-appset.yml @@ -26,8 +26,8 @@ spec: syncPolicy: syncOptions: - RespectIgnoreDifferences=true - project: main`` - revisionHistoryLimit: 10 + project: main + revisionHistoryLimit: 4 source: path: '{{`{{path}}`}}' repoURL: git@github.com:{{ .Values.gitops.repo }}.git diff --git a/tf-dns.tf b/tf-dns.tf index 8e5744c..a0d3f31 100644 --- a/tf-dns.tf +++ b/tf-dns.tf @@ -1,6 +1,10 @@ data "http" "myip" { url = "https://api.myip.com/" } + +locals { + myip = var.myip != "" ? var.myip : jsondecode(data.http.myip.response_body)["ip"] +} data "cloudflare_zone" "this" { for_each = var.domain_mappings filter = { @@ -13,7 +17,6 @@ data "cloudflare_zone" "this" { locals { - myip = jsondecode(data.http.myip.response_body)["ip"] records = flatten([ for zone, records in var.domain_mappings : [ for r, def in records : diff --git a/tf-modules.tf b/tf-modules.tf index 750df10..4e4eb72 100644 --- a/tf-modules.tf +++ b/tf-modules.tf @@ -35,7 +35,7 @@ module "k8s-helm-charts" { plugins = { "external-secrets" : { repository = "https://charts.external-secrets.io" - version = "0.14.2" + version = "0.16.1" }, "metallb" : { repository = "https://metallb.github.io/metallb" @@ -50,7 +50,7 @@ module "k8s-helm-charts" { }, "argo-cd" : { "repository" : "https://argoproj.github.io/argo-helm" - "version" : "7.8.7" + "version" : "7.9.0" "values" : [ yamlencode({ configs = { @@ -103,18 +103,6 @@ module "k8s-helm-charts" { } }) ] - }, - "nfs-subdir-external-provisioner" : { - repository = "https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/" - version = "4.0.18" - values = [ - yamlencode({ - storageClass : { - name = var.globals.nfs.storageClassName - } - nfs : var.globals.nfs.storageProvider - }) - ] } } } diff --git a/tf-modules/k8s-helm-charts/charts.tf b/tf-modules/k8s-helm-charts/charts.tf index 021e00c..c311f31 100644 --- a/tf-modules/k8s-helm-charts/charts.tf +++ b/tf-modules/k8s-helm-charts/charts.tf @@ -1,26 +1,12 @@ resource "helm_release" "plugins" { for_each = var.plugins name = each.key - chart = each.key + chart = each.value.chart == "" ? each.key : each.value.chart repository = each.value.repository version = each.value.version atomic = true - namespace = "plugin-${each.key}" + namespace = each.value.namespace == "" ? "plugin-${each.key}" : each.value.namespace create_namespace = true values = each.value.values } -resource "helm_release" "infra" { - for_each = var.infra - name = each.key - chart = each.key - repository = each.value.repository - version = each.value.version - atomic = true - namespace = "infra-${each.key}" - create_namespace = true -} - - - - diff --git a/tf-modules/k8s-helm-charts/outputs.tf b/tf-modules/k8s-helm-charts/outputs.tf index 36fcf09..badb761 100644 --- a/tf-modules/k8s-helm-charts/outputs.tf +++ b/tf-modules/k8s-helm-charts/outputs.tf @@ -4,9 +4,5 @@ output "namespaces" { for k, v in helm_release.plugins : k => v.namespace } - infra = { - for k, v in helm_release.infra : - k => v.namespace - } } } diff --git a/tf-modules/k8s-helm-charts/variables.tf b/tf-modules/k8s-helm-charts/variables.tf index c624f25..9c74265 100644 --- a/tf-modules/k8s-helm-charts/variables.tf +++ b/tf-modules/k8s-helm-charts/variables.tf @@ -1,18 +1,10 @@ variable "plugins" { type = map(object({ repository = string - version = string - values = optional(list(string), []) - })) - default = {} -} - - -variable "infra" { - type = map(object({ - repository = string - version = string + version = optional(string) values = optional(list(string), []) + chart = optional(string, "") + namespace = optional(string, "") })) default = {} } diff --git a/tf-variables.tf b/tf-variables.tf index d5b8cf4..7e9be38 100644 --- a/tf-variables.tf +++ b/tf-variables.tf @@ -1,3 +1,6 @@ +variable "myip" { + default = "" +} variable "cloudflare" { sensitive = true type = object({