Просмотр исходного кода

Fix fmt script so it works with all modules, run fmt script

Signed-off-by: Sean Holcomb <seanholcomb@gmail.com>
Sean Holcomb 3 недель назад
Родитель
Сommit
609d1e256c

+ 1 - 1
core/pkg/exporter/pathing/staticpath.go

@@ -50,4 +50,4 @@ func (s *StaticFileStoragePathFormatter) ToFullPath(prefix string, in string, fi
 		name = fmt.Sprintf("%s.%s", name, fileExt)
 	}
 	return path.Join(s.rootDir, s.pipeline, dir, name)
-}
+}

+ 2 - 2
core/pkg/model/kubemodel/dcgm_test.go

@@ -13,8 +13,8 @@ func TestValidateDCGMDevice(t *testing.T) {
 	window := Window{Start: start, End: end}
 
 	tests := []struct {
-		name   string
-		device *DCGMDevice
+		name    string
+		device  *DCGMDevice
 		wantErr string
 	}{
 		{

+ 3 - 3
core/pkg/model/kubemodel/mock.go

@@ -41,11 +41,11 @@ func NewMockKubeModelSet(start, end time.Time) *KubeModelSet {
 		Spec: &ResourceQuotaSpec{
 			Hard: &ResourceQuotaSpecHard{
 				Requests: ResourceQuantities{
-					ResourceCPU: {Resource: ResourceCPU, Unit: UnitMillicore, Values: Stats{StatAvg: 4000, StatMax: 4000}},
+					ResourceCPU:    {Resource: ResourceCPU, Unit: UnitMillicore, Values: Stats{StatAvg: 4000, StatMax: 4000}},
 					ResourceMemory: {Resource: ResourceMemory, Unit: UnitByte, Values: Stats{StatAvg: 8e9, StatMax: 8e9}},
 				},
 				Limits: ResourceQuantities{
-					ResourceCPU: {Resource: ResourceCPU, Unit: UnitMillicore, Values: Stats{StatAvg: 8000, StatMax: 8000}},
+					ResourceCPU:    {Resource: ResourceCPU, Unit: UnitMillicore, Values: Stats{StatAvg: 8000, StatMax: 8000}},
 					ResourceMemory: {Resource: ResourceMemory, Unit: UnitByte, Values: Stats{StatAvg: 16e9, StatMax: 16e9}},
 				},
 			},
@@ -53,7 +53,7 @@ func NewMockKubeModelSet(start, end time.Time) *KubeModelSet {
 		Status: &ResourceQuotaStatus{
 			Used: &ResourceQuotaStatusUsed{
 				Requests: ResourceQuantities{
-					ResourceCPU: {Resource: ResourceCPU, Unit: UnitMillicore, Values: Stats{StatAvg: 500, StatMax: 800}},
+					ResourceCPU:    {Resource: ResourceCPU, Unit: UnitMillicore, Values: Stats{StatAvg: 500, StatMax: 800}},
 					ResourceMemory: {Resource: ResourceMemory, Unit: UnitByte, Values: Stats{StatAvg: 1e9, StatMax: 2e9}},
 				},
 			},

+ 23 - 23
core/pkg/model/pricingmodel/node_test.go

@@ -14,44 +14,44 @@ func TestNodeKeyRoundtrip(t *testing.T) {
 		{
 			name: "full GPU key",
 			key: NodeKey{
-				Provider:   shared.ProviderGCP,
-				Region:     "us-central1",
-				NodeType:   "n2-standard-4",
-				UsageType:  shared.UsageTypeOnDemand,
-				Family:     "n2",
-				DeviceType: "nvidia-tesla-t4",
-				PricingType:       NodePricingTypeDevice,
+				Provider:    shared.ProviderGCP,
+				Region:      "us-central1",
+				NodeType:    "n2-standard-4",
+				UsageType:   shared.UsageTypeOnDemand,
+				Family:      "n2",
+				DeviceType:  "nvidia-tesla-t4",
+				PricingType: NodePricingTypeDevice,
 			},
 		},
 		{
 			name: "on-demand CPU key",
 			key: NodeKey{
-				Provider:  shared.ProviderAWS,
-				Region:    "us-east-1",
-				NodeType:  "m5.xlarge",
-				UsageType: shared.UsageTypeOnDemand,
-				Family:    "m5",
-				PricingType:      NodePricingTypeCPUCore,
+				Provider:    shared.ProviderAWS,
+				Region:      "us-east-1",
+				NodeType:    "m5.xlarge",
+				UsageType:   shared.UsageTypeOnDemand,
+				Family:      "m5",
+				PricingType: NodePricingTypeCPUCore,
 			},
 		},
 		{
 			name: "spot total key",
 			key: NodeKey{
-				Provider:  shared.ProviderAzure,
-				Region:    "eastus",
-				NodeType:  "Standard_D4s_v3",
-				UsageType: shared.UsageTypeSpot,
-				PricingType:      NodePricingTypeTotal,
+				Provider:    shared.ProviderAzure,
+				Region:      "eastus",
+				NodeType:    "Standard_D4s_v3",
+				UsageType:   shared.UsageTypeSpot,
+				PricingType: NodePricingTypeTotal,
 			},
 		},
 		{
 			name: "RAM key",
 			key: NodeKey{
-				Provider:  shared.ProviderGCP,
-				Region:    "europe-west1",
-				Family:    "n1",
-				UsageType: shared.UsageTypeOnDemand,
-				PricingType:      NodePricingTypeRamGB,
+				Provider:    shared.ProviderGCP,
+				Region:      "europe-west1",
+				Family:      "n1",
+				UsageType:   shared.UsageTypeOnDemand,
+				PricingType: NodePricingTypeRamGB,
 			},
 		},
 		{

+ 1 - 1
core/pkg/model/shared/provider_test.go

@@ -52,4 +52,4 @@ func TestParseProvider(t *testing.T) {
 			}
 		})
 	}
-}
+}

+ 3 - 0
justfile

@@ -9,6 +9,9 @@ default:
 # format all Go code
 fmt:
     go fmt ./...
+    cd ./core && go fmt ./...
+    cd ./modules/collector-source && go fmt ./...
+    cd ./modules/prometheus-source && go fmt ./...
 
 # check if code is formatted
 fmt-check:

+ 139 - 139
modules/collector-source/pkg/scrape/clustercache_test.go

@@ -239,25 +239,25 @@ func Test_kubernetesScraper_scrapeDeployments(t *testing.T) {
 					Name: metric.DeploymentLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
-						source.DeploymentLabel:    "deployment1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceUIDLabel: "",
+						source.DeploymentLabel:   "deployment1",
+						source.NamespaceLabel:    "namespace1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
-						source.DeploymentLabel:    "deployment1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceUIDLabel: "",
+						source.DeploymentLabel:   "deployment1",
+						source.NamespaceLabel:    "namespace1",
 					},
 				},
 				{
 					Name: metric.DeploymentLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
-						source.DeploymentLabel:    "deployment1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceUIDLabel: "",
+						source.DeploymentLabel:   "deployment1",
+						source.NamespaceLabel:    "namespace1",
 					},
 					Value:          0,
 					AdditionalInfo: map[string]string{},
@@ -266,9 +266,9 @@ func Test_kubernetesScraper_scrapeDeployments(t *testing.T) {
 					Name: metric.DeploymentAnnotations,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
-						source.DeploymentLabel:    "deployment1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceUIDLabel: "",
+						source.DeploymentLabel:   "deployment1",
+						source.NamespaceLabel:    "namespace1",
 					},
 					Value:          0,
 					AdditionalInfo: map[string]string{},
@@ -277,9 +277,9 @@ func Test_kubernetesScraper_scrapeDeployments(t *testing.T) {
 					Name: metric.DeploymentMatchLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
-						source.DeploymentLabel:    "deployment1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceUIDLabel: "",
+						source.DeploymentLabel:   "deployment1",
+						source.NamespaceLabel:    "namespace1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
@@ -489,21 +489,21 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
 					},
 				},
 				{
@@ -511,11 +511,11 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
@@ -528,11 +528,11 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
@@ -545,15 +545,15 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
-						source.OwnerKindLabel:     "deployment",
-						source.OwnerNameLabel:     "deployment1",
-						source.OwnerUIDLabel:      "",
-						source.ContainerLabel:     "false",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
+						source.OwnerKindLabel:    "deployment",
+						source.OwnerNameLabel:    "deployment1",
+						source.OwnerUIDLabel:     "",
+						source.ContainerLabel:    "false",
 					},
 					Value:          0,
 					AdditionalInfo: nil,
@@ -563,23 +563,23 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
-						source.ContainerLabel:     "container1",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
+						source.ContainerLabel:    "container1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
-						source.ContainerLabel:     "container1",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
+						source.ContainerLabel:    "container1",
 					},
 				},
 				{
@@ -587,14 +587,14 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
-						source.ContainerLabel:     "container1",
-						source.ResourceLabel:      "cpu",
-						source.UnitLabel:          "core",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
+						source.ContainerLabel:    "container1",
+						source.ResourceLabel:     "cpu",
+						source.UnitLabel:         "core",
 					},
 					Value:          0.5,
 					AdditionalInfo: nil,
@@ -604,14 +604,14 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
-						source.ContainerLabel:     "container1",
-						source.ResourceLabel:      "memory",
-						source.UnitLabel:          "byte",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
+						source.ContainerLabel:    "container1",
+						source.ResourceLabel:     "memory",
+						source.UnitLabel:         "byte",
 					},
 					Value:          512,
 					AdditionalInfo: nil,
@@ -621,14 +621,14 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
-						source.ContainerLabel:     "container1",
-						source.ResourceLabel:      "cpu",
-						source.UnitLabel:          "core",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
+						source.ContainerLabel:    "container1",
+						source.ResourceLabel:     "cpu",
+						source.UnitLabel:         "core",
 					},
 					Value:          1,
 					AdditionalInfo: nil,
@@ -638,14 +638,14 @@ func Test_kubernetesScraper_scrapePods(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PodLabel:          "pod1",
-						source.NamespaceUIDLabel:  "",
-						source.NodeUIDLabel:       "",
-						source.NamespaceLabel:     "namespace1",
-						source.NodeLabel:          "node1",
-						source.InstanceLabel:      "node1",
-						source.ContainerLabel:     "container1",
-						source.ResourceLabel:      "memory",
-						source.UnitLabel:          "byte",
+						source.NamespaceUIDLabel: "",
+						source.NodeUIDLabel:      "",
+						source.NamespaceLabel:    "namespace1",
+						source.NodeLabel:         "node1",
+						source.InstanceLabel:     "node1",
+						source.ContainerLabel:    "container1",
+						source.ResourceLabel:     "memory",
+						source.UnitLabel:         "byte",
 					},
 					Value:          1024,
 					AdditionalInfo: nil,
@@ -721,21 +721,21 @@ func Test_kubernetesScraper_scrapePVCs(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PVCLabel:          "pvc1",
-						source.NamespaceUIDLabel:  "",
-						source.NamespaceLabel:     "namespace1",
-						source.VolumeNameLabel:    "vol1",
-						source.PVUIDLabel:         "",
-						source.StorageClassLabel:  "storageClass1",
+						source.NamespaceUIDLabel: "",
+						source.NamespaceLabel:    "namespace1",
+						source.VolumeNameLabel:   "vol1",
+						source.PVUIDLabel:        "",
+						source.StorageClassLabel: "storageClass1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PVCLabel:          "pvc1",
-						source.NamespaceUIDLabel:  "",
-						source.NamespaceLabel:     "namespace1",
-						source.VolumeNameLabel:    "vol1",
-						source.PVUIDLabel:         "",
-						source.StorageClassLabel:  "storageClass1",
+						source.NamespaceUIDLabel: "",
+						source.NamespaceLabel:    "namespace1",
+						source.VolumeNameLabel:   "vol1",
+						source.PVUIDLabel:        "",
+						source.StorageClassLabel: "storageClass1",
 					},
 				},
 				{
@@ -743,11 +743,11 @@ func Test_kubernetesScraper_scrapePVCs(t *testing.T) {
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
 						source.PVCLabel:          "pvc1",
-						source.NamespaceUIDLabel:  "",
-						source.NamespaceLabel:     "namespace1",
-						source.VolumeNameLabel:    "vol1",
-						source.PVUIDLabel:         "",
-						source.StorageClassLabel:  "storageClass1",
+						source.NamespaceUIDLabel: "",
+						source.NamespaceLabel:    "namespace1",
+						source.VolumeNameLabel:   "vol1",
+						source.PVUIDLabel:        "",
+						source.StorageClassLabel: "storageClass1",
 					},
 					Value:          4096,
 					AdditionalInfo: nil,
@@ -1002,25 +1002,25 @@ func Test_kubernetesScraper_scrapeStatefulSets(t *testing.T) {
 					Name: metric.StatefulSetInfo,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.StatefulSetLabel:  "statefulSet1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceLabel:    "namespace1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.StatefulSetLabel:  "statefulSet1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceLabel:    "namespace1",
 					},
 				},
 				{
 					Name: metric.StatefulSetLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.StatefulSetLabel:  "statefulSet1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceLabel:    "namespace1",
 					},
 					Value:          0,
 					AdditionalInfo: map[string]string{},
@@ -1029,9 +1029,9 @@ func Test_kubernetesScraper_scrapeStatefulSets(t *testing.T) {
 					Name: metric.StatefulSetAnnotations,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.StatefulSetLabel:  "statefulSet1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceLabel:    "namespace1",
 					},
 					Value:          0,
 					AdditionalInfo: map[string]string{},
@@ -1040,9 +1040,9 @@ func Test_kubernetesScraper_scrapeStatefulSets(t *testing.T) {
 					Name: metric.StatefulSetMatchLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.StatefulSetLabel:  "statefulSet1",
-						source.NamespaceLabel:     "namespace1",
+						source.NamespaceLabel:    "namespace1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
@@ -1122,13 +1122,13 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 					Name: metric.ReplicaSetInfo,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.ReplicaSetLabel:   "replicaSet1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.ReplicaSetLabel:   "replicaSet1",
 					},
 				},
@@ -1136,7 +1136,7 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 					Name: metric.ReplicaSetLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.ReplicaSetLabel:   "replicaSet1",
 					},
 					Value:          0,
@@ -1146,7 +1146,7 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 					Name: metric.ReplicaSetAnnotations,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid1",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.ReplicaSetLabel:   "replicaSet1",
 					},
 					Value:          0,
@@ -1156,13 +1156,13 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 				{
 					Name: metric.KubeReplicasetOwner,
 					Labels: map[string]string{
-						source.ReplicaSetLabel:  "replicaSet1",
-						source.NamespaceLabel:   "namespace1",
-						source.UIDLabel:         "uuid1",
-						source.OwnerNameLabel:   "rollout1",
-						source.OwnerKindLabel:   "Rollout",
-						source.OwnerUIDLabel:    "",
-						source.ControllerLabel:  "false",
+						source.ReplicaSetLabel: "replicaSet1",
+						source.NamespaceLabel:  "namespace1",
+						source.UIDLabel:        "uuid1",
+						source.OwnerNameLabel:  "rollout1",
+						source.OwnerKindLabel:  "Rollout",
+						source.OwnerUIDLabel:   "",
+						source.ControllerLabel: "false",
 					},
 					Value: 0,
 				},
@@ -1171,13 +1171,13 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 					Name: metric.ReplicaSetInfo,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid2",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.ReplicaSetLabel:   "pureReplicaSet",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:          "uuid2",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.ReplicaSetLabel:   "pureReplicaSet",
 					},
 				},
@@ -1185,7 +1185,7 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 					Name: metric.ReplicaSetLabels,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid2",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.ReplicaSetLabel:   "pureReplicaSet",
 					},
 					Value:          0,
@@ -1195,7 +1195,7 @@ func Test_kubernetesScraper_scrapeReplicaSets(t *testing.T) {
 					Name: metric.ReplicaSetAnnotations,
 					Labels: map[string]string{
 						source.UIDLabel:          "uuid2",
-						source.NamespaceUIDLabel:  "",
+						source.NamespaceUIDLabel: "",
 						source.ReplicaSetLabel:   "pureReplicaSet",
 					},
 					Value:          0,
@@ -1287,13 +1287,13 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.ResourceQuotaInfo,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 					},
 					Value: 0,
 					AdditionalInfo: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 					},
 				},
@@ -1301,7 +1301,7 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.KubeResourceQuotaSpecResourceRequests,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 						source.ResourceLabel:      "cpu",
 						source.UnitLabel:          "core",
@@ -1313,7 +1313,7 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.KubeResourceQuotaSpecResourceRequests,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 						source.ResourceLabel:      "memory",
 						source.UnitLabel:          "byte",
@@ -1325,7 +1325,7 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.KubeResourceQuotaSpecResourceLimits,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 						source.ResourceLabel:      "cpu",
 						source.UnitLabel:          "core",
@@ -1337,7 +1337,7 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.KubeResourceQuotaSpecResourceLimits,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 						source.ResourceLabel:      "memory",
 						source.UnitLabel:          "byte",
@@ -1349,7 +1349,7 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.KubeResourceQuotaStatusUsedResourceRequests,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 						source.ResourceLabel:      "cpu",
 						source.UnitLabel:          "core",
@@ -1361,7 +1361,7 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.KubeResourceQuotaStatusUsedResourceRequests,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 						source.ResourceLabel:      "memory",
 						source.UnitLabel:          "byte",
@@ -1373,7 +1373,7 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.KubeResourceQuotaStatusUsedResourceLimits,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 						source.ResourceLabel:      "cpu",
 						source.UnitLabel:          "core",
@@ -1385,7 +1385,7 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 					Name: metric.KubeResourceQuotaStatusUsedResourceLimits,
 					Labels: map[string]string{
 						source.UIDLabel:           "uuid1",
-						source.NamespaceUIDLabel:   "",
+						source.NamespaceUIDLabel:  "",
 						source.ResourceQuotaLabel: "resourceQuota1",
 						source.ResourceLabel:      "memory",
 						source.UnitLabel:          "byte",
@@ -1419,4 +1419,4 @@ func Test_kubernetesScraper_scrapeResourceQuotas(t *testing.T) {
 			}
 		})
 	}
-}
+}

+ 2 - 2
pkg/metrics/kubemodel.go

@@ -270,7 +270,7 @@ func (c KubeModelCollector) scrapePods(
 				}
 				pvcUID := pvcIndex[pvcIndexKey(pod.Namespace, vol.PersistentVolumeClaim.ClaimName)]
 				out = append(out, newInfoMetric("pod_pvc_volume", map[string]string{
-					"uid":                      string(pod.UID),
+					"uid":                       string(pod.UID),
 					"persistentvolumeclaim_uid": string(pvcUID),
 					"pod_volume_name":           vol.Name,
 				}))
@@ -543,4 +543,4 @@ func kubeModelResourceValue(resourceName v1.ResourceName, quantity resource.Quan
 	default:
 		return float64(quantity.Value())
 	}
-}
+}