controller change for statefulset auto-delete (implementation)

This commit is contained in:
Matthew Cary
2021-06-30 10:37:16 -07:00
parent f1d5d4df5a
commit bce87a3e4f
5 changed files with 426 additions and 72 deletions

View File

@@ -91,9 +91,8 @@ func NewStatefulSetController(
ssc := &StatefulSetController{
kubeClient: kubeClient,
control: NewDefaultStatefulSetControl(
NewRealStatefulPodControl(
NewStatefulPodControl(
kubeClient,
setInformer.Lister(),
podInformer.Lister(),
pvcInformer.Lister(),
recorder),
@@ -352,10 +351,14 @@ func (ssc *StatefulSetController) getStatefulSetsForPod(pod *v1.Pod) []*apps.Sta
if len(sets) > 1 {
// ControllerRef will ensure we don't do anything crazy, but more than one
// item in this list nevertheless constitutes user error.
setNames := []string{}
for _, s := range sets {
setNames = append(setNames, s.Name)
}
utilruntime.HandleError(
fmt.Errorf(
"user error: more than one StatefulSet is selecting pods with labels: %+v",
pod.Labels))
"user error: more than one StatefulSet is selecting pods with labels: %+v. Sets: %v",
pod.Labels, setNames))
}
return sets
}