Skip to content

Commit a4fba41

Browse files
committed
Add disableHealthCheck functionality for DB/ObjStore
- Useful for local testing and debugging
1 parent 4f63f37 commit a4fba41

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

api/v1alpha1/dspipeline_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ type MlPipelineUI struct {
122122
type Database struct {
123123
*MariaDB `json:"mariaDB,omitempty"`
124124
*ExternalDB `json:"externalDB,omitempty"`
125+
// +kubebuilder:default:=false
126+
// +kubebuilder:validation:Optional
127+
DisableHealthCheck bool `json:"disableHealthCheck"`
125128
}
126129

127130
type MariaDB struct {
@@ -151,6 +154,9 @@ type ExternalDB struct {
151154
type ObjectStorage struct {
152155
*Minio `json:"minio,omitempty"`
153156
*ExternalStorage `json:"externalStorage,omitempty"`
157+
// +kubebuilder:default:=false
158+
// +kubebuilder:validation:Optional
159+
DisableHealthCheck bool `json:"disableHealthCheck"`
154160
}
155161

156162
type Minio struct {

config/crd/bases/datasciencepipelinesapplications.opendatahub.io_datasciencepipelinesapplications.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ spec:
138138
mariaDB:
139139
deploy: true
140140
properties:
141+
disableHealthCheck:
142+
default: false
143+
type: boolean
141144
externalDB:
142145
properties:
143146
host:
@@ -431,6 +434,9 @@ spec:
431434
type: object
432435
objectStorage:
433436
properties:
437+
disableHealthCheck:
438+
default: false
439+
type: boolean
434440
externalStorage:
435441
properties:
436442
bucket:

controllers/database.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ func (r *DSPAReconciler) isDatabaseAccessible(ctx context.Context, dsp *dspav1al
5454
params *DSPAParams) bool {
5555
log := r.Log.WithValues("namespace", dsp.Namespace).WithValues("dspa_name", dsp.Name)
5656

57+
if params.DatabaseHealthCheckDisabled(dsp) {
58+
log.V(1).Info("Database health check disabled, assuming database is available and ready.")
59+
return true
60+
}
61+
5762
log.Info("Performing Database Health Check")
5863
databaseSpecified := dsp.Spec.Database != nil
5964
usingExternalDB := params.UsingExternalDB(dsp)

controllers/dspipeline_params.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ func (p *DSPAParams) UsingExternalDB(dsp *dspa.DataSciencePipelinesApplication)
8181
return false
8282
}
8383

84+
// StorageHealthCheckDisabled will return the value if the Database has disableHealthCheck specified in the CR, otherwise false.
85+
func (p *DSPAParams) DatabaseHealthCheckDisabled(dsp *dspa.DataSciencePipelinesApplication) bool {
86+
if dsp.Spec.Database != nil {
87+
return dsp.Spec.Database.DisableHealthCheck
88+
}
89+
return false
90+
}
91+
8492
// UsingExternalStorage will return true if an external Object Storage is specified in the CR, otherwise false.
8593
func (p *DSPAParams) UsingExternalStorage(dsp *dspa.DataSciencePipelinesApplication) bool {
8694
if dsp.Spec.ObjectStorage != nil && dsp.Spec.ObjectStorage.ExternalStorage != nil {
@@ -89,6 +97,14 @@ func (p *DSPAParams) UsingExternalStorage(dsp *dspa.DataSciencePipelinesApplicat
8997
return false
9098
}
9199

100+
// ObjectStorageHealthCheckDisabled will return the value if the Object Storage has disableHealthCheck specified in the CR, otherwise false.
101+
func (p *DSPAParams) ObjectStorageHealthCheckDisabled(dsp *dspa.DataSciencePipelinesApplication) bool {
102+
if dsp.Spec.ObjectStorage != nil {
103+
return dsp.Spec.ObjectStorage.DisableHealthCheck
104+
}
105+
return false
106+
}
107+
92108
func (p *DSPAParams) UsingMLMD(dsp *dspa.DataSciencePipelinesApplication) bool {
93109
if dsp.Spec.MLMD != nil {
94110
return dsp.Spec.MLMD.Deploy

controllers/storage.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ var ConnectAndQueryObjStore = func(ctx context.Context, log logr.Logger, endpoin
8585
func (r *DSPAReconciler) isObjectStorageAccessible(ctx context.Context, dsp *dspav1alpha1.DataSciencePipelinesApplication,
8686
params *DSPAParams) bool {
8787
log := r.Log.WithValues("namespace", dsp.Namespace).WithValues("dspa_name", dsp.Name)
88+
if params.ObjectStorageHealthCheckDisabled(dsp) {
89+
log.V(1).Info("Object Storage health check disabled, assuming object store is available and ready.")
90+
return true
91+
}
92+
8893
log.Info("Performing Object Storage Health Check")
8994

9095
endpoint := joinHostPort(params.ObjectStorageConnection.Host, params.ObjectStorageConnection.Port)
@@ -100,7 +105,7 @@ func (r *DSPAReconciler) isObjectStorageAccessible(ctx context.Context, dsp *dsp
100105
return false
101106
}
102107

103-
verified := ConnectAndQueryObjStore(ctx, log, endpoint, accesskey, secretkey, params.ObjectStorageConnection.Secure)
108+
verified := ConnectAndQueryObjStore(ctx, log, endpoint, accesskey, secretkey, *params.ObjectStorageConnection.Secure)
104109
if verified {
105110
log.Info("Object Storage Health Check Successful")
106111
} else {

0 commit comments

Comments
 (0)