From e1532e409c3b7c19ddd55b1f6fc78e4891978455 Mon Sep 17 00:00:00 2001 From: "Mohamed S. Mahmoud" Date: Thu, 30 Mar 2023 10:46:11 -0400 Subject: [PATCH] NETOBSERV-904: Make v1beta1 the storage version (#308) * NETOBSERV-904: Make v1beta1 the stored version Signed-off-by: msherif1234 * use none default value when update flowcollector object to recreate SM Signed-off-by: msherif1234 --------- Signed-off-by: msherif1234 --- api/v1alpha1/flowcollector_types.go | 15 +++++++-------- api/v1beta1/flowcollector_types.go | 2 ++ .../flows.netobserv.io_flowcollectors.yaml | 4 ++-- .../bases/flows.netobserv.io_flowcollectors.yaml | 4 ++-- .../flowcollector_controller_console_test.go | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/api/v1alpha1/flowcollector_types.go b/api/v1alpha1/flowcollector_types.go index 7859f420d..34fa98eef 100644 --- a/api/v1alpha1/flowcollector_types.go +++ b/api/v1alpha1/flowcollector_types.go @@ -654,14 +654,13 @@ type FlowCollectorStatus struct { Namespace string `json:"namespace,omitempty"` } -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:resource:scope=Cluster -//+kubebuilder:printcolumn:name="Agent",type="string",JSONPath=`.spec.agent.type` -//+kubebuilder:printcolumn:name="Sampling (EBPF)",type="string",JSONPath=`.spec.agent.ebpf.sampling` -//+kubebuilder:printcolumn:name="Deployment Model",type="string",JSONPath=`.spec.deploymentModel` -//+kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[*].reason" -// +kubebuilder:storageversion +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:printcolumn:name="Agent",type="string",JSONPath=`.spec.agent.type` +// +kubebuilder:printcolumn:name="Sampling (EBPF)",type="string",JSONPath=`.spec.agent.ebpf.sampling` +// +kubebuilder:printcolumn:name="Deployment Model",type="string",JSONPath=`.spec.deploymentModel` +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[*].reason" // FlowCollector is the Schema for the flowcollectors API, which pilots and configures netflow collection. type FlowCollector struct { diff --git a/api/v1beta1/flowcollector_types.go b/api/v1beta1/flowcollector_types.go index 8ff0024b3..031c04ff2 100644 --- a/api/v1beta1/flowcollector_types.go +++ b/api/v1beta1/flowcollector_types.go @@ -710,6 +710,8 @@ type FlowCollectorStatus struct { // +kubebuilder:printcolumn:name="Sampling (EBPF)",type="string",JSONPath=`.spec.agent.ebpf.sampling` // +kubebuilder:printcolumn:name="Deployment Model",type="string",JSONPath=`.spec.deploymentModel` // +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[*].reason" +// +kubebuilder:storageversion + // FlowCollector is the Schema for the flowcollectors API, which pilots and configures netflow collection. type FlowCollector struct { metav1.TypeMeta `json:",inline"` diff --git a/bundle/manifests/flows.netobserv.io_flowcollectors.yaml b/bundle/manifests/flows.netobserv.io_flowcollectors.yaml index ef3a18802..400831e05 100644 --- a/bundle/manifests/flows.netobserv.io_flowcollectors.yaml +++ b/bundle/manifests/flows.netobserv.io_flowcollectors.yaml @@ -2153,7 +2153,7 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - additionalPrinterColumns: @@ -4386,7 +4386,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} status: diff --git a/config/crd/bases/flows.netobserv.io_flowcollectors.yaml b/config/crd/bases/flows.netobserv.io_flowcollectors.yaml index 9e1009774..fdd21118d 100644 --- a/config/crd/bases/flows.netobserv.io_flowcollectors.yaml +++ b/config/crd/bases/flows.netobserv.io_flowcollectors.yaml @@ -2140,7 +2140,7 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} - additionalPrinterColumns: @@ -4373,7 +4373,7 @@ spec: type: object type: object served: true - storage: false + storage: true subresources: status: {} status: diff --git a/controllers/flowcollector_controller_console_test.go b/controllers/flowcollector_controller_console_test.go index 53d30d348..d100619bb 100644 --- a/controllers/flowcollector_controller_console_test.go +++ b/controllers/flowcollector_controller_console_test.go @@ -194,7 +194,7 @@ func flowCollectorConsolePluginSpecs() { // Do a dummy change that will trigger reconcile, and make sure SM is created again UpdateCR(crKey, func(fc *flowslatest.FlowCollector) { - fc.Spec.Processor.LogLevel = "info" + fc.Spec.Processor.LogLevel = "trace" }) By("Expecting ServiceMonitor to exist") Eventually(func() interface{} {