Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle the missing mlmd service-ca cert gracefully #728

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion controllers/dspipeline_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package controllers

import (
"context"
"errors"
"fmt"

"github.com/opendatahub-io/data-science-pipelines-operator/controllers/dspastatus"
Expand Down Expand Up @@ -313,7 +314,14 @@ func (r *DSPAReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
err = r.ReconcileMLMD(ctx, dspa, params)
if err != nil {
r.setStatusAsNotReady(config.MLMDProxyReady, err, dspaStatus.SetMLMDProxyStatus)
return ctrl.Result{}, err
// TODO: this (and other components) should handle these scenarios via states or statuses instead of error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should link the existing issue here.
https://issues.redhat.com/browse/RHOAIENG-13321

var depErr *util.LaggingDependencyCreationError
if errors.As(err, &depErr) {
log.Info(depErr.Message)
return ctrl.Result{}, nil
} else {
return ctrl.Result{}, err
}
} else {
r.setStatus(ctx, params.MlmdProxyDefaultResourceName, config.MLMDProxyReady, dspa,
dspaStatus.SetMLMDProxyStatus, log)
Expand Down
5 changes: 2 additions & 3 deletions controllers/mlmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package controllers

import (
"context"
"errors"
dspav1alpha1 "github.com/opendatahub-io/data-science-pipelines-operator/api/v1alpha1"
"github.com/opendatahub-io/data-science-pipelines-operator/controllers/util"
)

const (
Expand Down Expand Up @@ -72,9 +72,8 @@ func (r *DSPAReconciler) ReconcileMLMD(ctx context.Context, dsp *dspav1alpha1.Da
if err != nil {
return err
}

if !certificatesExist {
return errors.New("secret containing the certificate for MLMD gRPC Server was not created yet")
return &util.LaggingDependencyCreationError{Message: "MLMD gRPC Server cert secret not found, this is likely because it has not been created yet"}
}
}

Expand Down
31 changes: 31 additions & 0 deletions controllers/util/err.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright 2024.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package util

import (
"fmt"
)

// LaggingDependencyCreationError should be used if a dependency that is
// created by a third party is not found (e.g. service-ca secrets).
type LaggingDependencyCreationError struct {
Message string
}

func (e *LaggingDependencyCreationError) Error() string {
return fmt.Sprintf("Missing dependency error: %s", e.Message)
}
Loading