diff --git a/internal/utils/template.go b/connectivity/manifests/template/template.go similarity index 51% rename from internal/utils/template.go rename to connectivity/manifests/template/template.go index 9dafcec3aa..cb3586d71d 100644 --- a/internal/utils/template.go +++ b/connectivity/manifests/template/template.go @@ -1,12 +1,15 @@ -package utils +// SPDX-License-Identifier: Apache-2.0 +// Copyright Authors of Cilium + +package template import ( "bytes" - "text/template" + "html/template" ) -// RenderTemplate executes temp with data and returns the result -func RenderTemplate(temp string, data any) (string, error) { +// Render executes temp template with data and returns the result +func Render(temp string, data any) (string, error) { tm, err := template.New("template").Parse(temp) if err != nil { return "", err diff --git a/connectivity/suite.go b/connectivity/suite.go index c0c499188f..e5e2a4fac7 100644 --- a/connectivity/suite.go +++ b/connectivity/suite.go @@ -12,8 +12,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/cilium/cilium-cli/connectivity/check" + "github.com/cilium/cilium-cli/connectivity/manifests/template" "github.com/cilium/cilium-cli/connectivity/tests" - "github.com/cilium/cilium-cli/internal/utils" ) var ( @@ -183,7 +183,7 @@ func Run(ctx context.Context, ct *check.ConnectivityTest, addExtraTests func(*ch "clientEgressL7HTTPMatchheaderSecretYAML": clientEgressL7HTTPMatchheaderSecretYAML, "echoIngressFromCIDRYAML": echoIngressFromCIDRYAML, } { - val, err := utils.RenderTemplate(temp, ct.Params()) + val, err := template.Render(temp, ct.Params()) if err != nil { return err }