From 141266e1da5db092d3490a9d52ad107fa022a18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Wed, 1 May 2024 18:23:45 +0200 Subject: [PATCH] [chore] Move TargetAllocator CRD to v1alpha1 --- apis/v1alpha1/targetallocator_types.go | 94 ++++++++++++++++ apis/v1alpha1/zz_generated.deepcopy.go | 101 ++++++++++++++++++ apis/v1beta1/targetallocator_types.go | 73 ------------- apis/v1beta1/zz_generated.deepcopy.go | 100 ----------------- .../opentelemetry.io_targetallocators.yaml | 2 +- .../manifests/collector/targetallocator.go | 7 +- .../collector/targetallocator_test.go | 11 +- internal/manifests/manifestutils/labels.go | 4 +- .../manifests/manifestutils/labels_test.go | 9 +- internal/manifests/params.go | 2 +- .../manifests/targetallocator/annotations.go | 4 +- .../manifests/targetallocator/container.go | 4 +- .../targetallocator/container_test.go | 35 +++--- .../targetallocator/deployment_test.go | 33 +++--- .../poddisruptionbudget_test.go | 13 +-- .../targetallocator/serviceaccount.go | 4 +- .../targetallocator/serviceaccount_test.go | 13 +-- .../targetallocator/servicemonitor_test.go | 5 +- internal/manifests/targetallocator/volume.go | 4 +- .../manifests/targetallocator/volume_test.go | 4 +- 20 files changed, 275 insertions(+), 247 deletions(-) create mode 100644 apis/v1alpha1/targetallocator_types.go diff --git a/apis/v1alpha1/targetallocator_types.go b/apis/v1alpha1/targetallocator_types.go new file mode 100644 index 0000000000..f4acfae76b --- /dev/null +++ b/apis/v1alpha1/targetallocator_types.go @@ -0,0 +1,94 @@ +// 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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" +) + +func init() { + v1beta1.SchemeBuilder.Register(&TargetAllocator{}, &TargetAllocatorList{}) +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// TargetAllocator is the Schema for the targetallocators API. +type TargetAllocator struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec TargetAllocatorSpec `json:"spec,omitempty"` + Status TargetAllocatorStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// TargetAllocatorList contains a list of TargetAllocator. +type TargetAllocatorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []v1beta1.OpenTelemetryCollector `json:"items"` +} + +// TargetAllocatorStatus defines the observed state of Target Allocator. +type TargetAllocatorStatus struct { + // Version of the managed Target Allocator (operand) + // +optional + Version string `json:"version,omitempty"` + + // Image indicates the container image to use for the Target Allocator. + // +optional + Image string `json:"image,omitempty"` +} + +// TargetAllocatorSpec defines the desired state of TargetAllocator. +type TargetAllocatorSpec struct { + // Common defines fields that are common to all OpenTelemetry CRD workloads. + v1beta1.OpenTelemetryCommonFields `json:",inline"` + // CollectorSelector is the selector for Collector Pods the target allocator will allocate targets to. + CollectorSelector metav1.LabelSelector `json:"collectorSelector,omitempty"` + // AllocationStrategy determines which strategy the target allocator should use for allocation. + // The current options are least-weighted, consistent-hashing and per-node. The default is + // consistent-hashing. + // WARNING: The per-node strategy currently ignores targets without a Node, like control plane components. + // +optional + // +kubebuilder:default:=consistent-hashing + AllocationStrategy v1beta1.TargetAllocatorAllocationStrategy `json:"allocationStrategy,omitempty"` + // FilterStrategy determines how to filter targets before allocating them among the collectors. + // The only current option is relabel-config (drops targets based on prom relabel_config). + // The default is relabel-config. + // +optional + // +kubebuilder:default:=relabel-config + FilterStrategy v1beta1.TargetAllocatorFilterStrategy `json:"filterStrategy,omitempty"` + // ScrapeConfigs define static Prometheus scrape configurations for the target allocator. + // To use dynamic configurations from ServiceMonitors and PodMonitors, see the PrometheusCR section. + // For the exact format, see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config. + // +optional + // +listType=atomic + // +kubebuilder:pruning:PreserveUnknownFields + ScrapeConfigs []v1beta1.AnyConfig `json:"scrapeConfigs,omitempty"` + // PrometheusCR defines the configuration for the retrieval of PrometheusOperator CRDs ( servicemonitor.monitoring.coreos.com/v1 and podmonitor.monitoring.coreos.com/v1 ). + // +optional + PrometheusCR v1beta1.TargetAllocatorPrometheusCR `json:"prometheusCR,omitempty"` + // ObservabilitySpec defines how telemetry data gets handled. + // + // +optional + // +kubebuilder:validation:Optional + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Observability" + Observability v1beta1.ObservabilitySpec `json:"observability,omitempty"` +} diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 8f47cb64dc..ef6579f898 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -19,6 +19,7 @@ package v1alpha1 import ( + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "k8s.io/api/autoscaling/v2" "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" @@ -1243,3 +1244,103 @@ func (in *ScaleSubresourceStatus) DeepCopy() *ScaleSubresourceStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetAllocator) DeepCopyInto(out *TargetAllocator) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAllocator. +func (in *TargetAllocator) DeepCopy() *TargetAllocator { + if in == nil { + return nil + } + out := new(TargetAllocator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TargetAllocator) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetAllocatorList) DeepCopyInto(out *TargetAllocatorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta1.OpenTelemetryCollector, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAllocatorList. +func (in *TargetAllocatorList) DeepCopy() *TargetAllocatorList { + if in == nil { + return nil + } + out := new(TargetAllocatorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TargetAllocatorList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetAllocatorSpec) DeepCopyInto(out *TargetAllocatorSpec) { + *out = *in + in.OpenTelemetryCommonFields.DeepCopyInto(&out.OpenTelemetryCommonFields) + in.CollectorSelector.DeepCopyInto(&out.CollectorSelector) + if in.ScrapeConfigs != nil { + in, out := &in.ScrapeConfigs, &out.ScrapeConfigs + *out = make([]v1beta1.AnyConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + in.PrometheusCR.DeepCopyInto(&out.PrometheusCR) + out.Observability = in.Observability +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAllocatorSpec. +func (in *TargetAllocatorSpec) DeepCopy() *TargetAllocatorSpec { + if in == nil { + return nil + } + out := new(TargetAllocatorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetAllocatorStatus) DeepCopyInto(out *TargetAllocatorStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAllocatorStatus. +func (in *TargetAllocatorStatus) DeepCopy() *TargetAllocatorStatus { + if in == nil { + return nil + } + out := new(TargetAllocatorStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/v1beta1/targetallocator_types.go b/apis/v1beta1/targetallocator_types.go index c833c54816..f772acdde4 100644 --- a/apis/v1beta1/targetallocator_types.go +++ b/apis/v1beta1/targetallocator_types.go @@ -18,79 +18,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -func init() { - SchemeBuilder.Register(&TargetAllocator{}, &TargetAllocatorList{}) -} - -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status - -// TargetAllocator is the Schema for the targetallocators API. -type TargetAllocator struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec TargetAllocatorSpec `json:"spec,omitempty"` - Status TargetAllocatorStatus `json:"status,omitempty"` -} - -//+kubebuilder:object:root=true - -// TargetAllocatorList contains a list of TargetAllocator. -type TargetAllocatorList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []OpenTelemetryCollector `json:"items"` -} - -// TargetAllocatorStatus defines the observed state of Target Allocator. -type TargetAllocatorStatus struct { - // Version of the managed Target Allocator (operand) - // +optional - Version string `json:"version,omitempty"` - - // Image indicates the container image to use for the Target Allocator. - // +optional - Image string `json:"image,omitempty"` -} - -// TargetAllocatorSpec defines the desired state of TargetAllocator. -type TargetAllocatorSpec struct { - // Common defines fields that are common to all OpenTelemetry CRD workloads. - OpenTelemetryCommonFields `json:",inline"` - // CollectorSelector is the selector for Collector Pods the target allocator will allocate targets to. - CollectorSelector metav1.LabelSelector `json:"collectorSelector,omitempty"` - // AllocationStrategy determines which strategy the target allocator should use for allocation. - // The current options are least-weighted, consistent-hashing and per-node. The default is - // consistent-hashing. - // WARNING: The per-node strategy currently ignores targets without a Node, like control plane components. - // +optional - // +kubebuilder:default:=consistent-hashing - AllocationStrategy TargetAllocatorAllocationStrategy `json:"allocationStrategy,omitempty"` - // FilterStrategy determines how to filter targets before allocating them among the collectors. - // The only current option is relabel-config (drops targets based on prom relabel_config). - // The default is relabel-config. - // +optional - // +kubebuilder:default:=relabel-config - FilterStrategy TargetAllocatorFilterStrategy `json:"filterStrategy,omitempty"` - // ScrapeConfigs define static Prometheus scrape configurations for the target allocator. - // To use dynamic configurations from ServiceMonitors and PodMonitors, see the PrometheusCR section. - // For the exact format, see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config. - // +optional - // +listType=atomic - // +kubebuilder:pruning:PreserveUnknownFields - ScrapeConfigs []AnyConfig `json:"scrapeConfigs,omitempty"` - // PrometheusCR defines the configuration for the retrieval of PrometheusOperator CRDs ( servicemonitor.monitoring.coreos.com/v1 and podmonitor.monitoring.coreos.com/v1 ). - // +optional - PrometheusCR TargetAllocatorPrometheusCR `json:"prometheusCR,omitempty"` - // ObservabilitySpec defines how telemetry data gets handled. - // - // +optional - // +kubebuilder:validation:Optional - // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Observability" - Observability ObservabilitySpec `json:"observability,omitempty"` -} - // TargetAllocatorPrometheusCR configures Prometheus CustomResource handling in the Target Allocator. type TargetAllocatorPrometheusCR struct { // Enabled indicates whether to use a PrometheusOperator custom resources as targets or not. diff --git a/apis/v1beta1/zz_generated.deepcopy.go b/apis/v1beta1/zz_generated.deepcopy.go index 9690ef897d..e34b26d522 100644 --- a/apis/v1beta1/zz_generated.deepcopy.go +++ b/apis/v1beta1/zz_generated.deepcopy.go @@ -669,33 +669,6 @@ func (in *Service) DeepCopy() *Service { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TargetAllocator) DeepCopyInto(out *TargetAllocator) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAllocator. -func (in *TargetAllocator) DeepCopy() *TargetAllocator { - if in == nil { - return nil - } - out := new(TargetAllocator) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *TargetAllocator) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TargetAllocatorEmbedded) DeepCopyInto(out *TargetAllocatorEmbedded) { *out = *in @@ -767,38 +740,6 @@ func (in *TargetAllocatorEmbedded) DeepCopy() *TargetAllocatorEmbedded { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TargetAllocatorList) DeepCopyInto(out *TargetAllocatorList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]OpenTelemetryCollector, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAllocatorList. -func (in *TargetAllocatorList) DeepCopy() *TargetAllocatorList { - if in == nil { - return nil - } - out := new(TargetAllocatorList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *TargetAllocatorList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TargetAllocatorPrometheusCR) DeepCopyInto(out *TargetAllocatorPrometheusCR) { *out = *in @@ -829,47 +770,6 @@ func (in *TargetAllocatorPrometheusCR) DeepCopy() *TargetAllocatorPrometheusCR { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TargetAllocatorSpec) DeepCopyInto(out *TargetAllocatorSpec) { - *out = *in - in.OpenTelemetryCommonFields.DeepCopyInto(&out.OpenTelemetryCommonFields) - in.CollectorSelector.DeepCopyInto(&out.CollectorSelector) - if in.ScrapeConfigs != nil { - in, out := &in.ScrapeConfigs, &out.ScrapeConfigs - *out = make([]AnyConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.PrometheusCR.DeepCopyInto(&out.PrometheusCR) - out.Observability = in.Observability -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAllocatorSpec. -func (in *TargetAllocatorSpec) DeepCopy() *TargetAllocatorSpec { - if in == nil { - return nil - } - out := new(TargetAllocatorSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TargetAllocatorStatus) DeepCopyInto(out *TargetAllocatorStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetAllocatorStatus. -func (in *TargetAllocatorStatus) DeepCopy() *TargetAllocatorStatus { - if in == nil { - return nil - } - out := new(TargetAllocatorStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Telemetry) DeepCopyInto(out *Telemetry) { *out = *in diff --git a/config/crd/bases/opentelemetry.io_targetallocators.yaml b/config/crd/bases/opentelemetry.io_targetallocators.yaml index 7d59d689c6..30346ed44f 100644 --- a/config/crd/bases/opentelemetry.io_targetallocators.yaml +++ b/config/crd/bases/opentelemetry.io_targetallocators.yaml @@ -14,7 +14,7 @@ spec: singular: targetallocator scope: Namespaced versions: - - name: v1beta1 + - name: v1alpha1 schema: openAPIV3Schema: properties: diff --git a/internal/manifests/collector/targetallocator.go b/internal/manifests/collector/targetallocator.go index 4083d4c3f7..4245efdd79 100644 --- a/internal/manifests/collector/targetallocator.go +++ b/internal/manifests/collector/targetallocator.go @@ -17,6 +17,7 @@ package collector import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" @@ -24,7 +25,7 @@ import ( ) // TargetAllocator builds the TargetAllocator CR for the given instance. -func TargetAllocator(params manifests.Params) (*v1beta1.TargetAllocator, error) { +func TargetAllocator(params manifests.Params) (*v1alpha1.TargetAllocator, error) { taSpec := params.OtelCol.Spec.TargetAllocator if !taSpec.Enabled { @@ -44,14 +45,14 @@ func TargetAllocator(params manifests.Params) (*v1beta1.TargetAllocator, error) return nil, err } - return &v1beta1.TargetAllocator{ + return &v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: params.OtelCol.Name, Namespace: params.OtelCol.Namespace, Annotations: params.OtelCol.Annotations, Labels: params.OtelCol.Labels, }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: taSpec.Replicas, NodeSelector: taSpec.NodeSelector, diff --git a/internal/manifests/collector/targetallocator_test.go b/internal/manifests/collector/targetallocator_test.go index 76a51b66ef..617234bb28 100644 --- a/internal/manifests/collector/targetallocator_test.go +++ b/internal/manifests/collector/targetallocator_test.go @@ -26,6 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" @@ -62,7 +63,7 @@ func TestTargetAllocator(t *testing.T) { testCases := []struct { name string input v1beta1.OpenTelemetryCollector - want *v1beta1.TargetAllocator + want *v1alpha1.TargetAllocator wantErr error }{ { @@ -87,9 +88,9 @@ func TestTargetAllocator(t *testing.T) { }, }, }, - want: &v1beta1.TargetAllocator{ + want: &v1alpha1.TargetAllocator{ ObjectMeta: objectMetadata, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ CollectorSelector: metav1.LabelSelector{ MatchLabels: manifestutils.SelectorLabels(objectMetadata, ComponentOpenTelemetryCollector), }, @@ -200,9 +201,9 @@ func TestTargetAllocator(t *testing.T) { Config: otelcolConfig, }, }, - want: &v1beta1.TargetAllocator{ + want: &v1alpha1.TargetAllocator{ ObjectMeta: objectMetadata, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: &replicas, NodeSelector: map[string]string{"key": "value"}, diff --git a/internal/manifests/manifestutils/labels.go b/internal/manifests/manifestutils/labels.go index 3605e38c12..943b642a0b 100644 --- a/internal/manifests/manifestutils/labels.go +++ b/internal/manifests/manifestutils/labels.go @@ -20,7 +20,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) @@ -86,7 +86,7 @@ func SelectorLabels(instance metav1.ObjectMeta, component string) map[string]str } // SelectorLabels return the selector labels for Target Allocator Pods. -func TASelectorLabels(instance v1beta1.TargetAllocator, component string) map[string]string { +func TASelectorLabels(instance v1alpha1.TargetAllocator, component string) map[string]string { selectorLabels := SelectorLabels(instance.ObjectMeta, component) // TargetAllocator uses the name label as well for selection diff --git a/internal/manifests/manifestutils/labels_test.go b/internal/manifests/manifestutils/labels_test.go index 22fc5eb33d..90faf23adc 100644 --- a/internal/manifests/manifestutils/labels_test.go +++ b/internal/manifests/manifestutils/labels_test.go @@ -21,7 +21,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) @@ -163,7 +162,7 @@ func TestSelectorLabels(t *testing.T) { "app.kubernetes.io/name": "my-opentelemetry-collector-targetallocator", "app.kubernetes.io/part-of": "opentelemetry", } - tainstance := v1beta1.TargetAllocator{ + tainstance := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{Name: "my-opentelemetry-collector", Namespace: "my-namespace"}, } @@ -176,7 +175,7 @@ func TestSelectorLabels(t *testing.T) { func TestLabelsTACommonSet(t *testing.T) { // prepare - tainstance := v1beta1.TargetAllocator{ + tainstance := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: taname, Namespace: tanamespace, @@ -195,7 +194,7 @@ func TestLabelsTACommonSet(t *testing.T) { func TestLabelsTAPropagateDown(t *testing.T) { // prepare - tainstance := v1beta1.TargetAllocator{ + tainstance := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "myapp": "mycomponent", @@ -218,7 +217,7 @@ func TestLabelsTAPropagateDown(t *testing.T) { func TestSelectorTALabels(t *testing.T) { // prepare - tainstance := v1beta1.TargetAllocator{ + tainstance := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: taname, Namespace: tanamespace, diff --git a/internal/manifests/params.go b/internal/manifests/params.go index de80cbc966..7e12a74b4d 100644 --- a/internal/manifests/params.go +++ b/internal/manifests/params.go @@ -32,7 +32,7 @@ type Params struct { Scheme *runtime.Scheme Log logr.Logger OtelCol v1beta1.OpenTelemetryCollector - TargetAllocator v1beta1.TargetAllocator + TargetAllocator v1alpha1.TargetAllocator OpAMPBridge v1alpha1.OpAMPBridge Config config.Config } diff --git a/internal/manifests/targetallocator/annotations.go b/internal/manifests/targetallocator/annotations.go index 7666bd64ab..263b6234b1 100644 --- a/internal/manifests/targetallocator/annotations.go +++ b/internal/manifests/targetallocator/annotations.go @@ -20,14 +20,14 @@ import ( v1 "k8s.io/api/core/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" ) const configMapHashAnnotationKey = "opentelemetry-targetallocator-config/hash" // Annotations returns the annotations for the TargetAllocator Pod. -func Annotations(instance v1beta1.TargetAllocator, configMap *v1.ConfigMap, filterAnnotations []string) map[string]string { +func Annotations(instance v1alpha1.TargetAllocator, configMap *v1.ConfigMap, filterAnnotations []string) map[string]string { // Make a copy of PodAnnotations to be safe annotations := make(map[string]string, len(instance.Spec.PodAnnotations)) for key, value := range instance.Spec.PodAnnotations { diff --git a/internal/manifests/targetallocator/container.go b/internal/manifests/targetallocator/container.go index 17e8d3772f..f23bae177b 100644 --- a/internal/manifests/targetallocator/container.go +++ b/internal/manifests/targetallocator/container.go @@ -20,13 +20,13 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // Container builds a container for the given TargetAllocator. -func Container(cfg config.Config, logger logr.Logger, instance v1beta1.TargetAllocator) corev1.Container { +func Container(cfg config.Config, logger logr.Logger, instance v1alpha1.TargetAllocator) corev1.Container { image := instance.Spec.Image if len(image) == 0 { image = cfg.TargetAllocatorImage() diff --git a/internal/manifests/targetallocator/container_test.go b/internal/manifests/targetallocator/container_test.go index fb9ef9fe2d..db2305d4b8 100644 --- a/internal/manifests/targetallocator/container_test.go +++ b/internal/manifests/targetallocator/container_test.go @@ -25,6 +25,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" logf "sigs.k8s.io/controller-runtime/pkg/log" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -34,7 +35,7 @@ var logger = logf.Log.WithName("unit-tests") func TestContainerNewDefault(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{} + targetAllocator := v1alpha1.TargetAllocator{} cfg := config.New(config.WithTargetAllocatorImage("default-image")) // test @@ -46,8 +47,8 @@ func TestContainerNewDefault(t *testing.T) { func TestContainerWithImageOverridden(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{ - Spec: v1beta1.TargetAllocatorSpec{ + targetAllocator := v1alpha1.TargetAllocator{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "overridden-image", }, @@ -64,7 +65,7 @@ func TestContainerWithImageOverridden(t *testing.T) { func TestContainerPorts(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{} + targetAllocator := v1alpha1.TargetAllocator{} cfg := config.New() // test @@ -78,7 +79,7 @@ func TestContainerPorts(t *testing.T) { func TestContainerVolumes(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{} + targetAllocator := v1alpha1.TargetAllocator{} cfg := config.New() // test @@ -90,8 +91,8 @@ func TestContainerVolumes(t *testing.T) { } func TestContainerResourceRequirements(t *testing.T) { - targetAllocator := v1beta1.TargetAllocator{ - Spec: v1beta1.TargetAllocatorSpec{ + targetAllocator := v1alpha1.TargetAllocator{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ @@ -128,8 +129,8 @@ func TestContainerResourceRequirements(t *testing.T) { func TestContainerHasEnvVars(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{ - Spec: v1beta1.TargetAllocatorSpec{ + targetAllocator := v1alpha1.TargetAllocator{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Env: []corev1.EnvVar{ { @@ -212,8 +213,8 @@ func TestContainerHasProxyEnvVars(t *testing.T) { defer os.Unsetenv("NO_PROXY") // prepare - targetAllocator := v1beta1.TargetAllocator{ - Spec: v1beta1.TargetAllocatorSpec{ + targetAllocator := v1alpha1.TargetAllocator{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Env: []corev1.EnvVar{ { @@ -237,8 +238,8 @@ func TestContainerHasProxyEnvVars(t *testing.T) { func TestContainerDoesNotOverrideEnvVars(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{ - Spec: v1beta1.TargetAllocatorSpec{ + targetAllocator := v1alpha1.TargetAllocator{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Env: []corev1.EnvVar{ { @@ -302,7 +303,7 @@ func TestContainerDoesNotOverrideEnvVars(t *testing.T) { assert.Equal(t, expected, c) } func TestReadinessProbe(t *testing.T) { - targetAllocator := v1beta1.TargetAllocator{} + targetAllocator := v1alpha1.TargetAllocator{} cfg := config.New() expected := &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ @@ -321,7 +322,7 @@ func TestReadinessProbe(t *testing.T) { } func TestLivenessProbe(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{} + targetAllocator := v1alpha1.TargetAllocator{} cfg := config.New() expected := &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ @@ -345,8 +346,8 @@ func TestSecurityContext(t *testing.T) { RunAsNonRoot: &runAsNonRoot, } // prepare - targetAllocator := v1beta1.TargetAllocator{ - Spec: v1beta1.TargetAllocatorSpec{ + targetAllocator := v1alpha1.TargetAllocator{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ SecurityContext: securityContext, }, diff --git a/internal/manifests/targetallocator/deployment_test.go b/internal/manifests/targetallocator/deployment_test.go index 1767696fdb..e4d5759f0a 100644 --- a/internal/manifests/targetallocator/deployment_test.go +++ b/internal/manifests/targetallocator/deployment_test.go @@ -24,6 +24,7 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" @@ -79,7 +80,7 @@ var testSecurityContextValue = &v1.PodSecurityContext{ func TestDeploymentSecurityContext(t *testing.T) { // Test default - targetallocator11 := v1beta1.TargetAllocator{ + targetallocator11 := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -99,11 +100,11 @@ func TestDeploymentSecurityContext(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.SecurityContext) // Test SecurityContext - targetAllocator2 := v1beta1.TargetAllocator{ + targetAllocator2 := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-securitycontext", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodSecurityContext: testSecurityContextValue, }, @@ -208,7 +209,7 @@ func collectorInstance() v1beta1.OpenTelemetryCollector { } } -func targetAllocatorInstance() v1beta1.TargetAllocator { +func targetAllocatorInstance() v1alpha1.TargetAllocator { collectorInstance := collectorInstance() collectorInstance.Spec.TargetAllocator.Enabled = true params := manifests.Params{OtelCol: collectorInstance} @@ -219,7 +220,7 @@ func targetAllocatorInstance() v1beta1.TargetAllocator { func TestDeploymentNodeSelector(t *testing.T) { // Test default - targetAllocator1 := v1beta1.TargetAllocator{} + targetAllocator1 := v1alpha1.TargetAllocator{} cfg := config.New() @@ -233,11 +234,11 @@ func TestDeploymentNodeSelector(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.NodeSelector) // Test nodeSelector - targetAllocator2 := v1beta1.TargetAllocator{ + targetAllocator2 := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-nodeselector", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ NodeSelector: map[string]string{ "node-key": "node-value", @@ -261,7 +262,7 @@ func TestDeploymentNodeSelector(t *testing.T) { func TestDeploymentAffinity(t *testing.T) { // Test default - targetAllocator1 := v1beta1.TargetAllocator{} + targetAllocator1 := v1alpha1.TargetAllocator{} cfg := config.New() @@ -275,11 +276,11 @@ func TestDeploymentAffinity(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.Affinity) // Test affinity - targetAllocator2 := v1beta1.TargetAllocator{ + targetAllocator2 := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-affinity", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Affinity: testAffinityValue, }, @@ -301,7 +302,7 @@ func TestDeploymentAffinity(t *testing.T) { func TestDeploymentTolerations(t *testing.T) { // Test default - targetAllocator1 := v1beta1.TargetAllocator{ + targetAllocator1 := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -319,11 +320,11 @@ func TestDeploymentTolerations(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.Tolerations) // Test Tolerations - targetAllocator2 := v1beta1.TargetAllocator{ + targetAllocator2 := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-toleration", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Tolerations: testTolerationValues, }, @@ -345,7 +346,7 @@ func TestDeploymentTolerations(t *testing.T) { func TestDeploymentTopologySpreadConstraints(t *testing.T) { // Test default - targetAllocator1 := v1beta1.TargetAllocator{ + targetAllocator1 := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -364,11 +365,11 @@ func TestDeploymentTopologySpreadConstraints(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.TopologySpreadConstraints) // Test TopologySpreadConstraints - targetAllocator2 := v1beta1.TargetAllocator{ + targetAllocator2 := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-topologyspreadconstraint", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ TopologySpreadConstraints: testTopologySpreadConstraintValue, }, diff --git a/internal/manifests/targetallocator/poddisruptionbudget_test.go b/internal/manifests/targetallocator/poddisruptionbudget_test.go index 3beb7d1ee3..40ff03e64c 100644 --- a/internal/manifests/targetallocator/poddisruptionbudget_test.go +++ b/internal/manifests/targetallocator/poddisruptionbudget_test.go @@ -21,6 +21,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" @@ -66,11 +67,11 @@ var tests = []test{ func TestPDBWithValidStrategy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - targetAllocator := v1beta1.TargetAllocator{ + targetAllocator := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: test.MinAvailable, @@ -100,11 +101,11 @@ func TestPDBWithValidStrategy(t *testing.T) { func TestPDBWithNotValidStrategy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - targetAllocator := v1beta1.TargetAllocator{ + targetAllocator := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: test.MinAvailable, @@ -129,8 +130,8 @@ func TestPDBWithNotValidStrategy(t *testing.T) { } func TestNoPDB(t *testing.T) { - targetAllocator := v1beta1.TargetAllocator{ - Spec: v1beta1.TargetAllocatorSpec{ + targetAllocator := v1alpha1.TargetAllocator{ + Spec: v1alpha1.TargetAllocatorSpec{ AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyLeastWeighted, }, } diff --git a/internal/manifests/targetallocator/serviceaccount.go b/internal/manifests/targetallocator/serviceaccount.go index e38e64b557..05ae797ef1 100644 --- a/internal/manifests/targetallocator/serviceaccount.go +++ b/internal/manifests/targetallocator/serviceaccount.go @@ -18,14 +18,14 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // ServiceAccountName returns the name of the existing or self-provisioned service account to use for the given instance. -func ServiceAccountName(instance v1beta1.TargetAllocator) string { +func ServiceAccountName(instance v1alpha1.TargetAllocator) string { if len(instance.Spec.ServiceAccount) == 0 { return naming.TargetAllocatorServiceAccount(instance.Name) } diff --git a/internal/manifests/targetallocator/serviceaccount_test.go b/internal/manifests/targetallocator/serviceaccount_test.go index f8bd532f9e..85d11c1c50 100644 --- a/internal/manifests/targetallocator/serviceaccount_test.go +++ b/internal/manifests/targetallocator/serviceaccount_test.go @@ -21,6 +21,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" @@ -28,7 +29,7 @@ import ( func TestServiceAccountDefaultName(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{ + targetAllocator := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -43,11 +44,11 @@ func TestServiceAccountDefaultName(t *testing.T) { func TestServiceAccountOverrideName(t *testing.T) { // prepare - targetAllocator := v1beta1.TargetAllocator{ + targetAllocator := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ ServiceAccount: "my-special-sa", }, @@ -63,7 +64,7 @@ func TestServiceAccountOverrideName(t *testing.T) { func TestServiceAccountDefault(t *testing.T) { params := manifests.Params{ - TargetAllocator: v1beta1.TargetAllocator{ + TargetAllocator: v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -87,11 +88,11 @@ func TestServiceAccountDefault(t *testing.T) { func TestServiceAccountOverride(t *testing.T) { params := manifests.Params{ - TargetAllocator: v1beta1.TargetAllocator{ + TargetAllocator: v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ ServiceAccount: "my-special-sa", }, diff --git a/internal/manifests/targetallocator/servicemonitor_test.go b/internal/manifests/targetallocator/servicemonitor_test.go index a39c5aec46..dbe31a505c 100644 --- a/internal/manifests/targetallocator/servicemonitor_test.go +++ b/internal/manifests/targetallocator/servicemonitor_test.go @@ -21,18 +21,19 @@ import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" ) func TestDesiredServiceMonitors(t *testing.T) { - ta := v1beta1.TargetAllocator{ + ta := v1alpha1.TargetAllocator{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1beta1.TargetAllocatorSpec{ + Spec: v1alpha1.TargetAllocatorSpec{ OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Tolerations: testTolerationValues, }, diff --git a/internal/manifests/targetallocator/volume.go b/internal/manifests/targetallocator/volume.go index 3651a9d3ae..2da3a961b2 100644 --- a/internal/manifests/targetallocator/volume.go +++ b/internal/manifests/targetallocator/volume.go @@ -17,13 +17,13 @@ package targetallocator import ( corev1 "k8s.io/api/core/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // Volumes builds the volumes for the given instance, including the config map volume. -func Volumes(cfg config.Config, instance v1beta1.TargetAllocator) []corev1.Volume { +func Volumes(cfg config.Config, instance v1alpha1.TargetAllocator) []corev1.Volume { volumes := []corev1.Volume{{ Name: naming.TAConfigMapVolume(), VolumeSource: corev1.VolumeSource{ diff --git a/internal/manifests/targetallocator/volume_test.go b/internal/manifests/targetallocator/volume_test.go index 052e1fb20d..6d255e849c 100644 --- a/internal/manifests/targetallocator/volume_test.go +++ b/internal/manifests/targetallocator/volume_test.go @@ -19,14 +19,14 @@ import ( "github.com/stretchr/testify/assert" - "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" + "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) func TestVolumeNewDefault(t *testing.T) { // prepare - otelcol := v1beta1.TargetAllocator{} + otelcol := v1alpha1.TargetAllocator{} cfg := config.New() // test