latest work
This commit is contained in:
1 parent
0011050e53
commit
ca4cec7a56
4 files changed
+84
-5
No files matched your search
@@ -41,7 +41,7 @@ function run-upload-tfvars() {
|
||||
kubectl -n $tfvar_ns create secret generic tfvars \
|
||||
--dry-run=client \
|
||||
--save-config \
|
||||
--from-file=tfvars=./$tfvar_file \
|
||||
--from-file=tfvars=$tfvar_file \
|
||||
-o yaml | \
|
||||
kubectl -n $tfvar_ns apply -f -
|
||||
}
|
||||
@@ -52,4 +52,24 @@ function run-download-tfvars() {
|
||||
kubectl -n $tfvar_ns get secrets/tfvars -o jsonpath='{.data.tfvars}' | base64 -d > $tfvar_file
|
||||
}
|
||||
|
||||
function run-template() {
|
||||
:
|
||||
:
|
||||
app_name=${1}
|
||||
tmp_folder=$ROOT_FOLDER/.tmp/homelab/tpl-$app_name
|
||||
rm -rf $tmp_folder
|
||||
mkdir -p $tmp_folder
|
||||
kubectl get -n plugin-argo-cd applications.argoproj.io $app_name -o jsonpath='{.spec.source}' > $tmp_folder/spec.json
|
||||
folder=$(cat $tmp_folder/spec.json | jq -r '.path')
|
||||
cat $tmp_folder/spec.json | jq -r '.helm.values' > $tmp_folder/v.yaml
|
||||
valuesFiles="--values "$(cat $tmp_folder/spec.json | jq -r '.helm.valueFiles | join(" --values ")')
|
||||
pushd $ROOT_FOLDER/$folder &> /dev/null
|
||||
hcmd="helm template --debug $valuesFiles --values $tmp_folder/v.yaml ."
|
||||
echo $hcmd
|
||||
$hcmd > $tmp_folder/rendered.yaml
|
||||
cat $tmp_folder/rendered.yaml
|
||||
echo $tmp_folder/rendered.yaml
|
||||
popd &> /dev/null
|
||||
}
|
||||
|
||||
start_cli $@
|
||||
+11
-2
@@ -17,8 +17,17 @@ resource "helm_release" "local-chart-infrastructure" {
|
||||
value = var.ssh_key
|
||||
}
|
||||
]
|
||||
timeout = 120
|
||||
force_update = true
|
||||
values = [
|
||||
yamlencode({
|
||||
"global" : var.globals
|
||||
})
|
||||
]
|
||||
timeout = 120
|
||||
force_update = true
|
||||
lint = true
|
||||
wait = true
|
||||
wait_for_jobs = true
|
||||
max_history = 4
|
||||
}
|
||||
|
||||
module "k8s-helm-charts" {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
resource "kubernetes_namespace_v1" "certs" {
|
||||
metadata {
|
||||
name = "certs"
|
||||
}
|
||||
}
|
||||
resource "kubernetes_secret_v1" "cloudflare" {
|
||||
metadata {
|
||||
name = "cloudflare-api-token"
|
||||
namespace = kubernetes_namespace_v1.certs.id
|
||||
}
|
||||
data = {
|
||||
"api_token" : var.cloudflare.cm_api_token
|
||||
}
|
||||
}
|
||||
+38
-2
@@ -1,8 +1,9 @@
|
||||
variable "cloudflare" {
|
||||
sensitive = true
|
||||
type = object({
|
||||
api_token = string
|
||||
account_id = string
|
||||
api_token = string
|
||||
account_id = string
|
||||
cm_api_token = string
|
||||
})
|
||||
}
|
||||
variable "main_domain" {
|
||||
@@ -27,3 +28,38 @@ variable "tailscale" {
|
||||
})
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "globals" {
|
||||
type = object({
|
||||
deployment = string
|
||||
email = string
|
||||
timezone = string
|
||||
|
||||
dns = object({
|
||||
primary = object({
|
||||
domain = string
|
||||
root = optional(string, "")
|
||||
})
|
||||
secondary = object({
|
||||
domain = string
|
||||
root = optional(string, "")
|
||||
})
|
||||
tls = object({
|
||||
enabled = bool
|
||||
useWildCard = optional(bool, true)
|
||||
skipTLSVerify = optional(bool, true)
|
||||
issuer = optional(string, "letsencrypt")
|
||||
acmeServer = optional(string, "https://acme-v02.api.letsencrypt.org/directory")
|
||||
})
|
||||
})
|
||||
nfs = object({
|
||||
server = string
|
||||
shares = object({
|
||||
k3s-cluster-pvc = string
|
||||
})
|
||||
})
|
||||
smtp = object({
|
||||
email = string
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user