From 474d23683e235691a9a78a853f151eca33be4964 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Fri, 2 Feb 2024 13:35:47 +0100 Subject: [PATCH] Drop Debug fields These fields were redundant. Crashing pods can be debugged via oc debug. Implements: OSPRH-4290 --- .../ovn.openstack.org_ovncontrollers.yaml | 10 - .../ovn.openstack.org_ovndbclusters.yaml | 10 - api/bases/ovn.openstack.org_ovnnorthds.yaml | 10 - api/v1beta1/ovncontroller_types.go | 15 +- api/v1beta1/ovndbcluster_types.go | 13 - api/v1beta1/ovnnorthd_types.go | 13 - api/v1beta1/zz_generated.deepcopy.go | 48 --- .../ovn.openstack.org_ovncontrollers.yaml | 10 - .../ovn.openstack.org_ovndbclusters.yaml | 10 - .../bases/ovn.openstack.org_ovnnorthds.yaml | 10 - pkg/ovncontroller/daemonset.go | 115 ++---- pkg/ovndbcluster/statefulset.go | 48 +-- pkg/ovnnorthd/deployment.go | 32 +- .../ovncontroller_controller_test.go | 40 -- .../ovndbcluster_controller_test.go | 25 -- tests/functional/ovnnorthd_controller_test.go | 27 -- tests/kuttl/tests/ovn_debug/01-assert.yaml | 389 ------------------ .../kuttl/tests/ovn_debug/01-deploy-ovn.yaml | 9 - .../kuttl/tests/ovn_debug/02-cleanup-ovn.yaml | 1 - tests/kuttl/tests/ovn_debug/02-errors.yaml | 1 - 20 files changed, 67 insertions(+), 769 deletions(-) delete mode 100644 tests/kuttl/tests/ovn_debug/01-assert.yaml delete mode 100644 tests/kuttl/tests/ovn_debug/01-deploy-ovn.yaml delete mode 120000 tests/kuttl/tests/ovn_debug/02-cleanup-ovn.yaml delete mode 120000 tests/kuttl/tests/ovn_debug/02-errors.yaml diff --git a/api/bases/ovn.openstack.org_ovncontrollers.yaml b/api/bases/ovn.openstack.org_ovncontrollers.yaml index 8f436fc1..0ca4a400 100644 --- a/api/bases/ovn.openstack.org_ovncontrollers.yaml +++ b/api/bases/ovn.openstack.org_ovncontrollers.yaml @@ -48,16 +48,6 @@ spec: spec: description: OVNControllerSpec defines the desired state of OVNController properties: - debug: - description: Debug - enable debug for different deploy stages. If - an init container is used, it runs and the actual action pod gets - started with sleep infinity - properties: - service: - default: false - description: Service enable debug - type: boolean - type: object external-ids: description: OVSExternalIDs is a set of configuration options for OVS external-ids table diff --git a/api/bases/ovn.openstack.org_ovndbclusters.yaml b/api/bases/ovn.openstack.org_ovndbclusters.yaml index 0ccff2e8..707ff022 100644 --- a/api/bases/ovn.openstack.org_ovndbclusters.yaml +++ b/api/bases/ovn.openstack.org_ovndbclusters.yaml @@ -57,16 +57,6 @@ spec: description: DBType - NB or SB pattern: ^NB|SB$ type: string - debug: - description: Debug - enable debug for different deploy stages. If - an init container is used, it runs and the actual action pod gets - started with sleep infinity - properties: - service: - default: false - description: Service enable debug - type: boolean - type: object electionTimer: default: 10000 description: OVN Northbound and Southbound RAFT db election timer diff --git a/api/bases/ovn.openstack.org_ovnnorthds.yaml b/api/bases/ovn.openstack.org_ovnnorthds.yaml index d28114a4..1eb34313 100644 --- a/api/bases/ovn.openstack.org_ovnnorthds.yaml +++ b/api/bases/ovn.openstack.org_ovnnorthds.yaml @@ -52,16 +52,6 @@ spec: description: ContainerImage - Container Image URL (will be set to environmental default if empty) type: string - debug: - description: Debug - enable debug for different deploy stages. If - an init container is used, it runs and the actual action pod gets - started with sleep infinity - properties: - service: - default: false - description: Service enable debug - type: boolean - type: object logLevel: default: info description: LogLevel - Set log level info, dbg, emer etc diff --git a/api/v1beta1/ovncontroller_types.go b/api/v1beta1/ovncontroller_types.go index 9beddd42..64e81707 100644 --- a/api/v1beta1/ovncontroller_types.go +++ b/api/v1beta1/ovncontroller_types.go @@ -49,11 +49,6 @@ type OVNControllerSpec struct { // Image used for the ovn-controller container (will be set to environmental default if empty) OvnContainerImage string `json:"ovnContainerImage"` - // +kubebuilder:validation:Optional - // Debug - enable debug for different deploy stages. If an init container is used, it runs and the - // actual action pod gets started with sleep infinity - Debug OVNControllerDebug `json:"debug,omitempty"` - // +kubebuilder:validation:Optional // +optional NicMappings map[string]string `json:"nicMappings,omitempty"` @@ -80,14 +75,6 @@ type OVNControllerSpec struct { NetworkAttachments []string `json:"networkAttachments,omitempty"` } -// OVNControllerDebug defines the observed state of OVNControllerDebug -type OVNControllerDebug struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - // Service enable debug - Service bool `json:"service"` -} - // OVNControllerStatus defines the observed state of OVNController type OVNControllerStatus struct { // NumberReady of the OVNController instances @@ -145,7 +132,7 @@ func (instance OVNController) IsReady() bool { type OVSExternalIDs struct { // +kubebuilder:validation:Optional // +kubebuilder:default="random" - SystemID string `json:"system-id,omitempty"` + SystemID string `json:"system-id,omitempty"` // +kubebuilder:validation:Optional // +kubebuilder:default="br-int" diff --git a/api/v1beta1/ovndbcluster_types.go b/api/v1beta1/ovndbcluster_types.go index 07f78a06..3ec9ed54 100644 --- a/api/v1beta1/ovndbcluster_types.go +++ b/api/v1beta1/ovndbcluster_types.go @@ -72,11 +72,6 @@ type OVNDBClusterSpec struct { // LogLevel - Set log level info, dbg, emer etc LogLevel string `json:"logLevel"` - // +kubebuilder:validation:Optional - // Debug - enable debug for different deploy stages. If an init container is used, it runs and the - // actual action pod gets started with sleep infinity - Debug OVNDBClusterDebug `json:"debug,omitempty"` - // +kubebuilder:validation:Optional // +kubebuilder:default=10000 // OVN Northbound and Southbound RAFT db election timer to use on db creation (in milliseconds) @@ -111,14 +106,6 @@ type OVNDBClusterSpec struct { NetworkAttachment string `json:"networkAttachment"` } -// OVNDBclusterDebug defines the observed state of OVNDBClusterDebug -type OVNDBClusterDebug struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - // Service enable debug - Service bool `json:"service"` -} - // OVNDBClusterStatus defines the observed state of OVNDBCluster type OVNDBClusterStatus struct { // ReadyCount of OVN DBCluster instances diff --git a/api/v1beta1/ovnnorthd_types.go b/api/v1beta1/ovnnorthd_types.go index cb332710..93f1962e 100644 --- a/api/v1beta1/ovnnorthd_types.go +++ b/api/v1beta1/ovnnorthd_types.go @@ -43,11 +43,6 @@ type OVNNorthdSpec struct { // Replicas of OVN Northd to run Replicas *int32 `json:"replicas"` - // +kubebuilder:validation:Optional - // Debug - enable debug for different deploy stages. If an init container is used, it runs and the - // actual action pod gets started with sleep infinity - Debug OVNNorthdDebug `json:"debug,omitempty"` - // +kubebuilder:validation:Optional // NodeSelector to target subset of worker nodes running this service NodeSelector map[string]string `json:"nodeSelector,omitempty"` @@ -68,14 +63,6 @@ type OVNNorthdSpec struct { NetworkAttachment string `json:"networkAttachment"` } -// OVNNorthdDebug defines the observed state of NeutronAPIDebug -type OVNNorthdDebug struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - // Service enable debug - Service bool `json:"service"` -} - // OVNNorthdStatus defines the observed state of OVNNorthd type OVNNorthdStatus struct { // ReadyCount of OVN Northd instances diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 125c4674..db92a653 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -53,21 +53,6 @@ func (in *OVNController) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OVNControllerDebug) DeepCopyInto(out *OVNControllerDebug) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OVNControllerDebug. -func (in *OVNControllerDebug) DeepCopy() *OVNControllerDebug { - if in == nil { - return nil - } - out := new(OVNControllerDebug) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OVNControllerList) DeepCopyInto(out *OVNControllerList) { *out = *in @@ -104,7 +89,6 @@ func (in *OVNControllerList) DeepCopyObject() runtime.Object { func (in *OVNControllerSpec) DeepCopyInto(out *OVNControllerSpec) { *out = *in in.ExternalIDS.DeepCopyInto(&out.ExternalIDS) - out.Debug = in.Debug if in.NicMappings != nil { in, out := &in.NicMappings, &out.NicMappings *out = make(map[string]string, len(*in)) @@ -208,21 +192,6 @@ func (in *OVNDBCluster) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OVNDBClusterDebug) DeepCopyInto(out *OVNDBClusterDebug) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OVNDBClusterDebug. -func (in *OVNDBClusterDebug) DeepCopy() *OVNDBClusterDebug { - if in == nil { - return nil - } - out := new(OVNDBClusterDebug) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OVNDBClusterDefaults) DeepCopyInto(out *OVNDBClusterDefaults) { *out = *in @@ -285,7 +254,6 @@ func (in *OVNDBClusterSpec) DeepCopyInto(out *OVNDBClusterSpec) { (*out)[key] = val } } - out.Debug = in.Debug in.Resources.DeepCopyInto(&out.Resources) } @@ -370,21 +338,6 @@ func (in *OVNNorthd) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OVNNorthdDebug) DeepCopyInto(out *OVNNorthdDebug) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OVNNorthdDebug. -func (in *OVNNorthdDebug) DeepCopy() *OVNNorthdDebug { - if in == nil { - return nil - } - out := new(OVNNorthdDebug) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OVNNorthdDefaults) DeepCopyInto(out *OVNNorthdDefaults) { *out = *in @@ -440,7 +393,6 @@ func (in *OVNNorthdSpec) DeepCopyInto(out *OVNNorthdSpec) { *out = new(int32) **out = **in } - out.Debug = in.Debug if in.NodeSelector != nil { in, out := &in.NodeSelector, &out.NodeSelector *out = make(map[string]string, len(*in)) diff --git a/config/crd/bases/ovn.openstack.org_ovncontrollers.yaml b/config/crd/bases/ovn.openstack.org_ovncontrollers.yaml index 8f436fc1..0ca4a400 100644 --- a/config/crd/bases/ovn.openstack.org_ovncontrollers.yaml +++ b/config/crd/bases/ovn.openstack.org_ovncontrollers.yaml @@ -48,16 +48,6 @@ spec: spec: description: OVNControllerSpec defines the desired state of OVNController properties: - debug: - description: Debug - enable debug for different deploy stages. If - an init container is used, it runs and the actual action pod gets - started with sleep infinity - properties: - service: - default: false - description: Service enable debug - type: boolean - type: object external-ids: description: OVSExternalIDs is a set of configuration options for OVS external-ids table diff --git a/config/crd/bases/ovn.openstack.org_ovndbclusters.yaml b/config/crd/bases/ovn.openstack.org_ovndbclusters.yaml index 0ccff2e8..707ff022 100644 --- a/config/crd/bases/ovn.openstack.org_ovndbclusters.yaml +++ b/config/crd/bases/ovn.openstack.org_ovndbclusters.yaml @@ -57,16 +57,6 @@ spec: description: DBType - NB or SB pattern: ^NB|SB$ type: string - debug: - description: Debug - enable debug for different deploy stages. If - an init container is used, it runs and the actual action pod gets - started with sleep infinity - properties: - service: - default: false - description: Service enable debug - type: boolean - type: object electionTimer: default: 10000 description: OVN Northbound and Southbound RAFT db election timer diff --git a/config/crd/bases/ovn.openstack.org_ovnnorthds.yaml b/config/crd/bases/ovn.openstack.org_ovnnorthds.yaml index d28114a4..1eb34313 100644 --- a/config/crd/bases/ovn.openstack.org_ovnnorthds.yaml +++ b/config/crd/bases/ovn.openstack.org_ovnnorthds.yaml @@ -52,16 +52,6 @@ spec: description: ContainerImage - Container Image URL (will be set to environmental default if empty) type: string - debug: - description: Debug - enable debug for different deploy stages. If - an init container is used, it runs and the actual action pod gets - started with sleep infinity - properties: - service: - default: false - description: Service enable debug - type: boolean - type: object logLevel: default: info description: LogLevel - Set log level info, dbg, emer etc diff --git a/pkg/ovncontroller/daemonset.go b/pkg/ovncontroller/daemonset.go index c75ff836..f9d09bec 100644 --- a/pkg/ovncontroller/daemonset.go +++ b/pkg/ovncontroller/daemonset.go @@ -49,10 +49,6 @@ func DaemonSet( InitialDelaySeconds: 3, } - noopCmd := []string{ - "/bin/true", - } - var ovsDbPreStopCmd []string var ovsDbCmd []string var ovsDbArgs []string @@ -65,74 +61,49 @@ func DaemonSet( var ovnControllerArgs []string var ovnControllerPreStopCmd []string - if instance.Spec.Debug.Service { - ovsDbLivenessProbe.Exec = &corev1.ExecAction{ - Command: noopCmd, - } - ovsDbCmd = []string{ - "/bin/sleep", - } - ovsDbArgs = []string{"infinity"} - ovsDbPreStopCmd = noopCmd - ovsVswitchdLivenessProbe.Exec = &corev1.ExecAction{ - Command: noopCmd, - } - ovsVswitchdCmd = []string{ - "/bin/sleep", - } - ovsVswitchdArgs = []string{"infinity"} - ovsVswitchdPreStopCmd = noopCmd - - ovnControllerCmd = []string{ - "/bin/sleep", - } - ovnControllerArgs = []string{"infinity"} - ovnControllerPreStopCmd = noopCmd - } else { - ovsDbLivenessProbe.Exec = &corev1.ExecAction{ - Command: []string{ - "/usr/bin/ovs-vsctl", - "show", - }, - } - ovsDbCmd = []string{ - "/usr/bin/dumb-init", - } - ovsDbArgs = []string{ - "--single-child", "--", "/usr/local/bin/container-scripts/start-ovsdb-server.sh", - } - // sleep is required as workaround for https://github.com/kubernetes/kubernetes/issues/39170 - ovsDbPreStopCmd = []string{ - "/usr/share/openvswitch/scripts/ovs-ctl", "stop", "--no-ovs-vswitchd", ";", "sleep", "2", - } - - ovsVswitchdLivenessProbe.Exec = &corev1.ExecAction{ - Command: []string{ - "/usr/bin/ovs-appctl", - "bond/show", - }, - } - ovsVswitchdCmd = []string{ - "/usr/sbin/ovs-vswitchd", - } - ovsVswitchdArgs = []string{ - "--pidfile", "--mlockall", - } - // sleep is required as workaround for https://github.com/kubernetes/kubernetes/issues/39170 - ovsVswitchdPreStopCmd = []string{ - "/usr/share/openvswitch/scripts/ovs-ctl", "stop", "--no-ovsdb-server", ";", "sleep", "2", - } - - ovnControllerCmd = []string{ - "/bin/bash", "-c", - } - ovnControllerArgs = []string{ - "/usr/local/bin/container-scripts/net_setup.sh && ovn-controller --pidfile unix:/run/openvswitch/db.sock", - } - // sleep is required as workaround for https://github.com/kubernetes/kubernetes/issues/39170 - ovnControllerPreStopCmd = []string{ - "/usr/share/ovn/scripts/ovn-ctl", "stop_controller", ";", "sleep", "2", - } + ovsDbLivenessProbe.Exec = &corev1.ExecAction{ + Command: []string{ + "/usr/bin/ovs-vsctl", + "show", + }, + } + ovsDbCmd = []string{ + "/usr/bin/dumb-init", + } + ovsDbArgs = []string{ + "--single-child", "--", "/usr/local/bin/container-scripts/start-ovsdb-server.sh", + } + // sleep is required as workaround for https://github.com/kubernetes/kubernetes/issues/39170 + ovsDbPreStopCmd = []string{ + "/usr/share/openvswitch/scripts/ovs-ctl", "stop", "--no-ovs-vswitchd", ";", "sleep", "2", + } + + ovsVswitchdLivenessProbe.Exec = &corev1.ExecAction{ + Command: []string{ + "/usr/bin/ovs-appctl", + "bond/show", + }, + } + ovsVswitchdCmd = []string{ + "/usr/sbin/ovs-vswitchd", + } + ovsVswitchdArgs = []string{ + "--pidfile", "--mlockall", + } + // sleep is required as workaround for https://github.com/kubernetes/kubernetes/issues/39170 + ovsVswitchdPreStopCmd = []string{ + "/usr/share/openvswitch/scripts/ovs-ctl", "stop", "--no-ovsdb-server", ";", "sleep", "2", + } + + ovnControllerCmd = []string{ + "/bin/bash", "-c", + } + ovnControllerArgs = []string{ + "/usr/local/bin/container-scripts/net_setup.sh && ovn-controller --pidfile unix:/run/openvswitch/db.sock", + } + // sleep is required as workaround for https://github.com/kubernetes/kubernetes/issues/39170 + ovnControllerPreStopCmd = []string{ + "/usr/share/ovn/scripts/ovn-ctl", "stop_controller", ";", "sleep", "2", } envVars := map[string]env.Setter{} diff --git a/pkg/ovndbcluster/statefulset.go b/pkg/ovndbcluster/statefulset.go index 89cf78ff..e9d1d3f7 100644 --- a/pkg/ovndbcluster/statefulset.go +++ b/pkg/ovndbcluster/statefulset.go @@ -53,43 +53,25 @@ func StatefulSet( InitialDelaySeconds: 5, } - noopCmd := []string{ - "/bin/true", - } var preStopCmd []string var postStartCmd []string cmd := []string{"/usr/bin/dumb-init"} - args := []string{"--single-child", "--", "/bin/bash", "-c"} - if instance.Spec.Debug.Service { - args = append(args, "/bin/sleep infinity") - livenessProbe.Exec = &corev1.ExecAction{ - Command: noopCmd, - } - - readinessProbe.Exec = &corev1.ExecAction{ - Command: noopCmd, - } - - postStartCmd = noopCmd - preStopCmd = noopCmd - } else { - args = append(args, ServiceCommand) - // - // https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ - // - livenessProbe.Exec = &corev1.ExecAction{ - Command: []string{ - "/usr/bin/pidof", "ovsdb-server", - }, - } - readinessProbe.Exec = livenessProbe.Exec + args := []string{"--single-child", "--", "/bin/bash", "-c", ServiceCommand} + // + // https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ + // + livenessProbe.Exec = &corev1.ExecAction{ + Command: []string{ + "/usr/bin/pidof", "ovsdb-server", + }, + } + readinessProbe.Exec = livenessProbe.Exec - postStartCmd = []string{ - "/usr/local/bin/container-scripts/settings.sh", - } - preStopCmd = []string{ - "/usr/local/bin/container-scripts/cleanup.sh", - } + postStartCmd = []string{ + "/usr/local/bin/container-scripts/settings.sh", + } + preStopCmd = []string{ + "/usr/local/bin/container-scripts/cleanup.sh", } lifecycle := &corev1.Lifecycle{ diff --git a/pkg/ovnnorthd/deployment.go b/pkg/ovnnorthd/deployment.go index 8488395d..0ae74f48 100644 --- a/pkg/ovnnorthd/deployment.go +++ b/pkg/ovnnorthd/deployment.go @@ -59,31 +59,15 @@ func Deployment( fmt.Sprintf("--ovnsb-db=%s", sbEndpoint), } - if instance.Spec.Debug.Service { - cmd = "/bin/sleep" - args = []string{"infinity"} - - noopCmd := []string{ - "/bin/true", - } - livenessProbe.Exec = &corev1.ExecAction{ - Command: noopCmd, - } - - readinessProbe.Exec = &corev1.ExecAction{ - Command: noopCmd, - } - } else { - // - // https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ - // - livenessProbe.Exec = &corev1.ExecAction{ - Command: []string{ - "/usr/bin/pidof", "ovn-northd", - }, - } - readinessProbe.Exec = livenessProbe.Exec + // + // https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ + // + livenessProbe.Exec = &corev1.ExecAction{ + Command: []string{ + "/usr/bin/pidof", "ovn-northd", + }, } + readinessProbe.Exec = livenessProbe.Exec envVars := map[string]env.Setter{} // TODO: Make confs customizable diff --git a/tests/functional/ovncontroller_controller_test.go b/tests/functional/ovncontroller_controller_test.go index 2ea62468..41d9dc2c 100644 --- a/tests/functional/ovncontroller_controller_test.go +++ b/tests/functional/ovncontroller_controller_test.go @@ -226,46 +226,6 @@ var _ = Describe("OVNController controller", func() { }) }) - When("A OVNController instance is created with debug on", func() { - BeforeEach(func() { - dbs := CreateOVNDBClusters(namespace, map[string][]string{}, 1) - DeferCleanup(DeleteOVNDBClusters, dbs) - spec := GetDefaultOVNControllerSpec() - spec.Debug = ovnv1.OVNControllerDebug{ - Service: true, - } - instance := CreateOVNController(namespace, spec) - DeferCleanup(th.DeleteInstance, instance) - }) - - It("Container commands to include debug commands", func() { - dsName := types.NamespacedName{ - Namespace: namespace, - Name: "ovn-controller", - } - ds := GetDaemonSet(dsName) - Expect(ds.Spec.Template.Spec.Containers).To(HaveLen(3)) - Expect(ds.Spec.Template.Spec.Containers[0].LivenessProbe.Exec.Command).To( - Equal([]string{"/bin/true"})) - Expect(ds.Spec.Template.Spec.Containers[0].Command[0]).Should(ContainSubstring("/bin/sleep")) - Expect(ds.Spec.Template.Spec.Containers[0].Args[0]).Should(ContainSubstring("infinity")) - Expect(ds.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To( - Equal([]string{"/bin/true"})) - - Expect(ds.Spec.Template.Spec.Containers[1].LivenessProbe.Exec.Command).To( - Equal([]string{"/bin/true"})) - Expect(ds.Spec.Template.Spec.Containers[1].Command[0]).Should(ContainSubstring("/bin/sleep")) - Expect(ds.Spec.Template.Spec.Containers[1].Args[0]).Should(ContainSubstring("infinity")) - Expect(ds.Spec.Template.Spec.Containers[1].Lifecycle.PreStop.Exec.Command).To( - Equal([]string{"/bin/true"})) - - Expect(ds.Spec.Template.Spec.Containers[2].Command[0]).Should(ContainSubstring("/bin/sleep")) - Expect(ds.Spec.Template.Spec.Containers[2].Args[0]).Should(ContainSubstring("infinity")) - Expect(ds.Spec.Template.Spec.Containers[2].Lifecycle.PreStop.Exec.Command).To( - Equal([]string{"/bin/true"})) - }) - }) - When("OVNController and OVNDBClusters are created with networkAttachments", func() { var OVNControllerName types.NamespacedName var dbs []types.NamespacedName diff --git a/tests/functional/ovndbcluster_controller_test.go b/tests/functional/ovndbcluster_controller_test.go index a24545e6..e046d0f6 100644 --- a/tests/functional/ovndbcluster_controller_test.go +++ b/tests/functional/ovndbcluster_controller_test.go @@ -215,31 +215,6 @@ var _ = Describe("OVNDBCluster controller", func() { }) }) - When("A OVNDBCluster instance is created with debug on", func() { - BeforeEach(func() { - spec := GetDefaultOVNDBClusterSpec() - spec.Debug.Service = true - instance := CreateOVNDBCluster(namespace, spec) - DeferCleanup(th.DeleteInstance, instance) - }) - - It("Container commands to include debug commands", func() { - ssName := types.NamespacedName{ - Namespace: namespace, - Name: "ovsdbserver-nb", - } - ss := th.GetStatefulSet(ssName) - Expect(ss.Spec.Template.Spec.Containers).To(HaveLen(1)) - Expect(ss.Spec.Template.Spec.Containers[0].LivenessProbe.Exec.Command).To( - Equal([]string{"/bin/true"})) - Expect(ss.Spec.Template.Spec.Containers[0].Args[4]).Should(ContainSubstring("sleep infinity")) - Expect(ss.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To( - Equal([]string{"/bin/true"})) - Expect(ss.Spec.Template.Spec.Containers[0].Lifecycle.PostStart.Exec.Command).To( - Equal([]string{"/bin/true"})) - }) - }) - When("OVNDBCluster is created with networkAttachments", func() { var OVNDBClusterName types.NamespacedName BeforeEach(func() { diff --git a/tests/functional/ovnnorthd_controller_test.go b/tests/functional/ovnnorthd_controller_test.go index 812d7e71..a4a4272f 100644 --- a/tests/functional/ovnnorthd_controller_test.go +++ b/tests/functional/ovnnorthd_controller_test.go @@ -86,33 +86,6 @@ var _ = Describe("OVNNorthd controller", func() { }) - When("A OVNNorthd instance is created with debug on", func() { - BeforeEach(func() { - dbs := CreateOVNDBClusters(namespace, map[string][]string{}, 1) - DeferCleanup(DeleteOVNDBClusters, dbs) - spec := GetDefaultOVNNorthdSpec() - spec.Debug.Service = true - ovnNorthdName := ovn.CreateOVNNorthd(namespace, spec) - DeferCleanup(ovn.DeleteOVNNorthd, ovnNorthdName) - }) - - It("Container commands to include debug commands", func() { - deplName := types.NamespacedName{ - Namespace: namespace, - Name: "ovn-northd", - } - - depl := th.GetDeployment(deplName) - Expect(depl.Spec.Template.Spec.Containers).To(HaveLen(1)) - Expect(depl.Spec.Template.Spec.Containers[0].LivenessProbe.Exec.Command).To( - Equal([]string{"/bin/true"})) - Expect(depl.Spec.Template.Spec.Containers[0].ReadinessProbe.Exec.Command).To( - Equal([]string{"/bin/true"})) - Expect(depl.Spec.Template.Spec.Containers[0].Command[0]).Should(ContainSubstring("/bin/sleep")) - Expect(depl.Spec.Template.Spec.Containers[0].Args[0]).Should(ContainSubstring("infinity")) - }) - }) - When("OVNNorthd is created with networkAttachments", func() { var ovnNorthdName types.NamespacedName diff --git a/tests/kuttl/tests/ovn_debug/01-assert.yaml b/tests/kuttl/tests/ovn_debug/01-assert.yaml deleted file mode 100644 index f45cc233..00000000 --- a/tests/kuttl/tests/ovn_debug/01-assert.yaml +++ /dev/null @@ -1,389 +0,0 @@ -# -# Check for: -# -# - 1 OVNNorthd CR -# - 2 OVNDBCluster CR (ovndbcluster-nb-sample, ovndbcluster-sb-sample) -# - 1 OVNController CR -# - Deployment with 1 Pod for OVNNorthd CR -# - Daemonset for OVNController CR -# - Statefulset for OVN DBs -# - ovsdbserver-nb-0 Pod -# - ovsdbserver-sb-0 Pod -# - ovn-controller- Pod -# - ovsdbserver-nb Service -# - ovsdbserver-nb-0 Service -# - ovsdbserver-sb Service -# - ovsdbserver-sb-0 Service -# - OVNController Daemonset created as many pods as nodes - -apiVersion: ovn.openstack.org/v1beta1 -kind: OVNNorthd -metadata: - finalizers: - - OVNNorthd - name: ovnnorthd-sample -spec: - debug: - service: true - logLevel: info - replicas: 1 -status: - readyCount: 1 ---- -apiVersion: ovn.openstack.org/v1beta1 -kind: OVNDBCluster -metadata: - finalizers: - - OVNDBCluster - name: ovndbcluster-nb-sample -spec: - dbType: NB - debug: - service: true - logLevel: info - replicas: 1 - storageClass: local-storage - storageRequest: 10G -status: - readyCount: 1 ---- -apiVersion: ovn.openstack.org/v1beta1 -kind: OVNDBCluster -metadata: - finalizers: - - OVNDBCluster - name: ovndbcluster-sb-sample -spec: - dbType: SB - debug: - service: true - logLevel: info - replicas: 1 - storageClass: local-storage - storageRequest: 10G -status: - readyCount: 1 ---- -apiVersion: ovn.openstack.org/v1beta1 -kind: OVNController -metadata: - finalizers: - - OVNController - name: ovncontroller-sample -spec: - debug: - service: true - external-ids: - ovn-bridge: br-int - ovn-encap-type: geneve - system-id: random ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: ovn-northd -spec: - replicas: 1 - template: - metadata: - labels: - service: ovn-northd - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - podAffinityTerm: - labelSelector: - matchExpressions: - - key: service - operator: In - values: - - ovn-northd - topologyKey: kubernetes.io/hostname - weight: 1 - containers: - - command: - - /bin/sleep - imagePullPolicy: IfNotPresent - livenessProbe: - exec: - command: - - /bin/true - failureThreshold: 3 - initialDelaySeconds: 3 - periodSeconds: 3 - successThreshold: 1 - timeoutSeconds: 5 - securityContext: - allowPrivilegeEscalation: false - runAsNonRoot: true - name: ovn-northd - readinessProbe: - exec: - command: - - /bin/true - failureThreshold: 3 - initialDelaySeconds: 5 - periodSeconds: 5 - successThreshold: 1 - timeoutSeconds: 5 - resources: {} - serviceAccount: ovnnorthd-ovnnorthd-sample - serviceAccountName: ovnnorthd-ovnnorthd-sample - restartPolicy: Always -status: - availableReplicas: 1 - replicas: 1 ---- -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: ovn-controller -spec: - selector: - matchLabels: - service: ovn-controller - template: - metadata: - labels: - service: ovn-controller - spec: - containers: - - args: - - infinity - command: - - /bin/sleep - lifecycle: - preStop: - exec: - command: - - /bin/true - livenessProbe: - exec: - command: - - /bin/true - name: ovsdb-server - - args: - - infinity - command: - - /bin/sleep - lifecycle: - preStop: - exec: - command: - - /bin/true - livenessProbe: - exec: - command: - - /bin/true - name: ovs-vswitchd - - args: - - infinity - command: - - /bin/sleep - lifecycle: - preStop: - exec: - command: - - /bin/true - name: ovn-controller -status: - numberMisscheduled: 0 ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: ovsdbserver-nb -spec: - replicas: 1 - selector: - matchLabels: - service: ovsdbserver-nb - serviceName: ovsdbserver-nb - template: - metadata: - labels: - service: ovsdbserver-nb - spec: - containers: - - args: - - --single-child - - -- - - /bin/bash - - -c - - /bin/sleep infinity - command: - - /usr/bin/dumb-init - lifecycle: - postStart: - exec: - command: - - /bin/true - preStop: - exec: - command: - - /bin/true - livenessProbe: - exec: - command: - - /bin/true - name: ovsdbserver-nb - readinessProbe: - exec: - command: - - /bin/true ---- -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: ovsdbserver-sb -spec: - replicas: 1 - selector: - matchLabels: - service: ovsdbserver-sb - serviceName: ovsdbserver-sb - template: - metadata: - labels: - service: ovsdbserver-sb - spec: - containers: - - args: - - --single-child - - -- - - /bin/bash - - -c - - /bin/sleep infinity - command: - - /usr/bin/dumb-init - lifecycle: - postStart: - exec: - command: - - /bin/true - preStop: - exec: - command: - - /bin/true - livenessProbe: - exec: - command: - - /bin/true - name: ovsdbserver-sb - readinessProbe: - exec: - command: - - /bin/true ---- -# the openshift annotations can't be checked through the deployment above -apiVersion: v1 -kind: Pod -metadata: - annotations: - openshift.io/scc: restricted-v2 - labels: - service: ovn-northd ---- -apiVersion: v1 -kind: Pod -metadata: - annotations: - openshift.io/scc: restricted-v2 - labels: - service: ovsdbserver-nb - name: ovsdbserver-nb-0 ---- -apiVersion: v1 -kind: Pod -metadata: - annotations: - openshift.io/scc: restricted-v2 - labels: - service: ovsdbserver-sb - name: ovsdbserver-sb-0 ---- -apiVersion: v1 -kind: Pod -metadata: - annotations: - openshift.io/scc: privileged - labels: - service: ovn-controller - generateName: ovn-controller- -status: - phase: Running ---- -apiVersion: v1 -kind: Service -metadata: - labels: - service: ovsdbserver-nb - name: ovsdbserver-nb -spec: - ports: - - name: north-raft - port: 6643 - protocol: TCP - targetPort: 6643 - selector: - service: ovsdbserver-nb - type: ClusterIP ---- -apiVersion: v1 -kind: Service -metadata: - labels: - service: ovsdbserver-nb - statefulset.kubernetes.io/pod-name: ovsdbserver-nb-0 - name: ovsdbserver-nb-0 -spec: - ports: - - name: north - port: 6641 - protocol: TCP - targetPort: 6641 - - name: north-raft - port: 6643 - protocol: TCP - targetPort: 6643 - selector: - service: ovsdbserver-nb - type: ClusterIP ---- -apiVersion: v1 -kind: Service -metadata: - labels: - service: ovsdbserver-sb - name: ovsdbserver-sb -spec: - ports: - - name: south-raft - port: 6644 - protocol: TCP - targetPort: 6644 - selector: - service: ovsdbserver-sb - type: ClusterIP ---- -apiVersion: v1 -kind: Service -metadata: - labels: - service: ovsdbserver-sb - statefulset.kubernetes.io/pod-name: ovsdbserver-sb-0 - name: ovsdbserver-sb-0 -spec: - ports: - - name: south - port: 6642 - protocol: TCP - targetPort: 6642 - - name: south-raft - port: 6644 - protocol: TCP - targetPort: 6644 - selector: - service: ovsdbserver-sb - type: ClusterIP diff --git a/tests/kuttl/tests/ovn_debug/01-deploy-ovn.yaml b/tests/kuttl/tests/ovn_debug/01-deploy-ovn.yaml deleted file mode 100644 index abf9dfd9..00000000 --- a/tests/kuttl/tests/ovn_debug/01-deploy-ovn.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - oc kustomize ../../../../config/samples/ | oc apply -n $NAMESPACE -f - - oc patch OVNDBCluster -n $NAMESPACE ovndbcluster-nb-sample --type='json' -p='[{"op": "replace", "path": "/spec/debug/service", "value":true}]' - oc patch OVNDBCluster -n $NAMESPACE ovndbcluster-sb-sample --type='json' -p='[{"op": "replace", "path": "/spec/debug/service", "value":true}]' - oc patch OVNNorthd -n $NAMESPACE ovnnorthd-sample --type='json' -p='[{"op": "replace", "path": "/spec/debug/service", "value":true}]' - oc patch OVNController -n $NAMESPACE ovncontroller-sample --type='json' -p='[{"op": "replace", "path": "/spec/debug/service", "value":true}]' diff --git a/tests/kuttl/tests/ovn_debug/02-cleanup-ovn.yaml b/tests/kuttl/tests/ovn_debug/02-cleanup-ovn.yaml deleted file mode 120000 index 02360341..00000000 --- a/tests/kuttl/tests/ovn_debug/02-cleanup-ovn.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/cleanup-ovn.yaml \ No newline at end of file diff --git a/tests/kuttl/tests/ovn_debug/02-errors.yaml b/tests/kuttl/tests/ovn_debug/02-errors.yaml deleted file mode 120000 index 7314c155..00000000 --- a/tests/kuttl/tests/ovn_debug/02-errors.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/errors_cleanup_ovn.yaml \ No newline at end of file