diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 101a5ff08..736eeef5e 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -920,7 +920,7 @@ }, { "ImportPath": "k8s.io/api", - "Rev": "c4b19412b7d9" + "Rev": "c218b228ac09" }, { "ImportPath": "k8s.io/apimachinery", diff --git a/go.mod b/go.mod index 180fb63a6..9a6f74af6 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/stretchr/testify v1.6.1 golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073 gopkg.in/yaml.v2 v2.2.8 - k8s.io/api v0.0.0-20210303224014-c4b19412b7d9 + k8s.io/api v0.0.0-20210304012009-c218b228ac09 k8s.io/apimachinery v0.0.0-20210303224021-086982076e5b k8s.io/cli-runtime v0.0.0-20210304013618-f536d1e57e2c k8s.io/client-go v0.0.0-20210303092632-a33729487127 @@ -48,7 +48,7 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20210303224014-c4b19412b7d9 + k8s.io/api => k8s.io/api v0.0.0-20210304012009-c218b228ac09 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210303224021-086982076e5b k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20210304013618-f536d1e57e2c k8s.io/client-go => k8s.io/client-go v0.0.0-20210303092632-a33729487127 diff --git a/go.sum b/go.sum index ebae1de69..c31aaa3f8 100644 --- a/go.sum +++ b/go.sum @@ -629,7 +629,7 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.0.0-20210303224014-c4b19412b7d9/go.mod h1:qxh9oDzIeshHqWh3cuMICYK1FYe9LYCg1mIgGu4TFGQ= +k8s.io/api v0.0.0-20210304012009-c218b228ac09/go.mod h1:YspOqQmF4OXdACGAs03nGPxRrWe/nIKAS3Cwch9YyFk= k8s.io/apimachinery v0.0.0-20210303224021-086982076e5b/go.mod h1:+s3G/nGQJY9oe1CFOXRrb9QkXTIEgTnFtF8GeKZIgOg= k8s.io/cli-runtime v0.0.0-20210304013618-f536d1e57e2c/go.mod h1:TtZMuW66gOQw/UkzFrUR9nnEBaVTQ9Zk7luH6yayEQ8= k8s.io/client-go v0.0.0-20210303092632-a33729487127/go.mod h1:6J5z3g0yr1utdrepdA0iHThBu/efpfp4kVR65Z3KB4U= diff --git a/pkg/polymorphichelpers/logsforobject.go b/pkg/polymorphichelpers/logsforobject.go index 3c05c2e8b..f6fb24009 100644 --- a/pkg/polymorphichelpers/logsforobject.go +++ b/pkg/polymorphichelpers/logsforobject.go @@ -79,11 +79,15 @@ func logsForObjectWithClient(clientset corev1client.CoreV1Interface, object, opt // container. This gives users ability to preselect the most interesting container in pod. if annotations := t.GetAnnotations(); annotations != nil && len(opts.Container) == 0 { var containerName string - if len(annotations[defaultLogsContainerAnnotationName]) > 0 { + if len(annotations[podutils.DefaultContainerAnnotationName]) > 0 { + containerName = annotations[podutils.DefaultContainerAnnotationName] + } else if len(annotations[defaultLogsContainerAnnotationName]) > 0 { + // Only log deprecation if we have only the old annotation. This allows users to + // set both to support multiple versions of kubectl; if they are setting both + // they must already know it is deprecated, so we don't need to add noisy + // warnings. containerName = annotations[defaultLogsContainerAnnotationName] fmt.Fprintf(os.Stderr, "Using deprecated annotation `kubectl.kubernetes.io/default-logs-container` in pod/%v. Please use `kubectl.kubernetes.io/default-container` instead\n", t.Name) - } else if len(annotations[podutils.DefaultContainerAnnotationName]) > 0 { - containerName = annotations[podutils.DefaultContainerAnnotationName] } if len(containerName) > 0 { if exists, _ := podutils.FindContainerByName(t, containerName); exists != nil {