From fc947b0ce26ba187ffa76489ec462ab5a77a08cf Mon Sep 17 00:00:00 2001 From: Povilas Versockas Date: Wed, 28 Feb 2024 01:28:41 +0200 Subject: [PATCH] [k8sclusterreceiver] remove k8s.kubeproxy.version resource attribute (#31180) **Description:** Remove deprecated resource attribute. Deprecation happened in 0.92.0 **Link to tracking Issue:** https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/29748#issuecomment-1938022633 --- .chloggen/rm-kube-proxy.yaml | 27 +++++++++++++++++++ receiver/k8sclusterreceiver/documentation.md | 1 - .../internal/metadata/generated_config.go | 4 --- .../metadata/generated_config_test.go | 4 --- .../internal/metadata/generated_metrics.go | 3 --- .../metadata/generated_metrics_test.go | 5 ---- .../internal/metadata/generated_resource.go | 7 ----- .../metadata/generated_resource_test.go | 8 +----- .../internal/metadata/testdata/config.yaml | 4 --- .../k8sclusterreceiver/internal/node/nodes.go | 3 --- .../internal/node/nodes_test.go | 2 -- .../node/testdata/expected_optional.yaml | 3 --- .../internal/testutils/objects.go | 1 - receiver/k8sclusterreceiver/metadata.yaml | 7 ----- 14 files changed, 28 insertions(+), 51 deletions(-) create mode 100755 .chloggen/rm-kube-proxy.yaml diff --git a/.chloggen/rm-kube-proxy.yaml b/.chloggen/rm-kube-proxy.yaml new file mode 100755 index 000000000000..dbb891304642 --- /dev/null +++ b/.chloggen/rm-kube-proxy.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: k8sclusterreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Remove deprecated k8s.kubeproxy.version resource attribute" + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [29748] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [user] diff --git a/receiver/k8sclusterreceiver/documentation.md b/receiver/k8sclusterreceiver/documentation.md index 78d0339742a1..aac9303e25b5 100644 --- a/receiver/k8sclusterreceiver/documentation.md +++ b/receiver/k8sclusterreceiver/documentation.md @@ -439,7 +439,6 @@ Current status reason of the pod (1 - Evicted, 2 - NodeAffinity, 3 - NodeLost, 4 | k8s.job.name | The k8s pod name. | Any Str | true | | k8s.job.uid | The k8s job uid. | Any Str | true | | k8s.kubelet.version | The version of Kubelet running on the node. | Any Str | false | -| k8s.kubeproxy.version | The version of Kube Proxy running on the node. | Any Str | false | | k8s.namespace.name | The k8s namespace name. | Any Str | true | | k8s.namespace.uid | The k8s namespace uid. | Any Str | true | | k8s.node.name | The k8s node name. | Any Str | true | diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_config.go b/receiver/k8sclusterreceiver/internal/metadata/generated_config.go index 0ce3c13724b4..182e9f812853 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_config.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_config.go @@ -246,7 +246,6 @@ type ResourceAttributesConfig struct { K8sJobName ResourceAttributeConfig `mapstructure:"k8s.job.name"` K8sJobUID ResourceAttributeConfig `mapstructure:"k8s.job.uid"` K8sKubeletVersion ResourceAttributeConfig `mapstructure:"k8s.kubelet.version"` - K8sKubeproxyVersion ResourceAttributeConfig `mapstructure:"k8s.kubeproxy.version"` K8sNamespaceName ResourceAttributeConfig `mapstructure:"k8s.namespace.name"` K8sNamespaceUID ResourceAttributeConfig `mapstructure:"k8s.namespace.uid"` K8sNodeName ResourceAttributeConfig `mapstructure:"k8s.node.name"` @@ -321,9 +320,6 @@ func DefaultResourceAttributesConfig() ResourceAttributesConfig { K8sKubeletVersion: ResourceAttributeConfig{ Enabled: false, }, - K8sKubeproxyVersion: ResourceAttributeConfig{ - Enabled: false, - }, K8sNamespaceName: ResourceAttributeConfig{ Enabled: true, }, diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go b/receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go index 15e165e2ce75..712cc9048298 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go @@ -89,7 +89,6 @@ func TestMetricsBuilderConfig(t *testing.T) { K8sJobName: ResourceAttributeConfig{Enabled: true}, K8sJobUID: ResourceAttributeConfig{Enabled: true}, K8sKubeletVersion: ResourceAttributeConfig{Enabled: true}, - K8sKubeproxyVersion: ResourceAttributeConfig{Enabled: true}, K8sNamespaceName: ResourceAttributeConfig{Enabled: true}, K8sNamespaceUID: ResourceAttributeConfig{Enabled: true}, K8sNodeName: ResourceAttributeConfig{Enabled: true}, @@ -179,7 +178,6 @@ func TestMetricsBuilderConfig(t *testing.T) { K8sJobName: ResourceAttributeConfig{Enabled: false}, K8sJobUID: ResourceAttributeConfig{Enabled: false}, K8sKubeletVersion: ResourceAttributeConfig{Enabled: false}, - K8sKubeproxyVersion: ResourceAttributeConfig{Enabled: false}, K8sNamespaceName: ResourceAttributeConfig{Enabled: false}, K8sNamespaceUID: ResourceAttributeConfig{Enabled: false}, K8sNodeName: ResourceAttributeConfig{Enabled: false}, @@ -252,7 +250,6 @@ func TestResourceAttributesConfig(t *testing.T) { K8sJobName: ResourceAttributeConfig{Enabled: true}, K8sJobUID: ResourceAttributeConfig{Enabled: true}, K8sKubeletVersion: ResourceAttributeConfig{Enabled: true}, - K8sKubeproxyVersion: ResourceAttributeConfig{Enabled: true}, K8sNamespaceName: ResourceAttributeConfig{Enabled: true}, K8sNamespaceUID: ResourceAttributeConfig{Enabled: true}, K8sNodeName: ResourceAttributeConfig{Enabled: true}, @@ -294,7 +291,6 @@ func TestResourceAttributesConfig(t *testing.T) { K8sJobName: ResourceAttributeConfig{Enabled: false}, K8sJobUID: ResourceAttributeConfig{Enabled: false}, K8sKubeletVersion: ResourceAttributeConfig{Enabled: false}, - K8sKubeproxyVersion: ResourceAttributeConfig{Enabled: false}, K8sNamespaceName: ResourceAttributeConfig{Enabled: false}, K8sNamespaceUID: ResourceAttributeConfig{Enabled: false}, K8sNodeName: ResourceAttributeConfig{Enabled: false}, diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go index c4a7d7c735fb..3d1bf97bcc37 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics.go @@ -2249,9 +2249,6 @@ func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption { } func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder { - if mbc.ResourceAttributes.K8sKubeproxyVersion.enabledSetByUser { - settings.Logger.Warn("[WARNING] `k8s.kubeproxy.version` should not be configured: k8s.kubeproxy.version resource attribute is deprecated and will be removed soon.") - } mb := &MetricsBuilder{ config: mbc, startTime: pcommon.NewTimestampFromTime(time.Now()), diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go index 18b67c686dbd..e424dccfd551 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_metrics_test.go @@ -49,10 +49,6 @@ func TestMetricsBuilder(t *testing.T) { mb := NewMetricsBuilder(loadMetricsBuilderConfig(t, test.name), settings, WithStartTime(start)) expectedWarnings := 0 - if test.configSet == testSetAll || test.configSet == testSetNone { - assert.Equal(t, "[WARNING] `k8s.kubeproxy.version` should not be configured: k8s.kubeproxy.version resource attribute is deprecated and will be removed soon.", observedLogs.All()[expectedWarnings].Message) - expectedWarnings++ - } assert.Equal(t, expectedWarnings, observedLogs.Len()) @@ -251,7 +247,6 @@ func TestMetricsBuilder(t *testing.T) { rb.SetK8sJobName("k8s.job.name-val") rb.SetK8sJobUID("k8s.job.uid-val") rb.SetK8sKubeletVersion("k8s.kubelet.version-val") - rb.SetK8sKubeproxyVersion("k8s.kubeproxy.version-val") rb.SetK8sNamespaceName("k8s.namespace.name-val") rb.SetK8sNamespaceUID("k8s.namespace.uid-val") rb.SetK8sNodeName("k8s.node.name-val") diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_resource.go b/receiver/k8sclusterreceiver/internal/metadata/generated_resource.go index 6002f6e6e053..6f09fd36190a 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_resource.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_resource.go @@ -140,13 +140,6 @@ func (rb *ResourceBuilder) SetK8sKubeletVersion(val string) { } } -// SetK8sKubeproxyVersion sets provided value as "k8s.kubeproxy.version" attribute. -func (rb *ResourceBuilder) SetK8sKubeproxyVersion(val string) { - if rb.config.K8sKubeproxyVersion.Enabled { - rb.res.Attributes().PutStr("k8s.kubeproxy.version", val) - } -} - // SetK8sNamespaceName sets provided value as "k8s.namespace.name" attribute. func (rb *ResourceBuilder) SetK8sNamespaceName(val string) { if rb.config.K8sNamespaceName.Enabled { diff --git a/receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go b/receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go index ead39ea2bc2b..915bf92cd9d6 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go +++ b/receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go @@ -30,7 +30,6 @@ func TestResourceBuilder(t *testing.T) { rb.SetK8sJobName("k8s.job.name-val") rb.SetK8sJobUID("k8s.job.uid-val") rb.SetK8sKubeletVersion("k8s.kubelet.version-val") - rb.SetK8sKubeproxyVersion("k8s.kubeproxy.version-val") rb.SetK8sNamespaceName("k8s.namespace.name-val") rb.SetK8sNamespaceUID("k8s.namespace.uid-val") rb.SetK8sNodeName("k8s.node.name-val") @@ -58,7 +57,7 @@ func TestResourceBuilder(t *testing.T) { case "default": assert.Equal(t, 30, res.Attributes().Len()) case "all_set": - assert.Equal(t, 37, res.Attributes().Len()) + assert.Equal(t, 36, res.Attributes().Len()) case "none_set": assert.Equal(t, 0, res.Attributes().Len()) return @@ -151,11 +150,6 @@ func TestResourceBuilder(t *testing.T) { if ok { assert.EqualValues(t, "k8s.kubelet.version-val", val.Str()) } - val, ok = res.Attributes().Get("k8s.kubeproxy.version") - assert.Equal(t, test == "all_set", ok) - if ok { - assert.EqualValues(t, "k8s.kubeproxy.version-val", val.Str()) - } val, ok = res.Attributes().Get("k8s.namespace.name") assert.True(t, ok) if ok { diff --git a/receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml b/receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml index bd8704d966e3..942580b5a61d 100644 --- a/receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml +++ b/receiver/k8sclusterreceiver/internal/metadata/testdata/config.yaml @@ -124,8 +124,6 @@ all_set: enabled: true k8s.kubelet.version: enabled: true - k8s.kubeproxy.version: - enabled: true k8s.namespace.name: enabled: true k8s.namespace.uid: @@ -289,8 +287,6 @@ none_set: enabled: false k8s.kubelet.version: enabled: false - k8s.kubeproxy.version: - enabled: false k8s.namespace.name: enabled: false k8s.namespace.uid: diff --git a/receiver/k8sclusterreceiver/internal/node/nodes.go b/receiver/k8sclusterreceiver/internal/node/nodes.go index 8c63d3b965a0..2c4ca73abf3f 100644 --- a/receiver/k8sclusterreceiver/internal/node/nodes.go +++ b/receiver/k8sclusterreceiver/internal/node/nodes.go @@ -36,7 +36,6 @@ func Transform(node *corev1.Node) *corev1.Node { Allocatable: node.Status.Allocatable, NodeInfo: corev1.NodeSystemInfo{ KubeletVersion: node.Status.NodeInfo.KubeletVersion, - KubeProxyVersion: node.Status.NodeInfo.KubeProxyVersion, ContainerRuntimeVersion: node.Status.NodeInfo.ContainerRuntimeVersion, OSImage: node.Status.NodeInfo.OSImage, OperatingSystem: node.Status.NodeInfo.OperatingSystem, @@ -60,7 +59,6 @@ func RecordMetrics(mb *imetadata.MetricsBuilder, node *corev1.Node, ts pcommon.T rb.SetK8sNodeUID(string(node.UID)) rb.SetK8sNodeName(node.Name) rb.SetK8sKubeletVersion(node.Status.NodeInfo.KubeletVersion) - rb.SetK8sKubeproxyVersion(node.Status.NodeInfo.KubeProxyVersion) mb.EmitForResource(imetadata.WithResource(rb.Emit())) } @@ -114,7 +112,6 @@ func CustomMetrics(set receiver.CreateSettings, rb *metadata.ResourceBuilder, no rb.SetK8sNodeUID(string(node.UID)) rb.SetK8sNodeName(node.Name) rb.SetK8sKubeletVersion(node.Status.NodeInfo.KubeletVersion) - rb.SetK8sKubeproxyVersion(node.Status.NodeInfo.KubeProxyVersion) rb.SetOsType(node.Status.NodeInfo.OperatingSystem) runtime, version := getContainerRuntimeInfo(node.Status.NodeInfo.ContainerRuntimeVersion) diff --git a/receiver/k8sclusterreceiver/internal/node/nodes_test.go b/receiver/k8sclusterreceiver/internal/node/nodes_test.go index 5bb613b4abf2..2705fe26a01a 100644 --- a/receiver/k8sclusterreceiver/internal/node/nodes_test.go +++ b/receiver/k8sclusterreceiver/internal/node/nodes_test.go @@ -65,7 +65,6 @@ func TestNodeOptionalMetrics(t *testing.T) { n := testutils.NewNode("2") rac := metadata.DefaultResourceAttributesConfig() rac.K8sKubeletVersion.Enabled = true - rac.K8sKubeproxyVersion.Enabled = true rac.ContainerRuntime.Enabled = true rac.ContainerRuntimeVersion.Enabled = true rac.OsType.Enabled = true @@ -255,7 +254,6 @@ func TestTransform(t *testing.T) { }, NodeInfo: corev1.NodeSystemInfo{ KubeletVersion: "v1.25.3", - KubeProxyVersion: "v1.25.3", OSImage: "Ubuntu 22.04.1 LTS", ContainerRuntimeVersion: "containerd://1.6.9", OperatingSystem: "linux", diff --git a/receiver/k8sclusterreceiver/internal/node/testdata/expected_optional.yaml b/receiver/k8sclusterreceiver/internal/node/testdata/expected_optional.yaml index 9c95a3edf621..2a8756e50f09 100644 --- a/receiver/k8sclusterreceiver/internal/node/testdata/expected_optional.yaml +++ b/receiver/k8sclusterreceiver/internal/node/testdata/expected_optional.yaml @@ -10,9 +10,6 @@ resourceMetrics: - key: k8s.kubelet.version value: stringValue: v1.25.3 - - key: k8s.kubeproxy.version - value: - stringValue: v1.25.3 - key: container.runtime.version value: stringValue: "1.6.9" diff --git a/receiver/k8sclusterreceiver/internal/testutils/objects.go b/receiver/k8sclusterreceiver/internal/testutils/objects.go index 84bd3983bd24..228383cd380c 100644 --- a/receiver/k8sclusterreceiver/internal/testutils/objects.go +++ b/receiver/k8sclusterreceiver/internal/testutils/objects.go @@ -202,7 +202,6 @@ func NewNode(id string) *corev1.Node { }, NodeInfo: corev1.NodeSystemInfo{ KubeletVersion: "v1.25.3", - KubeProxyVersion: "v1.25.3", OSImage: "Ubuntu 22.04.1 LTS", ContainerRuntimeVersion: "containerd://1.6.9", OperatingSystem: "linux", diff --git a/receiver/k8sclusterreceiver/metadata.yaml b/receiver/k8sclusterreceiver/metadata.yaml index 70fe006ff7c6..ae701825f7a5 100644 --- a/receiver/k8sclusterreceiver/metadata.yaml +++ b/receiver/k8sclusterreceiver/metadata.yaml @@ -182,13 +182,6 @@ resource_attributes: type: string enabled: false - k8s.kubeproxy.version: - description: The version of Kube Proxy running on the node. - type: string - enabled: false - warnings: - if_configured: k8s.kubeproxy.version resource attribute is deprecated and will be removed soon. - openshift.clusterquota.uid: description: The k8s ClusterResourceQuota uid. type: string