From 0c56a5f314067c291137e1a2786a9f012fa298d3 Mon Sep 17 00:00:00 2001 From: mprahl Date: Mon, 24 Oct 2022 16:18:43 -0400 Subject: [PATCH 1/2] Update go-template-utils to v3.0.0 Signed-off-by: mprahl (cherry picked from commit b4ec56ab9fcc5c48606926e6355d13fdbb2f38ea) --- controllers/configurationpolicy_controller.go | 4 ++-- controllers/encryption.go | 2 +- go.mod | 10 +++++----- go.sum | 18 +++++++++--------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/controllers/configurationpolicy_controller.go b/controllers/configurationpolicy_controller.go index 11a25551..32faa285 100644 --- a/controllers/configurationpolicy_controller.go +++ b/controllers/configurationpolicy_controller.go @@ -17,7 +17,7 @@ import ( gocmp "github.com/google/go-cmp/cmp" "github.com/prometheus/client_golang/prometheus" - templates "github.com/stolostron/go-template-utils/v2/pkg/templates" + templates "github.com/stolostron/go-template-utils/v3/pkg/templates" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" meta "k8s.io/apimachinery/pkg/api/meta" @@ -850,7 +850,7 @@ func (r *ConfigurationPolicyReconciler) handleObjectTemplates(plc policyv1.Confi } // Set the resolved data for use in further processing - objectT.ObjectDefinition.Raw = resolvedTemplate + objectT.ObjectDefinition.Raw = resolvedTemplate.ResolvedJSON } } } diff --git a/controllers/encryption.go b/controllers/encryption.go index a294ddb6..b6e4ef81 100644 --- a/controllers/encryption.go +++ b/controllers/encryption.go @@ -8,7 +8,7 @@ import ( "encoding/base64" "fmt" - "github.com/stolostron/go-template-utils/v2/pkg/templates" + "github.com/stolostron/go-template-utils/v3/pkg/templates" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" diff --git a/go.mod b/go.mod index e9a68f23..66b8509e 100644 --- a/go.mod +++ b/go.mod @@ -6,12 +6,12 @@ require ( github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/go-logr/zapr v1.2.3 github.com/google/go-cmp v0.5.8 - github.com/onsi/ginkgo/v2 v2.1.4 - github.com/onsi/gomega v1.19.0 + github.com/onsi/ginkgo/v2 v2.1.6 + github.com/onsi/gomega v1.20.1 github.com/prometheus/client_golang v1.13.0 github.com/spf13/pflag v1.0.5 github.com/stolostron/go-log-utils v0.1.1 - github.com/stolostron/go-template-utils/v2 v2.5.1 + github.com/stolostron/go-template-utils/v3 v3.0.0 github.com/stretchr/testify v1.7.0 k8s.io/api v0.23.9 k8s.io/apimachinery v0.23.9 @@ -48,8 +48,7 @@ require ( github.com/go-openapi/jsonreference v0.19.6 // indirect github.com/go-openapi/swag v0.21.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.3.0 // indirect - github.com/golang/glog v1.0.0 // indirect + github.com/golang-jwt/jwt/v4 v4.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -73,6 +72,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect + github.com/stolostron/kubernetes-dependency-watches v0.0.0-20221007134235-7551d84cf688 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.21.0 // indirect diff --git a/go.sum b/go.sum index 7d9e20ff..382f5f6f 100644 --- a/go.sum +++ b/go.sum @@ -226,11 +226,9 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= -github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -454,13 +452,13 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= +github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= +github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= +github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/openshift/library-go v0.0.0-20220203150523-45e0cded6a36 h1:LSXlqkXjPU5cmxZmBANg93rFCwM6xHFP22ssDfRa+1E= github.com/openshift/library-go v0.0.0-20220203150523-45e0cded6a36/go.mod h1:6AmNM4N4nHftckybV/U7bQW+5AvK5TW81ndSI6KEidw= @@ -554,8 +552,10 @@ github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stolostron/go-log-utils v0.1.1 h1:T48GyfuGpn2+6817FQVec1CyxGf0ibuVhoBiz9SeCec= github.com/stolostron/go-log-utils v0.1.1/go.mod h1:2Uc5mbuLvSFpoXFFEKRTEFOlR7nqGVMu9mbU+FIttTI= -github.com/stolostron/go-template-utils/v2 v2.5.1 h1:bXuPH3tpkvilGNMVVNikS96O/+/VGyjQuZ69tfjlTEQ= -github.com/stolostron/go-template-utils/v2 v2.5.1/go.mod h1:sWRijO7EblHCoFUvZASmWHmFxG6ARrQ9SfGQDiwrz4A= +github.com/stolostron/go-template-utils/v3 v3.0.0 h1:SxXFxDkHD8GpkkOL3iJXcPwkRdkUZwdwytuFFR8WJHs= +github.com/stolostron/go-template-utils/v3 v3.0.0/go.mod h1:gtsdI4h90CDp3wQWqaRyhlZg0tPSD0bmVtXpw37BugQ= +github.com/stolostron/kubernetes-dependency-watches v0.0.0-20221007134235-7551d84cf688 h1:Q/0MspxKFkqBN59keMsJI2hGqGGpTSxdNEvrxTOBlRg= +github.com/stolostron/kubernetes-dependency-watches v0.0.0-20221007134235-7551d84cf688/go.mod h1:jGnjY4g8N1PaBqt35EjqNRjymjG0DWqki/2JOLMN1Pg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= From 4bf69fc8b70bc5853396043d7cf8a08f0a68434f Mon Sep 17 00:00:00 2001 From: mprahl Date: Tue, 25 Oct 2022 10:44:42 -0400 Subject: [PATCH 2/2] Initialize klog explicitly Updating go-template-utils causes the klog flags to not be initialized implicitly. Signed-off-by: mprahl (cherry picked from commit dc1d906e72bf84c87cb7e27b36e0027fc0b6b6e2) --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 46648123..106cc043 100644 --- a/main.go +++ b/main.go @@ -59,6 +59,8 @@ func init() { } func main() { + klog.InitFlags(nil) + zflags := zaputil.FlagConfig{ LevelName: "log-level", EncoderName: "log-encoder",