Skip to content

Commit

Permalink
Fix StatefulSet controller (#616)
Browse files Browse the repository at this point in the history
Signed-off-by: Emruz Hossain <emruz@appscode.com>
  • Loading branch information
Emruz Hossain committed Oct 8, 2020
1 parent 517285e commit a841401
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/controller/statefulset/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/appscode/go/log"
apps "k8s.io/api/apps/v1"
kerr "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -81,7 +82,9 @@ func (c *Controller) InitStsWatcher() {
}
dbInfo, err := c.extractDatabaseInfo(sts)
if err != nil {
log.Warningf("failed to extract database info from StatefulSet: %s/%s. Reason: %v", sts.Namespace, sts.Name, err)
if !kerr.IsNotFound(err) {
log.Warningf("failed to extract database info from StatefulSet: %s/%s. Reason: %v", sts.Namespace, sts.Name, err)
}
return
}
err = c.ensureReadyReplicasCond(dbInfo)
Expand All @@ -98,11 +101,11 @@ func (c *Controller) enqueueOnlyKubeDBSts(sts *apps.StatefulSet) {
// only enqueue if the controlling owner is a KubeDB resource
ok, _, err := core_util.IsOwnerOfGroup(metav1.GetControllerOf(sts), kubedb.GroupName)
if err != nil {
log.Warningln(err)
log.Warningf("failed to enqueue StatefulSet: %s/%s. Reason: %v", sts.Namespace, sts.Name, err)
return
}
if key, err := cache.MetaNamespaceKeyFunc(sts); ok && err == nil {
queue.Enqueue(c.StsQueue.GetQueue(), key)
if ok {
queue.Enqueue(c.StsQueue.GetQueue(), cache.ExplicitKey(sts.Namespace+"/"+sts.Name))
}
}

Expand Down

0 comments on commit a841401

Please sign in to comment.