From 4c86ce3b71780190769be7b7aefdbf564afa067f Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Thu, 25 Apr 2024 13:48:57 +0200
Subject: [PATCH] Unify TA types into a single file (#2894)
Signed-off-by: Pavol Loffay
---
apis/v1beta1/allocation_strategy.go | 38 ---------------------------
apis/v1beta1/targetallocator_types.go | 23 ++++++++++++++++
2 files changed, 23 insertions(+), 38 deletions(-)
delete mode 100644 apis/v1beta1/allocation_strategy.go
diff --git a/apis/v1beta1/allocation_strategy.go b/apis/v1beta1/allocation_strategy.go
deleted file mode 100644
index 1cbc90c19d..0000000000
--- a/apis/v1beta1/allocation_strategy.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright The OpenTelemetry Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v1beta1
-
-type (
- // TargetAllocatorAllocationStrategy represent a strategy Target Allocator uses to distribute targets to each collector
- // +kubebuilder:validation:Enum=least-weighted;consistent-hashing;per-node
- TargetAllocatorAllocationStrategy string
- // TargetAllocatorFilterStrategy represent a filtering strategy for targets before they are assigned to collectors
- // +kubebuilder:validation:Enum="";relabel-config
- TargetAllocatorFilterStrategy string
-)
-
-const (
- // TargetAllocatorAllocationStrategyLeastWeighted targets will be distributed to collector with fewer targets currently assigned.
- TargetAllocatorAllocationStrategyLeastWeighted TargetAllocatorAllocationStrategy = "least-weighted"
-
- // TargetAllocatorAllocationStrategyConsistentHashing targets will be consistently added to collectors, which allows a high-availability setup.
- TargetAllocatorAllocationStrategyConsistentHashing TargetAllocatorAllocationStrategy = "consistent-hashing"
-
- // TargetAllocatorAllocationStrategyPerNode targets will be assigned to the collector on the node they reside on (use only with daemon set).
- TargetAllocatorAllocationStrategyPerNode TargetAllocatorAllocationStrategy = "per-node"
-
- // TargetAllocatorFilterStrategyRelabelConfig targets will be consistently drops targets based on the relabel_config.
- TargetAllocatorFilterStrategyRelabelConfig TargetAllocatorFilterStrategy = "relabel-config"
-)
diff --git a/apis/v1beta1/targetallocator_types.go b/apis/v1beta1/targetallocator_types.go
index 264d5507ba..c833c54816 100644
--- a/apis/v1beta1/targetallocator_types.go
+++ b/apis/v1beta1/targetallocator_types.go
@@ -114,3 +114,26 @@ type TargetAllocatorPrometheusCR struct {
// +optional
ServiceMonitorSelector *metav1.LabelSelector `json:"serviceMonitorSelector,omitempty"`
}
+
+type (
+ // TargetAllocatorAllocationStrategy represent a strategy Target Allocator uses to distribute targets to each collector
+ // +kubebuilder:validation:Enum=least-weighted;consistent-hashing;per-node
+ TargetAllocatorAllocationStrategy string
+ // TargetAllocatorFilterStrategy represent a filtering strategy for targets before they are assigned to collectors
+ // +kubebuilder:validation:Enum="";relabel-config
+ TargetAllocatorFilterStrategy string
+)
+
+const (
+ // TargetAllocatorAllocationStrategyLeastWeighted targets will be distributed to collector with fewer targets currently assigned.
+ TargetAllocatorAllocationStrategyLeastWeighted TargetAllocatorAllocationStrategy = "least-weighted"
+
+ // TargetAllocatorAllocationStrategyConsistentHashing targets will be consistently added to collectors, which allows a high-availability setup.
+ TargetAllocatorAllocationStrategyConsistentHashing TargetAllocatorAllocationStrategy = "consistent-hashing"
+
+ // TargetAllocatorAllocationStrategyPerNode targets will be assigned to the collector on the node they reside on (use only with daemon set).
+ TargetAllocatorAllocationStrategyPerNode TargetAllocatorAllocationStrategy = "per-node"
+
+ // TargetAllocatorFilterStrategyRelabelConfig targets will be consistently drops targets based on the relabel_config.
+ TargetAllocatorFilterStrategyRelabelConfig TargetAllocatorFilterStrategy = "relabel-config"
+)