diff --git a/internal/status/opampbridge/handle.go b/internal/status/opampbridge/handle.go index 18e5719904..629b6de231 100644 --- a/internal/status/opampbridge/handle.go +++ b/internal/status/opampbridge/handle.go @@ -23,6 +23,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" + "github.com/open-telemetry/opentelemetry-operator/internal/version" ) const ( @@ -44,10 +45,8 @@ func HandleReconcileStatus(ctx context.Context, log logr.Logger, params manifest } changed := params.OpAMPBridge.DeepCopy() - statusErr := UpdateOpAMPBridgeStatus(ctx, params.Client, changed) - if statusErr != nil { - params.Recorder.Event(changed, eventTypeWarning, reasonStatusFailure, statusErr.Error()) - return ctrl.Result{}, statusErr + if changed.Status.Version == "" { + changed.Status.Version = version.OperatorOpAMPBridge() } statusPatch := client.MergeFrom(¶ms.OpAMPBridge) if err := params.Client.Status().Patch(ctx, changed, statusPatch); err != nil { diff --git a/internal/status/opampbridge/opampbridge.go b/internal/status/opampbridge/opampbridge.go deleted file mode 100644 index d09bfbf8aa..0000000000 --- a/internal/status/opampbridge/opampbridge.go +++ /dev/null @@ -1,31 +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 opampbridge - -import ( - "context" - - "sigs.k8s.io/controller-runtime/pkg/client" - - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/internal/version" -) - -func UpdateOpAMPBridgeStatus(ctx context.Context, cli client.Client, changed *v1alpha1.OpAMPBridge) error { - if changed.Status.Version == "" { - changed.Status.Version = version.OperatorOpAMPBridge() - } - return nil -} diff --git a/internal/status/targetallocator/handle.go b/internal/status/targetallocator/handle.go index 82750ff006..122040cddc 100644 --- a/internal/status/targetallocator/handle.go +++ b/internal/status/targetallocator/handle.go @@ -23,6 +23,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/targetallocator" + "github.com/open-telemetry/opentelemetry-operator/internal/version" ) const ( @@ -44,10 +45,8 @@ func HandleReconcileStatus(ctx context.Context, log logr.Logger, params targetal } changed := params.TargetAllocator.DeepCopy() - statusErr := UpdateTargetAllocatorStatus(ctx, params.Client, changed) - if statusErr != nil { - params.Recorder.Event(changed, eventTypeWarning, reasonStatusFailure, statusErr.Error()) - return ctrl.Result{}, statusErr + if changed.Status.Version == "" { + changed.Status.Version = version.TargetAllocator() } statusPatch := client.MergeFrom(¶ms.TargetAllocator) if err := params.Client.Status().Patch(ctx, changed, statusPatch); err != nil { diff --git a/internal/status/targetallocator/targetallocator.go b/internal/status/targetallocator/targetallocator.go deleted file mode 100644 index 8c0df97260..0000000000 --- a/internal/status/targetallocator/targetallocator.go +++ /dev/null @@ -1,31 +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 targetallocator - -import ( - "context" - - "sigs.k8s.io/controller-runtime/pkg/client" - - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/internal/version" -) - -func UpdateTargetAllocatorStatus(ctx context.Context, cli client.Client, changed *v1alpha1.TargetAllocator) error { - if changed.Status.Version == "" { - changed.Status.Version = version.TargetAllocator() - } - return nil -}