Skip to content

Commit 8b9f781

Browse files
authored
Convert status object to v1beta2 (#2707)
Signed-off-by: Pavol Loffay <[email protected]>
1 parent f8d961b commit 8b9f781

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

apis/v1alpha1/convert.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,17 @@ import (
2626
func Tov1beta1(in OpenTelemetryCollector) (v1beta1.OpenTelemetryCollector, error) {
2727
copy := in.DeepCopy()
2828
out := v1beta1.OpenTelemetryCollector{
29-
TypeMeta: copy.TypeMeta,
3029
ObjectMeta: copy.ObjectMeta,
30+
31+
Status: v1beta1.OpenTelemetryCollectorStatus{
32+
Scale: v1beta1.ScaleSubresourceStatus{
33+
Selector: in.Status.Scale.Selector,
34+
Replicas: in.Status.Scale.Replicas,
35+
StatusReplicas: in.Status.Scale.StatusReplicas,
36+
},
37+
Version: in.Status.Version,
38+
Image: in.Spec.Image,
39+
},
3140
}
3241

3342
cfg := &v1beta1.Config{}

apis/v1beta1/opentelemetrycollector_types.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,20 @@ type ConfigMapsSpec struct {
310310
MountPath string `json:"mountpath"`
311311
}
312312

313-
//+kubebuilder:object:root=true
314-
//+kubebuilder:subresource:status
313+
// +kubebuilder:object:root=true
314+
// +kubebuilder:resource:shortName=otelcol;otelcols
315+
// +kubebuilder:subresource:status
316+
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.scale.replicas,selectorpath=.status.scale.selector
317+
// +kubebuilder:printcolumn:name="Mode",type="string",JSONPath=".spec.mode",description="Deployment Mode"
318+
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="OpenTelemetry Version"
319+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.scale.statusReplicas"
320+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
321+
// +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".status.image"
322+
// +kubebuilder:printcolumn:name="Management",type="string",JSONPath=".spec.managementState",description="Management State"
323+
// +operator-sdk:csv:customresourcedefinitions:displayName="OpenTelemetry Collector"
324+
// This annotation provides a hint for OLM which resources are managed by OpenTelemetryCollector kind.
325+
// It's not mandatory to list all resources.
326+
// +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1},{Deployment,apps/v1},{DaemonSets,apps/v1},{StatefulSets,apps/v1},{ConfigMaps,v1},{Service,v1}}
315327

316328
// OpenTelemetryCollector is the Schema for the opentelemetrycollectors API.
317329
type OpenTelemetryCollector struct {

0 commit comments

Comments
 (0)