Skip to content

Commit

Permalink
Drop Debug fields
Browse files Browse the repository at this point in the history
These fields were redundant. Crashing pods can be debugged via oc debug.

Implements: OSPRH-4290
  • Loading branch information
gibizer committed Feb 2, 2024
1 parent 72883dc commit 3324c86
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 97 deletions.
14 changes: 0 additions & 14 deletions api/bases/placement.openstack.org_placementapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions api/v1beta1/placementapi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions config/crd/bases/placement.openstack.org_placementapis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions pkg/placement/dbsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
Expand Down
42 changes: 13 additions & 29 deletions pkg/placement/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 3324c86

Please sign in to comment.