diff --git a/experiments/compositions/composition/go.mod b/experiments/compositions/composition/go.mod index edc3cb87d4..4a8667b66d 100644 --- a/experiments/compositions/composition/go.mod +++ b/experiments/compositions/composition/go.mod @@ -53,6 +53,7 @@ require ( github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect + github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/imdario/mergo v0.3.16 // indirect @@ -62,6 +63,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pborman/uuid v1.2.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect diff --git a/experiments/compositions/composition/go.sum b/experiments/compositions/composition/go.sum index aba46eb83f..7e7a2caa72 100644 --- a/experiments/compositions/composition/go.sum +++ b/experiments/compositions/composition/go.sum @@ -182,6 +182,8 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f h1:o2yGZLlsOj5H5uvtQNEdi6DeA0GbUP3lm0gWW5RvY0s= +github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f/go.mod h1:H3K1Iu/utuCfa10JO+GsmKUYSWi7ug57Rk6GaDRHaaQ= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -268,6 +270,8 @@ github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= +github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= diff --git a/experiments/compositions/composition/pkg/containerexecutor/jobcontainerexecutor/jobcontainerrunner.go b/experiments/compositions/composition/pkg/containerexecutor/jobcontainerexecutor/jobcontainerrunner.go index 176f83a1f4..820be85a1f 100644 --- a/experiments/compositions/composition/pkg/containerexecutor/jobcontainerexecutor/jobcontainerrunner.go +++ b/experiments/compositions/composition/pkg/containerexecutor/jobcontainerexecutor/jobcontainerrunner.go @@ -18,10 +18,10 @@ import ( "bytes" "context" "fmt" - "text/template" "time" "github.com/go-logr/logr" + "github.com/google/safetext/yamltemplate" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -131,11 +131,11 @@ func NewJobFactory(ctx context.Context, logger logr.Logger, client client.Client func (f *JobFactory) parseObjectTemplate(name string, objTemplate string) ([]byte, error) { var manifests bytes.Buffer - tmpl, err := template.New(name).Parse(objTemplate) + tmpl, err := yamltemplate.New(name).Parse(objTemplate) if err != nil { return nil, err } - // Execute template tmpl and write to a string + // Execute yamltemplate tmpl and write to a string err = tmpl.Execute(&manifests, *f) if err != nil { return nil, err diff --git a/experiments/compositions/composition/proto/expander.pb.go b/experiments/compositions/composition/proto/expander.pb.go index 10ca89b661..6958d7e062 100644 --- a/experiments/compositions/composition/proto/expander.pb.go +++ b/experiments/compositions/composition/proto/expander.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v3.21.12 // source: proto/expander.proto @@ -564,7 +564,7 @@ func file_proto_expander_proto_rawDescGZIP() []byte { var file_proto_expander_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_proto_expander_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_proto_expander_proto_goTypes = []interface{}{ +var file_proto_expander_proto_goTypes = []any{ (Status)(0), // 0: expander_grpc.Status (ResultType)(0), // 1: expander_grpc.ResultType (*Error)(nil), // 2: expander_grpc.Error @@ -596,7 +596,7 @@ func file_proto_expander_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_proto_expander_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_proto_expander_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*Error); i { case 0: return &v.state @@ -608,7 +608,7 @@ func file_proto_expander_proto_init() { return nil } } - file_proto_expander_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_proto_expander_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ValidateResult); i { case 0: return &v.state @@ -620,7 +620,7 @@ func file_proto_expander_proto_init() { return nil } } - file_proto_expander_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_proto_expander_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*EvaluateResult); i { case 0: return &v.state @@ -632,7 +632,7 @@ func file_proto_expander_proto_init() { return nil } } - file_proto_expander_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_proto_expander_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*EvaluateRequest); i { case 0: return &v.state @@ -644,7 +644,7 @@ func file_proto_expander_proto_init() { return nil } } - file_proto_expander_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_proto_expander_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*ValidateRequest); i { case 0: return &v.state