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 authored and openshift-merge-bot[bot] committed Feb 2, 2024
1 parent d7eed75 commit e674727
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 109 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
3 changes: 0 additions & 3 deletions config/samples/placement_v1beta1_placementapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ spec:
debug = true
databaseInstance: openstack
databaseUser: placement
debug:
dbSync: false
service: false
preserveJobs: false
replicas: 1
secret: placement-secret
Expand Down
3 changes: 0 additions & 3 deletions config/samples/placement_v1beta1_placementtls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ spec:
debug = true
databaseInstance: openstack
databaseUser: placement
debug:
dbSync: false
service: false
preserveJobs: false
replicas: 1
secret: placement-secret
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
3 changes: 0 additions & 3 deletions tests/kuttl/common/assert_sample_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ spec:
debug = true
databaseInstance: openstack
databaseUser: placement
debug:
dbSync: false
service: false
passwordSelectors:
database: PlacementDatabasePassword
service: PlacementPassword
Expand Down
3 changes: 0 additions & 3 deletions tests/kuttl/tests/placement_deploy_tls/03-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ spec:
debug = true
databaseInstance: openstack
databaseUser: placement
debug:
dbSync: false
service: false
passwordSelectors:
database: PlacementDatabasePassword
service: PlacementPassword
Expand Down

0 comments on commit e674727

Please sign in to comment.