diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b8857d6e2..a33c1717f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ env: E2E_SETUP_KUBECTL: yes SUDO: sudo GO_VERSION: "^1.20" - GOLANGCI_LINT_VERSION: "v1.53.3" + GOLANGCI_LINT_VERSION: "v1.54.2" jobs: ci-go-lint: diff --git a/Makefile b/Makefile index d2805eb0d3..38c8f9e5a3 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,8 @@ GIT_COMMIT ?= $(shell git rev-parse --short HEAD) OS ?= $(shell uname -s | tr A-Z a-z) ALL_ARCH = amd64 arm arm64 ppc64le s390x PKG = github.com/prometheus/common -PROMETHEUS_VERSION = 2.45.0 -GO_VERSION = 1.20.6 +PROMETHEUS_VERSION = 2.46.0 +GO_VERSION = 1.20.7 IMAGE = $(REGISTRY)/kube-state-metrics MULTI_ARCH_IMG = $(IMAGE)-$(ARCH) USER ?= $(shell id -u -n) diff --git a/go.mod b/go.mod index 30db0c471d..3711921fb6 100644 --- a/go.mod +++ b/go.mod @@ -17,13 +17,13 @@ require ( github.com/spf13/viper v1.16.0 github.com/stretchr/testify v1.8.4 gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.27.4 - k8s.io/apimachinery v0.27.4 - k8s.io/client-go v0.27.4 - k8s.io/component-base v0.27.4 + k8s.io/api v0.27.5 + k8s.io/apimachinery v0.27.5 + k8s.io/client-go v0.27.5 + k8s.io/component-base v0.27.5 k8s.io/klog/v2 v2.100.1 - k8s.io/sample-controller v0.27.4 - k8s.io/utils v0.0.0-20230711102312-30195339c3c7 + k8s.io/sample-controller v0.27.5 + k8s.io/utils v0.0.0-20230726121419-3b25d923346b ) require ( diff --git a/go.sum b/go.sum index c5e74ce254..d852989b43 100644 --- a/go.sum +++ b/go.sum @@ -606,22 +606,22 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh 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= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.27.4 h1:0pCo/AN9hONazBKlNUdhQymmnfLRbSZjd5H5H3f0bSs= -k8s.io/api v0.27.4/go.mod h1:O3smaaX15NfxjzILfiln1D8Z3+gEYpjEpiNA/1EVK1Y= -k8s.io/apimachinery v0.27.4 h1:CdxflD4AF61yewuid0fLl6bM4a3q04jWel0IlP+aYjs= -k8s.io/apimachinery v0.27.4/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= -k8s.io/client-go v0.27.4 h1:vj2YTtSJ6J4KxaC88P4pMPEQECWMY8gqPqsTgUKzvjk= -k8s.io/client-go v0.27.4/go.mod h1:ragcly7lUlN0SRPk5/ZkGnDjPknzb37TICq07WhI6Xc= -k8s.io/component-base v0.27.4 h1:Wqc0jMKEDGjKXdae8hBXeskRP//vu1m6ypC+gwErj4c= -k8s.io/component-base v0.27.4/go.mod h1:hoiEETnLc0ioLv6WPeDt8vD34DDeB35MfQnxCARq3kY= +k8s.io/api v0.27.5 h1:49hIzqJNSuOQpA53MMihgAS4YDcQitTy58B9PMFthLc= +k8s.io/api v0.27.5/go.mod h1:zjBZB+c0KDU55Wxb9Bob9WZGxu9zdKHitzHxBtaIVoA= +k8s.io/apimachinery v0.27.5 h1:6Q5HBXYJJPisd6yDVAprLe6FQsmw7a7Cu69dcrpQET8= +k8s.io/apimachinery v0.27.5/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/client-go v0.27.5 h1:sH/fkqzk35kuf0GPx+dZuN7fhEswBSAVCrWFq3E1km0= +k8s.io/client-go v0.27.5/go.mod h1:u+IKnqPZSPw51snIMKiIAV8LQQ+hya5bvxpOOPTUXPI= +k8s.io/component-base v0.27.5 h1:IXo80yOVx7qXG2g1loPpo2g1HUK3CnxNpq9LtGmXAmM= +k8s.io/component-base v0.27.5/go.mod h1:AGJyFHmaxplY4C4lu18UrJBNHcxdv0o6jOL/+HcC0S0= k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= -k8s.io/sample-controller v0.27.4 h1:oeKVVOWw+fVaZVWCw3l9myrAoNUqR8A4BcA91fyyZaU= -k8s.io/sample-controller v0.27.4/go.mod h1:bfGT2cEyzWjfCqVSrWPbNsym9MkgKz7Z7Bwl0tjysOo= -k8s.io/utils v0.0.0-20230711102312-30195339c3c7 h1:ZgnF1KZsYxWIifwSNZFZgNtWE89WI5yiP5WwlfDoIyc= -k8s.io/utils v0.0.0-20230711102312-30195339c3c7/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/sample-controller v0.27.5 h1:N3mMPdEFJ8gdn7HMCIecnTU7h6YVfVJjSDt72nxAocc= +k8s.io/sample-controller v0.27.5/go.mod h1:KtTxV9H5DpvbU5WpM2o/Cpv/fuZykJhqBqCJdNfFRpg= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/internal/store/cronjob.go b/internal/store/cronjob.go index 5c1465381c..1450f70c4c 100644 --- a/internal/store/cronjob.go +++ b/internal/store/cronjob.go @@ -36,7 +36,7 @@ import ( ) var ( - descCronJobAnnotationsName = "kube_cronjob_annotations" + descCronJobAnnotationsName = "kube_cronjob_annotations" //nolint:gosec descCronJobAnnotationsHelp = "Kubernetes annotations converted to Prometheus labels." descCronJobLabelsName = "kube_cronjob_labels" descCronJobLabelsHelp = "Kubernetes labels converted to Prometheus labels." diff --git a/internal/store/ingress.go b/internal/store/ingress.go index 1d27f72a25..be98e25aa1 100644 --- a/internal/store/ingress.go +++ b/internal/store/ingress.go @@ -34,7 +34,7 @@ import ( ) var ( - descIngressAnnotationsName = "kube_ingress_annotations" + descIngressAnnotationsName = "kube_ingress_annotations" //nolint:gosec descIngressAnnotationsHelp = "Kubernetes annotations converted to Prometheus labels." descIngressLabelsName = "kube_ingress_labels" descIngressLabelsHelp = "Kubernetes labels converted to Prometheus labels." diff --git a/internal/store/ingressclass.go b/internal/store/ingressclass.go index 0aaa8e13e2..ec7a0f7d71 100644 --- a/internal/store/ingressclass.go +++ b/internal/store/ingressclass.go @@ -32,7 +32,7 @@ import ( var ( descIngressClassAnnotationsName = "kube_ingressclass_annotations" descIngressClassAnnotationsHelp = "Kubernetes annotations converted to Prometheus labels." - descIngressClassLabelsName = "kube_ingressclass_labels" + descIngressClassLabelsName = "kube_ingressclass_labels" //nolint:gosec descIngressClassLabelsHelp = "Kubernetes labels converted to Prometheus labels." descIngressClassLabelsDefaultLabels = []string{"ingressclass"} ) diff --git a/internal/store/persistentvolume_test.go b/internal/store/persistentvolume_test.go index b4e0e15f74..4ff4750d72 100644 --- a/internal/store/persistentvolume_test.go +++ b/internal/store/persistentvolume_test.go @@ -23,7 +23,7 @@ import ( v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" generator "k8s.io/kube-state-metrics/v2/pkg/metric_generator" ) @@ -415,7 +415,7 @@ func TestPersistentVolumeStore(t *testing.T) { Spec: v1.PersistentVolumeSpec{ PersistentVolumeSource: v1.PersistentVolumeSource{ Local: &v1.LocalVolumeSource{ - FSType: pointer.String("ext4"), + FSType: ptr.To("ext4"), Path: "/mnt/data", }, }, diff --git a/internal/store/serviceaccount_test.go b/internal/store/serviceaccount_test.go index 1223a5b6af..d6d9df3b32 100644 --- a/internal/store/serviceaccount_test.go +++ b/internal/store/serviceaccount_test.go @@ -22,7 +22,7 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" generator "k8s.io/kube-state-metrics/v2/pkg/metric_generator" ) @@ -38,7 +38,7 @@ func TestServiceAccountStore(t *testing.T) { Namespace: "serviceAccountNS", UID: "serviceAccountUID", }, - AutomountServiceAccountToken: pointer.Bool(true), + AutomountServiceAccountToken: ptr.To(true), Secrets: []v1.ObjectReference{ { APIVersion: "v1", diff --git a/pkg/customresourcestate/custom_resource_metrics_test.go b/pkg/customresourcestate/custom_resource_metrics_test.go index e62e333c1c..928f668ddd 100644 --- a/pkg/customresourcestate/custom_resource_metrics_test.go +++ b/pkg/customresourcestate/custom_resource_metrics_test.go @@ -22,7 +22,7 @@ import ( "testing" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" ) func TestNewCustomResourceMetrics(t *testing.T) { @@ -130,7 +130,7 @@ func TestNewCustomResourceMetrics(t *testing.T) { }, }, }, - MetricNamePrefix: pointer.String("apps_deployment"), + MetricNamePrefix: ptr.To("apps_deployment"), }, wantErr: false, wantResult: &customResourceMetrics{ @@ -193,7 +193,7 @@ func TestNewCustomResourceMetrics(t *testing.T) { }, }, }, - MetricNamePrefix: pointer.String("apps_deployment"), + MetricNamePrefix: ptr.To("apps_deployment"), }, wantErr: true, wantResult: &customResourceMetrics{ diff --git a/pkg/customresourcestate/registry_factory_test.go b/pkg/customresourcestate/registry_factory_test.go index 3d53c696fd..a0432ec0bd 100644 --- a/pkg/customresourcestate/registry_factory_test.go +++ b/pkg/customresourcestate/registry_factory_test.go @@ -23,7 +23,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "k8s.io/kube-state-metrics/v2/pkg/metric" ) @@ -454,7 +454,7 @@ func Test_fullName(t *testing.T) { { name: "no prefix", args: args{ - resource: r(pointer.String("")), + resource: r(ptr.To("")), f: count, }, want: "count", @@ -462,7 +462,7 @@ func Test_fullName(t *testing.T) { { name: "custom", args: args{ - resource: r(pointer.String("bar_baz")), + resource: r(ptr.To("bar_baz")), f: count, }, want: "bar_baz_count", diff --git a/pkg/options/types_test.go b/pkg/options/types_test.go index 3ccaf4c0e4..a1b43a2c0b 100644 --- a/pkg/options/types_test.go +++ b/pkg/options/types_test.go @@ -109,8 +109,8 @@ func TestNamespaceList_GetNamespaces(t *testing.T) { }, } - for _, test := range tests { - ns := &test.Namespaces + for i, test := range tests { + ns := &tests[i].Namespaces allowedNamespaces := ns.GetNamespaces() if !reflect.DeepEqual(allowedNamespaces, test.Wanted) { t.Errorf("Test error for Desc: %s. Want: %+v. Got: %+v.", test.Desc, test.Wanted, allowedNamespaces) diff --git a/tests/e2e.sh b/tests/e2e.sh index 074b94825e..a033d56563 100755 --- a/tests/e2e.sh +++ b/tests/e2e.sh @@ -30,7 +30,7 @@ KUBE_STATE_METRICS_CURRENT_IMAGE_NAME="registry.k8s.io/kube-state-metrics/kube-s KUBE_STATE_METRICS_IMAGE_NAME="registry.k8s.io/kube-state-metrics/kube-state-metrics-${ARCH}" E2E_SETUP_KIND=${E2E_SETUP_KIND:-} E2E_SETUP_KUBECTL=${E2E_SETUP_KUBECTL:-} -KIND_VERSION=v0.19.0 +KIND_VERSION=v0.20.0 SUDO=${SUDO:-} OS=$(uname -s | awk '{print tolower($0)}') diff --git a/tools/go.mod b/tools/go.mod index 475d136c78..fc3d5df0ac 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -7,7 +7,7 @@ require ( github.com/campoy/embedmd v1.0.0 github.com/google/go-jsonnet v0.20.0 github.com/jsonnet-bundler/jsonnet-bundler v0.5.1 - golang.org/x/perf v0.0.0-20230427221525-d343f6398b76 + golang.org/x/perf v0.0.0-20230822165715-3c60af34b3f4 ) require ( diff --git a/tools/go.sum b/tools/go.sum index 670ee4fc44..81c074d1a7 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -114,8 +114,8 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20170207211851-4464e7848382/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/perf v0.0.0-20230427221525-d343f6398b76 h1:cPGZx8Liyx5Pq/yX80/6WMKe2yidT0xvVCQBOGa8WHU= -golang.org/x/perf v0.0.0-20230427221525-d343f6398b76/go.mod h1:UBKtEnL8aqnd+0JHqZ+2qoMDwtuy6cYhhKNoHLBiTQc= +golang.org/x/perf v0.0.0-20230822165715-3c60af34b3f4 h1:ua24l69kDXo72PNOVfgBXbbwGyV322MjcIBBV5ExoYA= +golang.org/x/perf v0.0.0-20230822165715-3c60af34b3f4/go.mod h1:UBKtEnL8aqnd+0JHqZ+2qoMDwtuy6cYhhKNoHLBiTQc= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=