Browse Source

remove unused pdb resources

master
Vladimir Smagin 1 year ago
parent
commit
deedc1b55f
1 changed files with 48 additions and 0 deletions
  1. +48
    -0
      pkg/controller/redis/redis_controller.go

+ 48
- 0
pkg/controller/redis/redis_controller.go View File

@ -196,6 +196,22 @@ fi
if _, err := r.ReconcilePodDisruptionBudget(reqLogger, instance, pdbName, pdbSpec); err != nil {
return reconcile.Result{}, err
}
} else {
pdb := v1beta1.PodDisruptionBudget{
ObjectMeta: metav1.ObjectMeta{
Name: instance.Name + "-redis",
Namespace: instance.Namespace,
},
Spec: v1beta1.PodDisruptionBudgetSpec{},
}
err := r.client.Delete(context.TODO(), &pdb)
if err != nil && errors.IsNotFound(err) {
return reconcile.Result{}, nil
} else if err != nil {
raven.CaptureErrorAndWait(err, nil)
return reconcile.Result{}, err
}
}
if instance.Spec.PdbSentinel != nil {
@ -225,6 +241,22 @@ fi
if _, err := r.ReconcilePodDisruptionBudget(reqLogger, instance, pdbName, pdbSpec); err != nil {
return reconcile.Result{}, err
}
} else {
pdb := v1beta1.PodDisruptionBudget{
ObjectMeta: metav1.ObjectMeta{
Name: instance.Name + "-sentinel",
Namespace: instance.Namespace,
},
Spec: v1beta1.PodDisruptionBudgetSpec{},
}
err := r.client.Delete(context.TODO(), &pdb)
if err != nil && errors.IsNotFound(err) {
return reconcile.Result{}, nil
} else if err != nil {
raven.CaptureErrorAndWait(err, nil)
return reconcile.Result{}, err
}
}
if instance.Spec.PdbHaproxy != nil {
@ -244,6 +276,22 @@ fi
if _, err := r.ReconcilePodDisruptionBudget(reqLogger, instance, pdbName, pdbSpec); err != nil {
return reconcile.Result{}, err
}
} else {
pdb := v1beta1.PodDisruptionBudget{
ObjectMeta: metav1.ObjectMeta{
Name: instance.Name + "-haproxy",
Namespace: instance.Namespace,
},
Spec: v1beta1.PodDisruptionBudgetSpec{},
}
err := r.client.Delete(context.TODO(), &pdb)
if err != nil && errors.IsNotFound(err) {
return reconcile.Result{}, nil
} else if err != nil {
raven.CaptureErrorAndWait(err, nil)
return reconcile.Result{}, err
}
}
// set Redis master


Loading…
Cancel
Save