Skip to content

Commit

Permalink
Update dependencies to Kubernetes v1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ash2k committed May 27, 2021
1 parent d696804 commit 5ecd241
Show file tree
Hide file tree
Showing 19 changed files with 320 additions and 211 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16.4
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ fmt:
go fmt ./...

generate:
(which $(GOPATH)/bin/stringer || go get golang.org/x/tools/cmd/stringer)
(which $(GOPATH)/bin/stringer || go install golang.org/x/tools/cmd/stringer@a3eb095d6aeed806877423d9ef571b9a50ca8a2a) # latest as of 2021-05-27
go generate ./...

license:
(which $(GOPATH)/bin/addlicense || go get github.com/google/addlicense)
(which $(GOPATH)/bin/addlicense || go install github.com/google/addlicense@6d92264d717064f28b32464f0f9693a5b4ef0239) # latest as of 2021-05-27
$(GOPATH)/bin/addlicense -y 2020 -c "The Kubernetes Authors." -f LICENSE_TEMPLATE .

verify-license:
(which $(GOPATH)/bin/addlicense || go get github.com/google/addlicense)
(which $(GOPATH)/bin/addlicense || go install github.com/google/addlicense@6d92264d717064f28b32464f0f9693a5b4ef0239) # latest as of 2021-05-27
$(GOPATH)/bin/addlicense -check .

tidy:
go mod tidy

lint:
(which $(GOPATH)/bin/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.31.0)
(which $(GOPATH)/bin/golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.40.1)
$(GOPATH)/bin/golangci-lint run ./...

test:
Expand All @@ -67,7 +67,7 @@ build-with-race-detector:
verify-kapply-e2e: test-examples-e2e-kapply

$(MYGOBIN)/ginkgo:
go get github.com/onsi/ginkgo/ginkgo@v1.14.2
go install github.com/onsi/ginkgo/ginkgo@v1.16.2

$(MYGOBIN)/mdrip:
go install github.com/monopole/[email protected]
Expand All @@ -84,7 +84,7 @@ test-examples-e2e-kapply: $(MYGOBIN)/mdrip $(MYGOBIN)/kind
)

$(MYGOBIN)/kind:
go get sigs.k8s.io/kind@v0.9.0
go install sigs.k8s.io/kind@v0.11.0

.PHONY: nuke
nuke: clean
Expand Down
2 changes: 1 addition & 1 deletion cmd/diff/cmddiff.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/cli-runtime/pkg/resource"
"k8s.io/klog"
"k8s.io/klog/v2"
"k8s.io/kubectl/pkg/cmd/diff"
"k8s.io/kubectl/pkg/cmd/util"
"k8s.io/kubectl/pkg/util/i18n"
Expand Down
2 changes: 1 addition & 1 deletion cmd/printers/table/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sort"
"sync"

"k8s.io/klog"
"k8s.io/klog/v2"
"sigs.k8s.io/cli-utils/pkg/apply/event"
pe "sigs.k8s.io/cli-utils/pkg/kstatus/polling/event"
"sigs.k8s.io/cli-utils/pkg/kstatus/status"
Expand Down
39 changes: 18 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,25 @@ module sigs.k8s.io/cli-utils
go 1.16

require (
github.com/go-errors/errors v1.0.1
github.com/go-logr/logr v0.3.0 // indirect
github.com/google/uuid v1.1.2
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.10.1
github.com/go-errors/errors v1.4.0
github.com/google/uuid v1.2.0
github.com/onsi/ginkgo v1.16.2
github.com/onsi/gomega v1.12.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.6.1
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.7.0
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776
gotest.tools v2.2.0+incompatible
k8s.io/api v0.20.4
k8s.io/apiextensions-apiserver v0.18.10
k8s.io/apimachinery v0.20.4
k8s.io/cli-runtime v0.20.4
k8s.io/client-go v0.20.4
k8s.io/klog v1.0.0
k8s.io/kubectl v0.20.4
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
sigs.k8s.io/controller-runtime v0.6.0
sigs.k8s.io/kustomize/kyaml v0.10.16
k8s.io/api v0.21.1
k8s.io/apiextensions-apiserver v0.21.1
k8s.io/apimachinery v0.21.1
k8s.io/cli-runtime v0.21.1
k8s.io/client-go v0.21.1
k8s.io/klog/v2 v2.9.0
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
k8s.io/kubectl v0.21.1
k8s.io/utils v0.0.0-20210517184530-5a248b5acedc
sigs.k8s.io/controller-runtime v0.9.0-beta.5.0.20210524185538-7181f1162e79
sigs.k8s.io/kustomize/kyaml v0.10.17
sigs.k8s.io/yaml v1.2.0
)
423 changes: 268 additions & 155 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/apply/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/go-errors/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/klog"
"k8s.io/klog/v2"
"sigs.k8s.io/cli-utils/pkg/apply/event"
"sigs.k8s.io/cli-utils/pkg/apply/info"
"sigs.k8s.io/cli-utils/pkg/apply/poller"
Expand Down
8 changes: 4 additions & 4 deletions pkg/apply/prune/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/dynamic"
"k8s.io/klog"
"k8s.io/klog/v2"
"k8s.io/kubectl/pkg/cmd/util"
"sigs.k8s.io/cli-utils/pkg/apply/event"
"sigs.k8s.io/cli-utils/pkg/apply/taskrunner"
Expand Down Expand Up @@ -133,7 +133,7 @@ func (po *PruneOptions) Prune(localInv inventory.InventoryInfo,
pruneObj.Namespace, pruneObj.Name)
continue
}
if klog.V(5) {
if klog.V(5).Enabled() {
klog.Errorf("prune obj (%s/%s) UID retrival error: %s",
pruneObj.Namespace, pruneObj.Name, err)
}
Expand Down Expand Up @@ -169,7 +169,7 @@ func (po *PruneOptions) Prune(localInv inventory.InventoryInfo,
klog.V(4).Infof("prune object delete: %s/%s", pruneObj.Namespace, pruneObj.Name)
namespacedClient, err := po.namespacedClient(pruneObj)
if err != nil {
if klog.V(4) {
if klog.V(4).Enabled() {
klog.Errorf("prune failed for %s/%s (%s)", pruneObj.Namespace, pruneObj.Name, err)
}
taskContext.EventChannel() <- createPruneFailedEvent(pruneObj, err)
Expand All @@ -178,7 +178,7 @@ func (po *PruneOptions) Prune(localInv inventory.InventoryInfo,
}
err = namespacedClient.Delete(context.TODO(), pruneObj.Name, metav1.DeleteOptions{})
if err != nil {
if klog.V(4) {
if klog.V(4).Enabled() {
klog.Errorf("prune failed for %s/%s (%s)", pruneObj.Namespace, pruneObj.Name, err)
}
taskContext.EventChannel() <- createPruneFailedEvent(pruneObj, err)
Expand Down
10 changes: 5 additions & 5 deletions pkg/apply/task/apply_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/cli-runtime/pkg/resource"
"k8s.io/client-go/dynamic"
"k8s.io/klog"
"k8s.io/klog/v2"
"k8s.io/kubectl/pkg/cmd/apply"
cmddelete "k8s.io/kubectl/pkg/cmd/delete"
"k8s.io/kubectl/pkg/cmd/util"
Expand Down Expand Up @@ -133,7 +133,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
ao, dynamic, err := applyOptionsFactoryFunc(taskContext.EventChannel(),
a.ServerSideOptions, a.DryRunStrategy, a.Factory)
if err != nil {
if klog.V(4) {
if klog.V(4).Enabled() {
klog.Errorf("error creating ApplyOptions (%s)--returning", err)
}
sendBatchApplyEvents(taskContext, objects, err)
Expand All @@ -150,7 +150,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
info, err := a.InfoHelper.BuildInfo(obj)
id := object.UnstructuredToObjMeta(obj)
if err != nil {
if klog.V(4) {
if klog.V(4).Enabled() {
klog.Errorf("unable to convert obj to info for %s/%s (%s)--continue",
obj.GetNamespace(), obj.GetName(), err)
}
Expand All @@ -163,7 +163,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
clusterObj, err := getClusterObj(dynamic, info)
if err != nil {
if !apierrors.IsNotFound(err) {
if klog.V(4) {
if klog.V(4).Enabled() {
klog.Errorf("error (%s) retrieving %s/%s from cluster--continue",
err, info.Namespace, info.Name)
}
Expand Down Expand Up @@ -206,7 +206,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
err = clientSideApply(info, taskContext.EventChannel(), a.DryRunStrategy, a.Factory)
}
if err != nil {
if klog.V(4) {
if klog.V(4).Enabled() {
klog.Errorf("error applying (%s/%s) %s", info.Namespace, info.Name, err)
}
// If apply failed and the object is not in the cluster, remove
Expand Down
2 changes: 1 addition & 1 deletion pkg/apply/task/inv_add_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package task
import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/klog"
"k8s.io/klog/v2"
"sigs.k8s.io/cli-utils/pkg/apply/event"
"sigs.k8s.io/cli-utils/pkg/apply/taskrunner"
"sigs.k8s.io/cli-utils/pkg/inventory"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apply/task/inv_set_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package task

import (
"k8s.io/klog"
"k8s.io/klog/v2"
"sigs.k8s.io/cli-utils/pkg/apply/event"
"sigs.k8s.io/cli-utils/pkg/apply/taskrunner"
"sigs.k8s.io/cli-utils/pkg/inventory"
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"path/filepath"

"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/klog"
"k8s.io/klog/v2"
"sigs.k8s.io/kustomize/kyaml/kio"
"sigs.k8s.io/kustomize/kyaml/kio/kioutil"
"sigs.k8s.io/kustomize/kyaml/yaml"
Expand Down
8 changes: 4 additions & 4 deletions pkg/common/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ metadata:
name: test-pod-label
spec:
containers:
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0
`)

var podB = []byte(`
Expand All @@ -93,8 +93,8 @@ metadata:
name: test-pod-label
spec:
containers:
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0
`)

func buildMultiResourceConfig(configs ...[]byte) []byte {
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/initoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/google/uuid"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/klog"
"k8s.io/klog/v2"
cmdutil "k8s.io/kubectl/pkg/cmd/util"
"sigs.k8s.io/cli-utils/pkg/common"
"sigs.k8s.io/cli-utils/pkg/inventory/configmap"
Expand Down
2 changes: 1 addition & 1 deletion pkg/inventory/inventory-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/cli-runtime/pkg/resource"
"k8s.io/klog"
"k8s.io/klog/v2"
cmdutil "k8s.io/kubectl/pkg/cmd/util"
"k8s.io/kubectl/pkg/util"
"k8s.io/kubectl/pkg/validation"
Expand Down
2 changes: 1 addition & 1 deletion pkg/inventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/klog"
"k8s.io/klog/v2"
"sigs.k8s.io/cli-utils/pkg/common"
"sigs.k8s.io/cli-utils/pkg/object"
)
Expand Down
5 changes: 2 additions & 3 deletions pkg/kstatus/polling/clusterreader/caching_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/cli-utils/pkg/object"
"sigs.k8s.io/cli-utils/pkg/testutil"
Expand Down Expand Up @@ -202,12 +201,12 @@ type fakeReader struct {
err error
}

func (f *fakeReader) Get(_ context.Context, _ client.ObjectKey, _ runtime.Object) error {
func (f *fakeReader) Get(_ context.Context, _ client.ObjectKey, _ client.Object) error {
return nil
}

//nolint:gocritic
func (f *fakeReader) List(_ context.Context, list runtime.Object, opts ...client.ListOption) error {
func (f *fakeReader) List(_ context.Context, list client.ObjectList, opts ...client.ListOption) error {
var namespace string
for _, opt := range opts {
switch opt := opt.(type) {
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-everything.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ function fetch_kb_tools {

# Install metalinter
function install_metalinter {
which gometalinter.v2 || go get -v -u gopkg.in/alecthomas/gometalinter.v2
which gometalinter.v2 || go install gopkg.in/alecthomas/gometalinter.v2
}


# # Install wire
# function install_wire {
# which wire|| go get -v -u github.com/google/wire/cmd/wire
# which wire|| go install github.com/google/wire/cmd/wire
# }

# header_text "using tools"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func newFactory() util.Factory {
}

func customInvSizeVerifyFunc(c client.Client, name, namespace, _ string, count int) {
var u unstructured.UnstructuredList
var u unstructured.Unstructured
u.SetGroupVersionKind(customprovider.InventoryGVK)
err := c.Get(context.TODO(), types.NamespacedName{
Name: name,
Expand Down

0 comments on commit 5ecd241

Please sign in to comment.