Skip to content

Commit

Permalink
JobCR will warning when STSDisabled (#2097)
Browse files Browse the repository at this point in the history
JobCR will warning if STSDisabled

JobCR will warning if STSDisabled
  • Loading branch information
jiuker committed Apr 30, 2024
1 parent 276cb27 commit 010b890
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/controller/job-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
joblisters "github.com/minio/operator/pkg/client/listers/job.min.io/v1alpha1"
"github.com/minio/operator/pkg/utils/miniojob"
batchjobv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -206,6 +207,12 @@ func (c *JobController) SyncHandler(key string) (Result, error) {
}
return WrapResult(Result{}, err)
}

if !IsSTSEnabled() {
c.recorder.Eventf(&jobCR, corev1.EventTypeWarning, "STSDisabled", "JobCR cannot work with STS disabled")
return WrapResult(Result{}, nil)
}

// if job cr is Success, do nothing
if jobCR.Status.Phase == miniojob.MinioJobPhaseSuccess {
// delete the job status
Expand Down

0 comments on commit 010b890

Please sign in to comment.