From 1df14ef62eeb798fb221be59bfe743de576a9679 Mon Sep 17 00:00:00 2001 From: eding Date: Sun, 2 Aug 2026 23:53:58 +0200 Subject: [PATCH] fix: refresh Cloudflare tunnel template --- internal/bootstrap/bootstrap.go | 2 +- internal/bootstrap/bootstrap_test.go | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/internal/bootstrap/bootstrap.go b/internal/bootstrap/bootstrap.go index 3abdd9a..72b3093 100644 --- a/internal/bootstrap/bootstrap.go +++ b/internal/bootstrap/bootstrap.go @@ -70,7 +70,7 @@ var webhookTargetTimeout = 70 * time.Minute var webhookTargetPollInterval = 2 * time.Second -var templateBaseComponents = []string{"snapshot-crds", "democratic-csi", "cert-manager", "cluster-issuers", "gateway-api", "gateway", "monitoring", "openbao", "external-secrets", "cnpg", "external-dns", "tekton", "tekton-triggers"} +var templateBaseComponents = []string{"snapshot-crds", "democratic-csi", "cert-manager", "cluster-issuers", "gateway-api", "gateway", "monitoring", "openbao", "external-secrets", "cnpg", "cloudflare-tunnel", "external-dns", "tekton", "tekton-triggers"} var generatedTemplateFiles = map[string]map[string]bool{ "democratic-csi": {"secret.sops.yaml": true}, diff --git a/internal/bootstrap/bootstrap_test.go b/internal/bootstrap/bootstrap_test.go index af78a3e..82a258b 100644 --- a/internal/bootstrap/bootstrap_test.go +++ b/internal/bootstrap/bootstrap_test.go @@ -126,6 +126,17 @@ func TestCopyTemplateBaseComponentsRefreshesCNPGAndPreservesGeneratedSecrets(t * if err := os.WriteFile(cnpgDestination, []byte("resources:\n - release.yaml\n - infrastructure-postgres.yaml\n"), 0644); err != nil { t.Fatal(err) } + cloudflareSource := filepath.Join(templateDir, "base", "cloudflare-tunnel", "deployment.yaml") + cloudflareDestination := filepath.Join(repoDir, "base", "cloudflare-tunnel", "deployment.yaml") + if err := os.WriteFile(cloudflareSource, []byte("command: cloudflared\n"), 0644); err != nil { + t.Fatal(err) + } + if err := os.MkdirAll(filepath.Dir(cloudflareDestination), 0755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(cloudflareDestination, []byte("command: stale\n"), 0644); err != nil { + t.Fatal(err) + } operatorSource := filepath.Join(templateDir, "base", "cnpg", "operator", "kustomization.yaml") if err := os.MkdirAll(filepath.Dir(operatorSource), 0755); err != nil { t.Fatal(err) @@ -157,6 +168,10 @@ func TestCopyTemplateBaseComponentsRefreshesCNPGAndPreservesGeneratedSecrets(t * if err != nil || string(content) != "resources:\n - release.yaml\n" { t.Fatalf("CNPG operator child was not copied: %q, %v", content, err) } + content, err = os.ReadFile(cloudflareDestination) + if err != nil || string(content) != "command: cloudflared\n" { + t.Fatalf("Cloudflare Tunnel deployment was not refreshed: %q, %v", content, err) + } for _, file := range []string{"democratic-csi/secret.sops.yaml", "openbao/unseal.sops.yaml"} { content, err := os.ReadFile(filepath.Join(repoDir, "base", file)) if err != nil || string(content) != "sops: generated\n" {