From 3324c8663d98054ca6986b683e2e74023111551b Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Fri, 2 Feb 2024 11:49:23 +0100 Subject: [PATCH] Drop Debug fields These fields were redundant. Crashing pods can be debugged via oc debug. Implements: OSPRH-4290 --- ...placement.openstack.org_placementapis.yaml | 14 ------- api/v1beta1/placementapi_types.go | 17 -------- api/v1beta1/zz_generated.deepcopy.go | 16 ------- ...placement.openstack.org_placementapis.yaml | 14 ------- pkg/placement/dbsync.go | 8 +--- pkg/placement/deployment.go | 42 ++++++------------- 6 files changed, 14 insertions(+), 97 deletions(-) diff --git a/api/bases/placement.openstack.org_placementapis.yaml b/api/bases/placement.openstack.org_placementapis.yaml index fb688c69..e3616705 100644 --- a/api/bases/placement.openstack.org_placementapis.yaml +++ b/api/bases/placement.openstack.org_placementapis.yaml @@ -70,20 +70,6 @@ spec: DB, defaults to placement TODO: -> implement needs work in mariadb-operator, right now only placement' 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: - dbSync: - default: false - description: DBSync enable debug - type: boolean - service: - default: false - description: Service enable debug - type: boolean - type: object defaultConfigOverwrite: additionalProperties: type: string diff --git a/api/v1beta1/placementapi_types.go b/api/v1beta1/placementapi_types.go index 8b3065ac..c848b59b 100644 --- a/api/v1beta1/placementapi_types.go +++ b/api/v1beta1/placementapi_types.go @@ -82,11 +82,6 @@ type PlacementAPISpec struct { // NodeSelector to target subset of worker nodes running this service NodeSelector map[string]string `json:"nodeSelector,omitempty"` - // +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 PlacementAPIDebug `json:"debug,omitempty"` - // +kubebuilder:validation:Optional // +kubebuilder:default=false // PreserveJobs - do not delete jobs after they finished e.g. to check logs @@ -143,18 +138,6 @@ type PasswordSelector struct { Service string `json:"service"` } -// PlacementAPIDebug defines the observed state of PlacementAPIDebug -type PlacementAPIDebug struct { - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - // DBSync enable debug - DBSync bool `json:"dbSync"` - // +kubebuilder:validation:Optional - // +kubebuilder:default=false - // Service enable debug - Service bool `json:"service"` -} - // PlacementAPIStatus defines the observed state of PlacementAPI type PlacementAPIStatus struct { // ReadyCount of placement API instances diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 202b2c1d..3c88da2b 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -91,21 +91,6 @@ func (in *PlacementAPI) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PlacementAPIDebug) DeepCopyInto(out *PlacementAPIDebug) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementAPIDebug. -func (in *PlacementAPIDebug) DeepCopy() *PlacementAPIDebug { - if in == nil { - return nil - } - out := new(PlacementAPIDebug) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PlacementAPIDefaults) DeepCopyInto(out *PlacementAPIDefaults) { *out = *in @@ -169,7 +154,6 @@ func (in *PlacementAPISpec) DeepCopyInto(out *PlacementAPISpec) { (*out)[key] = val } } - out.Debug = in.Debug if in.DefaultConfigOverwrite != nil { in, out := &in.DefaultConfigOverwrite, &out.DefaultConfigOverwrite *out = make(map[string]string, len(*in)) diff --git a/config/crd/bases/placement.openstack.org_placementapis.yaml b/config/crd/bases/placement.openstack.org_placementapis.yaml index fb688c69..e3616705 100644 --- a/config/crd/bases/placement.openstack.org_placementapis.yaml +++ b/config/crd/bases/placement.openstack.org_placementapis.yaml @@ -70,20 +70,6 @@ spec: DB, defaults to placement TODO: -> implement needs work in mariadb-operator, right now only placement' 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: - dbSync: - default: false - description: DBSync enable debug - type: boolean - service: - default: false - description: Service enable debug - type: boolean - type: object defaultConfigOverwrite: additionalProperties: type: string diff --git a/pkg/placement/dbsync.go b/pkg/placement/dbsync.go index 52b12838..13ac6e83 100644 --- a/pkg/placement/dbsync.go +++ b/pkg/placement/dbsync.go @@ -18,7 +18,6 @@ package placement import ( placementv1 "github.com/openstack-k8s-operators/placement-operator/api/v1beta1" - common "github.com/openstack-k8s-operators/lib-common/modules/common" env "github.com/openstack-k8s-operators/lib-common/modules/common/env" batchv1 "k8s.io/api/batch/v1" @@ -33,12 +32,7 @@ func DbSyncJob( labels map[string]string, annotations map[string]string, ) *batchv1.Job { - args := []string{"-c"} - if instance.Spec.Debug.DBSync { - args = append(args, common.DebugCommand) - } else { - args = append(args, KollaServiceCommand) - } + args := []string{"-c", KollaServiceCommand} envVars := map[string]env.Setter{} envVars["KOLLA_CONFIG_STRATEGY"] = env.SetValue("COPY_ALWAYS") diff --git a/pkg/placement/deployment.go b/pkg/placement/deployment.go index 290c3adb..07312307 100644 --- a/pkg/placement/deployment.go +++ b/pkg/placement/deployment.go @@ -56,36 +56,20 @@ func Deployment( InitialDelaySeconds: 5, } - args := []string{"-c"} - if instance.Spec.Debug.Service { - args = append(args, common.DebugCommand) - livenessProbe.Exec = &corev1.ExecAction{ - Command: []string{ - "/bin/true", - }, - } - - readinessProbe.Exec = &corev1.ExecAction{ - Command: []string{ - "/bin/true", - }, - } - } else { - args = append(args, KollaServiceCommand) - // - // https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ - // - livenessProbe.HTTPGet = &corev1.HTTPGetAction{ - Port: intstr.IntOrString{Type: intstr.Int, IntVal: int32(PlacementPublicPort)}, - } - readinessProbe.HTTPGet = &corev1.HTTPGetAction{ - Port: intstr.IntOrString{Type: intstr.Int, IntVal: int32(PlacementPublicPort)}, - } + args := []string{"-c", KollaServiceCommand} + // + // https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ + // + livenessProbe.HTTPGet = &corev1.HTTPGetAction{ + Port: intstr.IntOrString{Type: intstr.Int, IntVal: int32(PlacementPublicPort)}, + } + readinessProbe.HTTPGet = &corev1.HTTPGetAction{ + Port: intstr.IntOrString{Type: intstr.Int, IntVal: int32(PlacementPublicPort)}, + } - if instance.Spec.TLS.API.Enabled(service.EndpointPublic) { - livenessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS - readinessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS - } + if instance.Spec.TLS.API.Enabled(service.EndpointPublic) { + livenessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS + readinessProbe.HTTPGet.Scheme = corev1.URISchemeHTTPS } envVars := map[string]env.Setter{}