Skip to content

Commit

Permalink
Convert status object to v1beta2 (#2707)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
  • Loading branch information
pavolloffay authored Mar 4, 2024
1 parent 1c25c13 commit ec675e7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
11 changes: 10 additions & 1 deletion apis/v1alpha1/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
16 changes: 14 additions & 2 deletions apis/v1beta1/opentelemetrycollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ec675e7

Please sign in to comment.