From 52451436c7e18c07034dd7289dfab0c03ade6382 Mon Sep 17 00:00:00 2001 From: Anish Ramasekar Date: Wed, 3 Mar 2021 12:26:15 -0800 Subject: [PATCH] chore: update to go 1.16 Signed-off-by: Anish Ramasekar --- .pipelines/e2e-kind-template.yml | 2 +- .pipelines/unit-tests-template.yml | 2 +- Dockerfile | 2 ++ go.mod | 2 +- go.sum | 3 --- pkg/auth/auth.go | 4 ++-- pkg/config/azure_config.go | 4 ++-- pkg/plugin/healthz_test.go | 6 +++--- tools/go.mod | 2 +- tools/go.sum | 2 -- 10 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.pipelines/e2e-kind-template.yml b/.pipelines/e2e-kind-template.yml index 70897a5e..060fadf6 100644 --- a/.pipelines/e2e-kind-template.yml +++ b/.pipelines/e2e-kind-template.yml @@ -10,7 +10,7 @@ jobs: steps: - task: GoTool@0 inputs: - version: 1.15 + version: 1.16 - script: make e2e-install-prerequisites displayName: "Install e2e test prerequisites" diff --git a/.pipelines/unit-tests-template.yml b/.pipelines/unit-tests-template.yml index 1755086b..18b2d1ff 100644 --- a/.pipelines/unit-tests-template.yml +++ b/.pipelines/unit-tests-template.yml @@ -10,7 +10,7 @@ jobs: steps: - task: GoTool@0 inputs: - version: 1.15 + version: 1.16 - script: make lint displayName: Run lint - script: make unit-test diff --git a/Dockerfile b/Dockerfile index 8cbdf62b..b43df5f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ FROM us.gcr.io/k8s-artifacts-prod/build-image/debian-base-amd64:buster-v1.4.0 +# upgrading libzstd1 due to CVE-2021-24032 +RUN clean-install libzstd1 COPY ./_output/kubernetes-kms /bin/ ENTRYPOINT [ "/bin/kubernetes-kms" ] diff --git a/go.mod b/go.mod index e3d0c321..43241f48 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Azure/kubernetes-kms -go 1.15 +go 1.16 require ( github.com/Azure/azure-sdk-for-go v48.2.0+incompatible diff --git a/go.sum b/go.sum index d6bc7a74..ceabb5c3 100644 --- a/go.sum +++ b/go.sum @@ -68,7 +68,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -118,10 +117,8 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go index 9b42b973..5e260d4e 100644 --- a/pkg/auth/auth.go +++ b/pkg/auth/auth.go @@ -9,7 +9,7 @@ import ( "crypto/rsa" "crypto/x509" "fmt" - "io/ioutil" + "os" "regexp" "github.com/Azure/kubernetes-kms/pkg/config" @@ -75,7 +75,7 @@ func GetServicePrincipalToken(config *config.AzureConfig, env *azure.Environment if len(config.AADClientCertPath) > 0 && len(config.AADClientCertPassword) > 0 { klog.V(2).Infof("using jwt client_assertion (client_cert+client_private_key) to retrieve access token") - certData, err := ioutil.ReadFile(config.AADClientCertPath) + certData, err := os.ReadFile(config.AADClientCertPath) if err != nil { return nil, fmt.Errorf("failed to read client certificate from file %s, error: %v", config.AADClientCertPath, err) } diff --git a/pkg/config/azure_config.go b/pkg/config/azure_config.go index 1b845533..3157bd22 100644 --- a/pkg/config/azure_config.go +++ b/pkg/config/azure_config.go @@ -2,7 +2,7 @@ package config import ( "fmt" - "io/ioutil" + "os" "gopkg.in/yaml.v2" "k8s.io/klog/v2" @@ -25,7 +25,7 @@ func GetAzureConfig(configFile string) (config *AzureConfig, err error) { cfg := AzureConfig{} klog.V(5).Infof("populating AzureConfig from %s", configFile) - bytes, err := ioutil.ReadFile(configFile) + bytes, err := os.ReadFile(configFile) if err != nil { return nil, fmt.Errorf("failed to load config file %s, error: %+v", configFile, err) } diff --git a/pkg/plugin/healthz_test.go b/pkg/plugin/healthz_test.go index 9dbd5bb3..20261191 100644 --- a/pkg/plugin/healthz_test.go +++ b/pkg/plugin/healthz_test.go @@ -8,7 +8,7 @@ package plugin import ( "context" "fmt" - "io/ioutil" + "io" "net" "net/http" "net/http/httptest" @@ -124,7 +124,7 @@ func TestCheckRPC(t *testing.T) { } func getTempTestDir(t *testing.T) string { - tmpDir, err := ioutil.TempDir("", "ut") + tmpDir, err := os.MkdirTemp("", "ut") if err != nil { t.Fatalf("expected err to be nil, got: %+v", err) } @@ -155,7 +155,7 @@ func doHealthCheck(t *testing.T, url string) (int, []byte) { t.Fatalf("failed to invoke http request, err: %+v", err) } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { t.Fatalf("failed to read response body, err: %+v", err) } diff --git a/tools/go.mod b/tools/go.mod index b11dc2e1..09706671 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,5 +1,5 @@ module github.com/Azure/kubernetes-kms/tools -go 1.15 +go 1.16 require github.com/golangci/golangci-lint v1.30.0 diff --git a/tools/go.sum b/tools/go.sum index ea8c5cc5..b77c16f7 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -115,7 +115,6 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= @@ -562,7 +561,6 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=