diff --git a/LICENSE-3rdparty.csv b/LICENSE-3rdparty.csv index 8f5cc1be5f227..1454e250f3573 100644 --- a/LICENSE-3rdparty.csv +++ b/LICENSE-3rdparty.csv @@ -2172,6 +2172,8 @@ core,k8s.io/api/storage/v1beta1,Apache-2.0,Copyright 2014 The Kubernetes Authors core,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions,Apache-2.0,Copyright 2014 The Kubernetes Authors. core,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,Apache-2.0,Copyright 2014 The Kubernetes Authors. core,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1,Apache-2.0,Copyright 2014 The Kubernetes Authors. +core,k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1,Apache-2.0,Copyright 2014 The Kubernetes Authors. +core,k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1,Apache-2.0,Copyright 2014 The Kubernetes Authors. core,k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset,Apache-2.0,Copyright 2014 The Kubernetes Authors. core,k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme,Apache-2.0,Copyright 2014 The Kubernetes Authors. core,k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1,Apache-2.0,Copyright 2014 The Kubernetes Authors. diff --git a/go.mod b/go.mod index 2fa1b38f52342..03a0fb5bbfe82 100644 --- a/go.mod +++ b/go.mod @@ -225,20 +225,20 @@ require ( gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 - k8s.io/api v0.27.2 - k8s.io/apiextensions-apiserver v0.27.2 - k8s.io/apimachinery v0.27.2 - k8s.io/apiserver v0.27.2 - k8s.io/autoscaler/vertical-pod-autoscaler v0.12.0 - k8s.io/client-go v0.27.2 - k8s.io/cri-api v0.27.1 // Cannot be upgraded to 0.26 without losing CRI API v1alpha2 + k8s.io/api v0.27.6 + k8s.io/apiextensions-apiserver v0.27.6 + k8s.io/apimachinery v0.27.6 + k8s.io/apiserver v0.27.6 + k8s.io/autoscaler/vertical-pod-autoscaler v0.13.0 + k8s.io/client-go v0.27.6 + k8s.io/cri-api v0.27.2 k8s.io/klog v1.0.1-0.20200310124935-4ad0115ba9e4 // Min version that includes fix for Windows Nano k8s.io/klog/v2 v2.100.1 - k8s.io/kube-aggregator v0.27.2 + k8s.io/kube-aggregator v0.27.6 k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f - k8s.io/kube-state-metrics/v2 v2.9.2 - k8s.io/kubelet v0.27.2 - k8s.io/metrics v0.27.2 + k8s.io/kube-state-metrics/v2 v2.8.2 + k8s.io/kubelet v0.27.6 + k8s.io/metrics v0.27.6 k8s.io/utils v0.0.0-20230505201702-9f6742963106 sigs.k8s.io/custom-metrics-apiserver v1.27.0 ) @@ -535,7 +535,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - k8s.io/component-base v0.27.2 // indirect + k8s.io/component-base v0.27.6 k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect lukechampine.com/uint128 v1.2.0 // indirect mellium.im/sasl v0.3.1 // indirect @@ -587,14 +587,14 @@ require ( github.com/emicklei/go-restful/v3 v3.10.2 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/godror/knownpb v0.1.0 // indirect - github.com/google/cel-go v0.12.6 // indirect + github.com/google/cel-go v0.12.7 // indirect github.com/google/gnostic v0.6.9 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/hashicorp/hcl/v2 v2.17.0 // indirect github.com/knadh/koanf/v2 v2.0.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/zerolog v1.29.1 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sigstore/rekor v1.2.2 // indirect @@ -627,7 +627,7 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect honnef.co/go/tools v0.3.2 // indirect inet.af/netaddr v0.0.0-20220811202034-502d2d690317 // indirect - k8s.io/kms v0.27.2 // indirect + k8s.io/kms v0.27.6 // indirect ) replace github.com/pahanini/go-grpc-bidirectional-streaming-example v0.0.0-20211027164128-cc6111af44be => github.com/DataDog/go-grpc-bidirectional-streaming-example v0.0.0-20221024060302-b9cf785c02fe @@ -637,11 +637,6 @@ replace github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt v3.2.1+incompat replace github.com/vishvananda/netlink => github.com/DataDog/netlink v1.0.1-0.20230703150631-f11d5ab05838 -// Replace kube-state-metrics repo until https://github.com/kubernetes/kube-state-metrics/pull/1994 is merged and cherry-pick on v2.7.1 -// Else we will need to wait v2.9.0 release. -// the current version corresponds to the `dd-release-2.7` branch -replace k8s.io/kube-state-metrics/v2 => github.com/datadog/kube-state-metrics/v2 v2.2.2-0.20230217083638-a9a9c0ff16f4 - // Cannot be upgraded to 0.26 without lossing CRI API v1alpha2 replace k8s.io/cri-api => k8s.io/cri-api v0.25.5 diff --git a/go.sum b/go.sum index 9fbb21e9403ea..3ca7fbde66452 100644 --- a/go.sum +++ b/go.sum @@ -471,8 +471,6 @@ github.com/cri-o/ocicni v0.4.0/go.mod h1:/L2k9zk6l2O1FbE4xY1qTqSWJBqobOvsoYlkghI github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -github.com/datadog/kube-state-metrics/v2 v2.2.2-0.20230217083638-a9a9c0ff16f4 h1:ykrwvGAIsQrMVxl1YD2u23C62q/wsdPiSdWo8EUMRk0= -github.com/datadog/kube-state-metrics/v2 v2.2.2-0.20230217083638-a9a9c0ff16f4/go.mod h1:1XUV6TkXSy78Ds3QKe5k/6J+YzqB/KZnc3uGTmCAwMo= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -767,8 +765,8 @@ github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= -github.com/google/cel-go v0.12.6 h1:kjeKudqV0OygrAqA9fX6J55S8gj+Jre2tckIm5RoG4M= -github.com/google/cel-go v0.12.6/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw= +github.com/google/cel-go v0.12.7 h1:jM6p55R0MKBg79hZjn1zs2OlrywZ1Vk00rxVvad1/O0= +github.com/google/cel-go v0.12.7/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw= github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= @@ -1395,8 +1393,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= @@ -2403,21 +2401,21 @@ honnef.co/go/tools v0.3.2 h1:ytYb4rOqyp1TSa2EPvNVwtPQJctSELKaMyLfqNP4+34= honnef.co/go/tools v0.3.2/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= inet.af/netaddr v0.0.0-20220811202034-502d2d690317 h1:U2fwK6P2EqmopP/hFLTOAjWTki0qgd4GMJn5X8wOleU= inet.af/netaddr v0.0.0-20220811202034-502d2d690317/go.mod h1:OIezDfdzOgFhuw4HuWapWq2e9l0H9tK4F1j+ETRtF3k= -k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= -k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= -k8s.io/apiextensions-apiserver v0.27.2 h1:iwhyoeS4xj9Y7v8YExhUwbVuBhMr3Q4bd/laClBV6Bo= -k8s.io/apiextensions-apiserver v0.27.2/go.mod h1:Oz9UdvGguL3ULgRdY9QMUzL2RZImotgxvGjdWRq6ZXQ= -k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= -k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= -k8s.io/apiserver v0.27.2 h1:p+tjwrcQEZDrEorCZV2/qE8osGTINPuS5ZNqWAvKm5E= -k8s.io/apiserver v0.27.2/go.mod h1:EsOf39d75rMivgvvwjJ3OW/u9n1/BmUMK5otEOJrb1Y= -k8s.io/autoscaler/vertical-pod-autoscaler v0.12.0 h1:cy8LoXSl5GkTNJDTx3ZCS143f9Ai7gqnGkoUxPlGSmI= -k8s.io/autoscaler/vertical-pod-autoscaler v0.12.0/go.mod h1:LraL5kR2xX7jb4VMCG6/tUH4I75uRHlnzC0VWQHcyWk= +k8s.io/api v0.27.6 h1:PBWu/lywJe2qQcshMjubzcBg7+XDZOo7O8JJAWuYtUo= +k8s.io/api v0.27.6/go.mod h1:AQYj0UsFCp3qJE7bOVnUuy4orCsXVkvHefnbYQiNWgk= +k8s.io/apiextensions-apiserver v0.27.6 h1:mOwSBJtThZhpJr+8gEkc3wFDIjq87E3JspR5mtZxIg8= +k8s.io/apiextensions-apiserver v0.27.6/go.mod h1:AVNlLYRrESG5Poo6ASRUhY2pvoKPcNt8y/IuZ4lx3o8= +k8s.io/apimachinery v0.27.6 h1:mGU8jmBq5o8mWBov+mLjdTBcU+etTE19waies4AQ6NE= +k8s.io/apimachinery v0.27.6/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/apiserver v0.27.6 h1:r/eHN8r3lG2buggHrVMy++kKhHlHn1HWSX1dqDtes54= +k8s.io/apiserver v0.27.6/go.mod h1:Xeo9OEXn2kDLK5pqspjdXQx7YKgDyKSpwIB4p0BmpAQ= +k8s.io/autoscaler/vertical-pod-autoscaler v0.13.0 h1:pH6AsxeBZcyX6KBqcnl7SPIJqbN1d59RrEBuIE6Rq6c= +k8s.io/autoscaler/vertical-pod-autoscaler v0.13.0/go.mod h1:LraL5kR2xX7jb4VMCG6/tUH4I75uRHlnzC0VWQHcyWk= k8s.io/cli-runtime v0.25.3 h1:Zs7P7l7db/5J+KDePOVtDlArAa9pZXaDinGWGZl0aM8= -k8s.io/client-go v0.27.2 h1:vDLSeuYvCHKeoQRhCXjxXO45nHVv2Ip4Fe0MfioMrhE= -k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ= -k8s.io/component-base v0.27.2 h1:neju+7s/r5O4x4/txeUONNTS9r1HsPbyoPBAtHsDCpo= -k8s.io/component-base v0.27.2/go.mod h1:5UPk7EjfgrfgRIuDBFtsEFAe4DAvP3U+M8RTzoSJkpo= +k8s.io/client-go v0.27.6 h1:vzI8804gpUtpMCNaFjIFyJrifH7u//LJCJPy8fQuYQg= +k8s.io/client-go v0.27.6/go.mod h1:PMsXcDKiJTW7PHJ64oEsIUJF319wm+EFlCj76oE5QXM= +k8s.io/component-base v0.27.6 h1:hF5WxX7Tpi9/dXAbLjPVkIA6CA6Pi6r9JOHyo0uCDYI= +k8s.io/component-base v0.27.6/go.mod h1:NvjLtaneUeb0GgMPpCBF+4LNB9GuhDHi16uUTjBhQfU= k8s.io/cri-api v0.25.5 h1:k/VYZpkDI4VEb5nI4uWE/ZHO08b1D/m5/EXv1weXgtM= k8s.io/cri-api v0.25.5/go.mod h1:fg+6ctfBFAUYnKfjmYqUVXwq6A788L0ZvNooI405Nek= k8s.io/gengo v0.0.0-20220902162205-c0856e24416d h1:U9tB195lKdzwqicbJvyJeOXV7Klv+wNAWENRnXEGi08= @@ -2427,17 +2425,19 @@ k8s.io/klog v1.0.1-0.20200310124935-4ad0115ba9e4/go.mod h1:4Bi6QPql/J/LkTDqv7R/c k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/kms v0.27.2 h1:wCdmPCa3kubcVd3AssOeaVjLQSu45k5g/vruJ3iqwDU= -k8s.io/kms v0.27.2/go.mod h1:dahSqjI05J55Fo5qipzvHSRbm20d7llrSeQjjl86A7c= -k8s.io/kube-aggregator v0.27.2 h1:jfHoPip+qN/fn3OcrYs8/xMuVYvkJHKo0H0DYciqdns= -k8s.io/kube-aggregator v0.27.2/go.mod h1:mwrTt4ESjQ7A6847biwohgZWn8P/KzSFHegEScbSGY4= +k8s.io/kms v0.27.6 h1:0IWDsxoget7Gs4zzMAY+y7dwNaGvwlAvS2XQVuFECU0= +k8s.io/kms v0.27.6/go.mod h1:9YQuCFa+n88RWokHkl+4RHFQ9DATSip/ihBqxlDUBuw= +k8s.io/kube-aggregator v0.27.6 h1:X6SlAHKu5qhabCPvKk9AK5HqJ4kHjIp8T1jTc4gIa5k= +k8s.io/kube-aggregator v0.27.6/go.mod h1:49vSYFfW3hYwFN40v1fxMJwWo86VPADxs18kbfHsp0Q= 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/kube-state-metrics/v2 v2.8.2 h1:P/9wJF26kkCF3Iy52e+MFijjeCAFtqNLFvpKJW5+CR8= +k8s.io/kube-state-metrics/v2 v2.8.2/go.mod h1:kulGw0iSIvo1cjWdDExkeGW1muV/OV4C2TZOaHxqvyc= k8s.io/kubectl v0.25.3 h1:HnWJziEtmsm4JaJiKT33kG0kadx68MXxUE8UEbXnN4U= -k8s.io/kubelet v0.27.2 h1:vpJnBkqQjxItEhehKG0toXoZ+G+tf4UXAOqtMJy6qgc= -k8s.io/kubelet v0.27.2/go.mod h1:1SVrHaLnuw53nQJx8036k9HjE0teDXZtbN51cYC0HSc= -k8s.io/metrics v0.27.2 h1:TD6z3dhhN9bgg5YkbTh72bPiC1BsxipBLPBWyC3VQAU= -k8s.io/metrics v0.27.2/go.mod h1:v3OT7U0DBvoAzWVzGZWQhdV4qsRJWchzs/LeVN8bhW4= +k8s.io/kubelet v0.27.6 h1:zh3xknclUEp0a3zLVM9GxCDFownh+EpxYNcX30fMvi0= +k8s.io/kubelet v0.27.6/go.mod h1:X9ZcgmOR6/I42slO2Lxd+F8WAO7TXS6UHYyobTDUPzE= +k8s.io/metrics v0.27.6 h1:M+Ix1WicmfzTn/1LPix9fKKhxEN+/88jdlu1fvmbLec= +k8s.io/metrics v0.27.6/go.mod h1:rM5f+jbcPHj7kNgL0M5dR85KzehH7XTFv74Dou1YIIE= k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU= k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/apiservice.go b/pkg/collector/corechecks/cluster/ksm/customresources/apiservice.go index 9c39b942ab4e2..df4a8ce7b6af8 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/apiservice.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/apiservice.go @@ -16,6 +16,7 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + basemetrics "k8s.io/component-base/metrics" v1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" apiregistrationclient "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/typed/apiregistration/v1" "k8s.io/kube-state-metrics/v2/pkg/customresource" @@ -52,10 +53,11 @@ func (f *apiserviceFactory) Name() string { func (f *apiserviceFactory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator { return []generator.FamilyGenerator{ - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descAPIServiceAnnotationsName, descAPIServiceAnnotationsHelp, metric.Gauge, + basemetrics.ALPHA, "", wrapAPIServiceFunc(func(a *v1.APIService) *metric.Family { annotationKeys, annotationValues := createPrometheusLabelKeysValues("annotation", a.Annotations, allowAnnotationsList) @@ -70,10 +72,11 @@ func (f *apiserviceFactory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descAPIServiceLabelsName, descAPIServiceLabelsHelp, metric.Gauge, + basemetrics.ALPHA, "", wrapAPIServiceFunc(func(a *v1.APIService) *metric.Family { labelKeys, labelValues := createPrometheusLabelKeysValues("label", a.Labels, allowLabelsList) @@ -88,10 +91,11 @@ func (f *apiserviceFactory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_apiservice_status_condition", "The condition of this APIService.", metric.Gauge, + basemetrics.ALPHA, "", wrapAPIServiceFunc(func(a *v1.APIService) *metric.Family { ms := make([]*metric.Metric, 0, len(a.Status.Conditions)*len(conditionStatusesAPIServicesV1)) diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/crd.go b/pkg/collector/corechecks/cluster/ksm/customresources/crd.go index e8498e20b303b..77c007932428d 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/crd.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/crd.go @@ -18,6 +18,7 @@ import ( "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + basemetrics "k8s.io/component-base/metrics" "k8s.io/kube-state-metrics/v2/pkg/customresource" "k8s.io/kube-state-metrics/v2/pkg/metric" @@ -48,10 +49,11 @@ type crdFactory struct { func (f *crdFactory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator { return []generator.FamilyGenerator{ - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descCustomResourceDefinitionAnnotationsName, descCustomResourceDefinitionAnnotationsHelp, metric.Gauge, + basemetrics.ALPHA, "", wrapCustomResourceDefinition(func(c *crd.CustomResourceDefinition) *metric.Family { annotationKeys, annotationValues := createPrometheusLabelKeysValues("annotation", c.Annotations, allowAnnotationsList) @@ -66,10 +68,11 @@ func (f *crdFactory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsLis } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descCustomResourceDefinitionLabelsName, descCustomResourceDefinitionLabelsHelp, metric.Gauge, + basemetrics.ALPHA, "", wrapCustomResourceDefinition(func(c *crd.CustomResourceDefinition) *metric.Family { labelKeys, labelValues := createPrometheusLabelKeysValues("label", c.Labels, allowLabelsList) @@ -84,10 +87,11 @@ func (f *crdFactory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsLis } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_customresourcedefinition_status_condition", "The condition of this custom resource definition.", metric.Gauge, + basemetrics.ALPHA, "", wrapCustomResourceDefinition(func(c *crd.CustomResourceDefinition) *metric.Family { ms := make([]*metric.Metric, 0, len(c.Status.Conditions)*len(conditionStatusesExtensionV1)) diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/cronjob.go b/pkg/collector/corechecks/cluster/ksm/customresources/cronjob.go index e200e333ae6b3..e3930a12c4a5a 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/cronjob.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/cronjob.go @@ -27,6 +27,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + basemetrics "k8s.io/component-base/metrics" "k8s.io/kube-state-metrics/v2/pkg/customresource" "k8s.io/kube-state-metrics/v2/pkg/metric" generator "k8s.io/kube-state-metrics/v2/pkg/metric_generator" @@ -62,10 +63,11 @@ func (f *cronjobv1beta1Factory) CreateClient(cfg *rest.Config) (interface{}, err func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator { return []generator.FamilyGenerator{ - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descCronJobAnnotationsName, descCronJobAnnotationsHelp, metric.Gauge, + basemetrics.ALPHA, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { annotationKeys, annotationValues := createPrometheusLabelKeysValues("annotation", j.Annotations, allowAnnotationsList) @@ -80,10 +82,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descCronJobLabelsName, descCronJobLabelsHelp, metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { labelKeys, labelValues := createPrometheusLabelKeysValues("label", j.Labels, allowLabelsList) @@ -98,10 +101,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_info", "Info about cronjob.", metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { return &metric.Family{ @@ -115,10 +119,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_created", "Unix creation timestamp", metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { ms := []*metric.Metric{} @@ -135,10 +140,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_status_active", "Active holds pointers to currently running jobs.", metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { return &metric.Family{ @@ -152,10 +158,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_status_last_schedule_time", "LastScheduleTime keeps information of when was the last time the job was successfully scheduled.", metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { ms := []*metric.Metric{} @@ -173,10 +180,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_spec_suspend", "Suspend flag tells the controller to suspend subsequent executions.", metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { ms := []*metric.Metric{} @@ -194,10 +202,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_spec_starting_deadline_seconds", "Deadline in seconds for starting the job if it misses scheduled time for any reason.", metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { ms := []*metric.Metric{} @@ -216,10 +225,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_next_schedule_time", "Next time the cronjob should be scheduled. The time after lastScheduleTime, or after the cron job's creation time if it's never been scheduled. Use this to determine if the job is delayed.", metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { ms := []*metric.Metric{} @@ -241,10 +251,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_metadata_resource_version", "Resource version representing a specific version of the cronjob.", metric.Gauge, + basemetrics.STABLE, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { return &metric.Family{ @@ -252,10 +263,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_spec_successful_job_history_limit", "Successful job history limit tells the controller how many completed jobs should be preserved.", metric.Gauge, + basemetrics.ALPHA, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { ms := []*metric.Metric{} @@ -273,10 +285,11 @@ func (f *cronjobv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, all } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_cronjob_spec_failed_job_history_limit", "Failed job history limit tells the controller how many failed jobs should be preserved.", metric.Gauge, + basemetrics.ALPHA, "", wrapCronJobFunc(func(j *batchv1beta1.CronJob) *metric.Family { ms := []*metric.Metric{} diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/hpa.go b/pkg/collector/corechecks/cluster/ksm/customresources/hpa.go index 0a0533b4dcea6..76cd274d5f020 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/hpa.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/hpa.go @@ -25,6 +25,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + basemetrics "k8s.io/component-base/metrics" "k8s.io/kube-state-metrics/v2/pkg/customresource" "k8s.io/kube-state-metrics/v2/pkg/metric" @@ -78,10 +79,11 @@ func (f *hpav2Factory) CreateClient(cfg *rest.Config) (interface{}, error) { func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator { return []generator.FamilyGenerator{ - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_info", "Information about this autoscaler.", metric.Gauge, + basemetrics.ALPHA, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { labelKeys := []string{"scaletargetref_kind", "scaletargetref_name"} @@ -101,10 +103,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_metadata_generation", "The generation observed by the HorizontalPodAutoscaler controller.", metric.Gauge, + basemetrics.STABLE, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { return &metric.Family{ @@ -116,10 +119,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_spec_max_replicas", "Upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas.", metric.Gauge, + basemetrics.STABLE, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { return &metric.Family{ @@ -131,10 +135,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_spec_min_replicas", "Lower limit for the number of pods that can be set by the autoscaler, default 1.", metric.Gauge, + basemetrics.STABLE, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { return &metric.Family{ @@ -146,10 +151,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_spec_target_metric", "The metric specifications used by this autoscaler when calculating the desired replica count.", metric.Gauge, + basemetrics.ALPHA, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { ms := make([]*metric.Metric, 0, len(a.Spec.Metrics)) @@ -208,10 +214,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL return &metric.Family{Metrics: ms} }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_status_current_replicas", "Current number of replicas of pods managed by this autoscaler.", metric.Gauge, + basemetrics.STABLE, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { return &metric.Family{ @@ -223,10 +230,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_status_target_metric", "The current metric status used by this autoscaler when calculating the desired replica count.", metric.Gauge, + basemetrics.ALPHA, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { ms := make([]*metric.Metric, 0, len(a.Status.CurrentMetrics)) @@ -278,10 +286,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL return &metric.Family{Metrics: ms} }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_status_desired_replicas", "Desired number of replicas of pods managed by this autoscaler.", metric.Gauge, + basemetrics.STABLE, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { return &metric.Family{ @@ -293,10 +302,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descHorizontalPodAutoscalerAnnotationsName, descHorizontalPodAutoscalerAnnotationsHelp, metric.Gauge, + basemetrics.ALPHA, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { annotationKeys, annotationValues := createPrometheusLabelKeysValues("annotation", a.Annotations, allowAnnotationsList) @@ -311,10 +321,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descHorizontalPodAutoscalerLabelsName, descHorizontalPodAutoscalerLabelsHelp, metric.Gauge, + basemetrics.STABLE, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { labelKeys, labelValues := createPrometheusLabelKeysValues("label", a.Labels, allowLabelsList) @@ -329,10 +340,11 @@ func (f *hpav2Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsL } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_horizontalpodautoscaler_status_condition", "The condition of this autoscaler.", metric.Gauge, + basemetrics.STABLE, "", wrapHPAFunc(func(a *autoscaling.HorizontalPodAutoscaler) *metric.Family { ms := make([]*metric.Metric, 0, len(a.Status.Conditions)*len(conditionStatusesV1)) diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/job.go b/pkg/collector/corechecks/cluster/ksm/customresources/job.go index 7a77d9df917c2..41ab1063babc3 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/job.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/job.go @@ -18,6 +18,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + basemetrics "k8s.io/component-base/metrics" "k8s.io/kube-state-metrics/v2/pkg/customresource" "k8s.io/kube-state-metrics/v2/pkg/metric" generator "k8s.io/kube-state-metrics/v2/pkg/metric_generator" @@ -52,10 +53,11 @@ func (f *extendedJobFactory) CreateClient(cfg *rest.Config) (interface{}, error) // MetricFamilyGenerators returns the extended job metric family generators func (f *extendedJobFactory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator { return []generator.FamilyGenerator{ - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_job_duration", "Duration represents the time elapsed between the StartTime and CompletionTime of a Job, or the current time if the job is still running", metric.Gauge, + basemetrics.ALPHA, "", wrapJobFunc(func(j *batchv1.Job) *metric.Family { ms := []*metric.Metric{} diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/node.go b/pkg/collector/corechecks/cluster/ksm/customresources/node.go index 9322618a0d6fa..ea183f97de4fe 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/node.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/node.go @@ -18,6 +18,8 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + "k8s.io/component-base/metrics" + basemetrics "k8s.io/component-base/metrics" "k8s.io/kube-state-metrics/v2/pkg/constant" "k8s.io/kube-state-metrics/v2/pkg/customresource" "k8s.io/kube-state-metrics/v2/pkg/metric" @@ -53,19 +55,21 @@ func (f *extendedNodeFactory) MetricFamilyGenerators(allowAnnotationsList, allow // type, as the default KSM offering explicitly filters out anything that is prefixed with "kubernetes.io/" // More information can be found here: https://github.com/kubernetes/kube-state-metrics/issues/2027 return []generator.FamilyGenerator{ - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_node_status_extended_capacity", "The capacity for different additional resources of a node, which otherwise might have been filtered out by kube-state-metrics.", metric.Gauge, + basemetrics.ALPHA, "", wrapNodeFunc(func(n *v1.Node) *metric.Family { return f.customResourceGenerator(n.Status.Capacity) }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_node_status_extended_allocatable", "The allocatable for different additional resources of a node that are available for scheduling, which otherwise might have been filtered out by kube-state-metrics.", metric.Gauge, + metrics.ALPHA, "", wrapNodeFunc(func(n *v1.Node) *metric.Family { return f.customResourceGenerator(n.Status.Allocatable) diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/pdb.go b/pkg/collector/corechecks/cluster/ksm/customresources/pdb.go index 691f3b752498c..3c21e8974c82e 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/pdb.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/pdb.go @@ -24,6 +24,8 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + "k8s.io/component-base/metrics" + basemetrics "k8s.io/component-base/metrics" "k8s.io/kube-state-metrics/v2/pkg/customresource" "k8s.io/kube-state-metrics/v2/pkg/metric" @@ -60,10 +62,11 @@ func (f *pdbv1beta1Factory) CreateClient(cfg *rest.Config) (interface{}, error) func (f *pdbv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator { return []generator.FamilyGenerator{ - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descPodDisruptionBudgetAnnotationsName, descPodDisruptionBudgetAnnotationsHelp, metric.Gauge, + metrics.ALPHA, "", wrapPodDisruptionBudgetFunc(func(p *policyv1beta1.PodDisruptionBudget) *metric.Family { annotationKeys, annotationValues := createPrometheusLabelKeysValues("annotation", p.Annotations, allowAnnotationsList) @@ -78,10 +81,11 @@ func (f *pdbv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( descPodDisruptionBudgetLabelsName, descPodDisruptionBudgetLabelsHelp, metric.Gauge, + basemetrics.ALPHA, "", wrapPodDisruptionBudgetFunc(func(p *policyv1beta1.PodDisruptionBudget) *metric.Family { labelKeys, labelValues := createPrometheusLabelKeysValues("label", p.Labels, allowLabelsList) @@ -96,10 +100,11 @@ func (f *pdbv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_poddisruptionbudget_created", "Unix creation timestamp", metric.Gauge, + basemetrics.STABLE, "", wrapPodDisruptionBudgetFunc(func(p *policyv1beta1.PodDisruptionBudget) *metric.Family { ms := []*metric.Metric{} @@ -115,10 +120,11 @@ func (f *pdbv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_poddisruptionbudget_status_current_healthy", "Current number of healthy pods", metric.Gauge, + basemetrics.STABLE, "", wrapPodDisruptionBudgetFunc(func(p *policyv1beta1.PodDisruptionBudget) *metric.Family { return &metric.Family{ @@ -130,10 +136,11 @@ func (f *pdbv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_poddisruptionbudget_status_desired_healthy", "Minimum desired number of healthy pods", metric.Gauge, + basemetrics.STABLE, "", wrapPodDisruptionBudgetFunc(func(p *policyv1beta1.PodDisruptionBudget) *metric.Family { return &metric.Family{ @@ -145,10 +152,11 @@ func (f *pdbv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_poddisruptionbudget_status_pod_disruptions_allowed", "Number of pod disruptions that are currently allowed", metric.Gauge, + basemetrics.STABLE, "", wrapPodDisruptionBudgetFunc(func(p *policyv1beta1.PodDisruptionBudget) *metric.Family { return &metric.Family{ @@ -160,10 +168,11 @@ func (f *pdbv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_poddisruptionbudget_status_expected_pods", "Total number of pods counted by this disruption budget", metric.Gauge, + basemetrics.STABLE, "", wrapPodDisruptionBudgetFunc(func(p *policyv1beta1.PodDisruptionBudget) *metric.Family { return &metric.Family{ @@ -175,10 +184,11 @@ func (f *pdbv1beta1Factory) MetricFamilyGenerators(allowAnnotationsList, allowLa } }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_poddisruptionbudget_status_observed_generation", "Most recent generation observed when updating this PDB status", metric.Gauge, + basemetrics.STABLE, "", wrapPodDisruptionBudgetFunc(func(p *policyv1beta1.PodDisruptionBudget) *metric.Family { return &metric.Family{ diff --git a/pkg/collector/corechecks/cluster/ksm/customresources/pod.go b/pkg/collector/corechecks/cluster/ksm/customresources/pod.go index cda2a7e4ccbdc..51fe14d6ae0cb 100644 --- a/pkg/collector/corechecks/cluster/ksm/customresources/pod.go +++ b/pkg/collector/corechecks/cluster/ksm/customresources/pod.go @@ -21,6 +21,7 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" + basemetrics "k8s.io/component-base/metrics" "k8s.io/kube-state-metrics/v2/pkg/constant" "k8s.io/kube-state-metrics/v2/pkg/customresource" "k8s.io/kube-state-metrics/v2/pkg/metric" @@ -61,37 +62,41 @@ func (f *extendedPodFactory) MetricFamilyGenerators(allowAnnotationsList, allowL // type, as the default KSM offering explicitly filters out anything that is prefixed with "kubernetes.io/" // More information can be found here: https://github.com/kubernetes/kube-state-metrics/issues/2027 return []generator.FamilyGenerator{ - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_pod_container_extended_resource_requests", "The number of additional requested request resource by a container, which otherwise might have been filtered out by kube-state-metrics.", metric.Gauge, + basemetrics.ALPHA, "", wrapPodFunc(func(p *v1.Pod) *metric.Family { return f.customResourceGenerator(p, resourceRequests) }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_pod_container_extended_resource_limits", "The number of additional requested limit resource by a container, which otherwise might have been filtered out by kube-state-metrics.", metric.Gauge, + basemetrics.ALPHA, "", wrapPodFunc(func(p *v1.Pod) *metric.Family { return f.customResourceGenerator(p, resourcelimits) }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_pod_container_resource_with_owner_tag_requests", "The number of requested request resource by a container, including pod owner information.", metric.Gauge, + basemetrics.ALPHA, "", wrapPodFunc(func(p *v1.Pod) *metric.Family { return f.customResourceOwnerGenerator(p, resourceRequests) }), ), - *generator.NewFamilyGenerator( + *generator.NewFamilyGeneratorWithStability( "kube_pod_container_resource_with_owner_tag_limits", "The number of requested limit resource by a container, including pod owner information.", metric.Gauge, + basemetrics.ALPHA, "", wrapPodFunc(func(p *v1.Pod) *metric.Family { return f.customResourceOwnerGenerator(p, resourcelimits) diff --git a/pkg/kubestatemetrics/builder/builder.go b/pkg/kubestatemetrics/builder/builder.go index f6c15b8a01bca..87d73b1666e65 100644 --- a/pkg/kubestatemetrics/builder/builder.go +++ b/pkg/kubestatemetrics/builder/builder.go @@ -147,7 +147,7 @@ func (b *Builder) WithAllowAnnotations(l map[string][]string) { // Build initializes and registers all enabled stores. // Returns metric writers. -func (b *Builder) Build() []metricsstore.MetricsWriter { +func (b *Builder) Build() metricsstore.MetricsWriterList { return b.ksmBuilder.Build() }