Skip to content

Commit

Permalink
Merge pull request #734 from tnozicka/eviction-workaround-1.4
Browse files Browse the repository at this point in the history
[v1.4] Temporarily force deletion of pods when replacing nodes
  • Loading branch information
zimnx authored Jul 28, 2021
2 parents 0764538 + 9f19fca commit 910a3e0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pkg/controller/scyllacluster/sync_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/scylladb/scylla-operator/pkg/resourceapply"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
Expand Down Expand Up @@ -244,18 +243,15 @@ func (scc *Controller) syncServices(
Name: svc.Name,
},
}
klog.V(2).InfoS("Evicting the Pod to replace member",
klog.V(2).InfoS("Deleting the Pod to replace member",
"ScyllaCluster", klog.KObj(sc),
"Service", klog.KObj(svc),
"Pod", klog.KObj(podMeta),
)
err = scc.kubeClient.CoreV1().Pods(podMeta.Namespace).Evict(ctx, &policyv1beta1.Eviction{
ObjectMeta: metav1.ObjectMeta{
Name: podMeta.Name,
},
DeleteOptions: &metav1.DeleteOptions{
PropagationPolicy: &backgroundPropagationPolicy,
},
// TODO: Revert back to eviction when it's fixed in kubernetes 1.19.z (#732)
// (https://github.com/kubernetes/kubernetes/issues/103970)
err = scc.kubeClient.CoreV1().Pods(podMeta.Namespace).Delete(ctx, podMeta.Name, metav1.DeleteOptions{
PropagationPolicy: &backgroundPropagationPolicy,
})
if err != nil {
if apierrors.IsNotFound(err) {
Expand Down

0 comments on commit 910a3e0

Please sign in to comment.