diff --git a/pkg/ovncontroller/daemonset.go b/pkg/ovncontroller/daemonset.go index 09ce8e33..b4613ab7 100644 --- a/pkg/ovncontroller/daemonset.go +++ b/pkg/ovncontroller/daemonset.go @@ -14,7 +14,6 @@ package ovncontroller import ( "fmt" - "strings" "github.com/openstack-k8s-operators/lib-common/modules/common/env" "github.com/openstack-k8s-operators/lib-common/modules/common/tls" @@ -35,8 +34,8 @@ func CreateOVNDaemonSet( volumes := GetOVNControllerVolumes(instance.Name, instance.Namespace) mounts := GetOVNControllerVolumeMounts() - args := []string{ - "ovn-controller --pidfile unix:/run/openvswitch/db.sock", + cmd := []string{ + "ovn-controller", "--pidfile", "unix:/run/openvswitch/db.sock", } // add OVN dbs cert and CA @@ -56,7 +55,7 @@ func CreateOVNDaemonSet( mounts = append(mounts, instance.Spec.TLS.CreateVolumeMounts(nil)...) } - args = append(args, []string{ + cmd = append(cmd, []string{ fmt.Sprintf("--certificate=%s", ovn_common.OVNDbCertPath), fmt.Sprintf("--private-key=%s", ovn_common.OVNDbKeyPath), fmt.Sprintf("--ca-cert=%s", ovn_common.OVNDbCaCertPath), @@ -72,8 +71,7 @@ func CreateOVNDaemonSet( containers := []corev1.Container{ { Name: "ovn-controller", - Command: []string{"/bin/bash", "-c"}, - Args: []string{strings.Join(args, " ")}, + Command: cmd, Lifecycle: &corev1.Lifecycle{ PreStop: &corev1.LifecycleHandler{ Exec: &corev1.ExecAction{ diff --git a/pkg/ovndbcluster/statefulset.go b/pkg/ovndbcluster/statefulset.go index 1107ddbe..94c89e48 100644 --- a/pkg/ovndbcluster/statefulset.go +++ b/pkg/ovndbcluster/statefulset.go @@ -57,7 +57,7 @@ func StatefulSet( var preStopCmd []string cmd := []string{"/usr/bin/dumb-init"} - args := []string{"--", "/bin/bash", "-c", ServiceCommand} + args := []string{ServiceCommand} // // https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ // diff --git a/pkg/ovnnorthd/deployment.go b/pkg/ovnnorthd/deployment.go index d353c497..2f20a7fa 100644 --- a/pkg/ovnnorthd/deployment.go +++ b/pkg/ovnnorthd/deployment.go @@ -54,7 +54,7 @@ func Deployment( PeriodSeconds: 5, InitialDelaySeconds: 5, } - cmd := ServiceCommand + cmd := []string{ServiceCommand} args := []string{ "-vfile:off", fmt.Sprintf("-vconsole:%s", instance.Spec.LogLevel), @@ -123,7 +123,7 @@ func Deployment( Containers: []corev1.Container{ { Name: ovnv1.ServiceNameOVNNorthd, - Command: []string{cmd}, + Command: cmd, Args: args, Image: instance.Spec.ContainerImage, SecurityContext: getOVNNorthdSecurityContext(), diff --git a/tests/functional/ovncontroller_controller_test.go b/tests/functional/ovncontroller_controller_test.go index e67ac9b8..c6774ae5 100644 --- a/tests/functional/ovncontroller_controller_test.go +++ b/tests/functional/ovncontroller_controller_test.go @@ -954,7 +954,7 @@ var _ = Describe("OVNController controller", func() { th.AssertVolumeMountExists("ovn-controller-tls-certs", "ca.crt", svcC.VolumeMounts) // check cli args - Expect(svcC.Args).To(And( + Expect(svcC.Command).To(And( ContainElement(ContainSubstring(fmt.Sprintf("--private-key=%s", ovn_common.OVNDbKeyPath))), ContainElement(ContainSubstring(fmt.Sprintf("--certificate=%s", ovn_common.OVNDbCertPath))), ContainElement(ContainSubstring(fmt.Sprintf("--ca-cert=%s", ovn_common.OVNDbCaCertPath))),