From ec675e7f593845b943ee355389fefc236109a20b Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Mon, 4 Mar 2024 18:01:34 +0100
Subject: [PATCH] Convert status object to v1beta2 (#2707)
Signed-off-by: Pavol Loffay
---
apis/v1alpha1/convert.go | 11 ++++++++++-
apis/v1beta1/opentelemetrycollector_types.go | 16 ++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/apis/v1alpha1/convert.go b/apis/v1alpha1/convert.go
index 9f8fbe0e37..6428f12619 100644
--- a/apis/v1alpha1/convert.go
+++ b/apis/v1alpha1/convert.go
@@ -26,8 +26,17 @@ import (
func Tov1beta1(in OpenTelemetryCollector) (v1beta1.OpenTelemetryCollector, error) {
copy := in.DeepCopy()
out := v1beta1.OpenTelemetryCollector{
- TypeMeta: copy.TypeMeta,
ObjectMeta: copy.ObjectMeta,
+
+ Status: v1beta1.OpenTelemetryCollectorStatus{
+ Scale: v1beta1.ScaleSubresourceStatus{
+ Selector: in.Status.Scale.Selector,
+ Replicas: in.Status.Scale.Replicas,
+ StatusReplicas: in.Status.Scale.StatusReplicas,
+ },
+ Version: in.Status.Version,
+ Image: in.Spec.Image,
+ },
}
cfg := &v1beta1.Config{}
diff --git a/apis/v1beta1/opentelemetrycollector_types.go b/apis/v1beta1/opentelemetrycollector_types.go
index 12359203ca..246bdbb0d5 100644
--- a/apis/v1beta1/opentelemetrycollector_types.go
+++ b/apis/v1beta1/opentelemetrycollector_types.go
@@ -310,8 +310,20 @@ type ConfigMapsSpec struct {
MountPath string `json:"mountpath"`
}
-//+kubebuilder:object:root=true
-//+kubebuilder:subresource:status
+// +kubebuilder:object:root=true
+// +kubebuilder:resource:shortName=otelcol;otelcols
+// +kubebuilder:subresource:status
+// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.scale.replicas,selectorpath=.status.scale.selector
+// +kubebuilder:printcolumn:name="Mode",type="string",JSONPath=".spec.mode",description="Deployment Mode"
+// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="OpenTelemetry Version"
+// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.scale.statusReplicas"
+// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
+// +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".status.image"
+// +kubebuilder:printcolumn:name="Management",type="string",JSONPath=".spec.managementState",description="Management State"
+// +operator-sdk:csv:customresourcedefinitions:displayName="OpenTelemetry Collector"
+// This annotation provides a hint for OLM which resources are managed by OpenTelemetryCollector kind.
+// It's not mandatory to list all resources.
+// +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1},{Deployment,apps/v1},{DaemonSets,apps/v1},{StatefulSets,apps/v1},{ConfigMaps,v1},{Service,v1}}
// OpenTelemetryCollector is the Schema for the opentelemetrycollectors API.
type OpenTelemetryCollector struct {