Skip to content

Commit

Permalink
podfacts new package (#967)
Browse files Browse the repository at this point in the history
This PR:
1. Move the podfact package out of vdb and its test file
2. Keeps the original podfact attribute private, adding Getters and
Setters for other packages to assign or edit value(Otherwise we need to
expose the attribute of podfact)
3. Adjust import and attribute reference in all packages and tests
  • Loading branch information
HaoYang0000 authored Oct 24, 2024
1 parent 3c7866d commit 2a87a60
Show file tree
Hide file tree
Showing 73 changed files with 1,166 additions and 690 deletions.
5 changes: 3 additions & 2 deletions pkg/controllers/sandbox/sandbox_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/vertica/vertica-kubernetes/pkg/events"
vmeta "github.com/vertica/vertica-kubernetes/pkg/meta"
"github.com/vertica/vertica-kubernetes/pkg/names"
"github.com/vertica/vertica-kubernetes/pkg/podfacts"
"github.com/vertica/vertica-kubernetes/pkg/vadmin"
"github.com/vertica/vertica-kubernetes/pkg/vk8s"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -129,7 +130,7 @@ func (r *SandboxConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Req
return ctrl.Result{}, err
}
prunner := cmds.MakeClusterPodRunner(log, r.Cfg, vdb.GetVerticaUser(), passwd)
pfacts := vdbcontroller.MakePodFactsForSandbox(r, prunner, log, passwd, sandboxName)
pfacts := podfacts.MakePodFactsForSandbox(r, prunner, log, passwd, sandboxName)
dispatcher := vadmin.MakeVClusterOps(log, vdb, r.Client, passwd, r.EVRec, vadmin.SetupVClusterOps)

// Iterate over each actor
Expand All @@ -151,7 +152,7 @@ func (r *SandboxConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Req
// Order matters in that some actors depend on the successeful execution of
// earlier ones.
func (r *SandboxConfigMapReconciler) constructActors(vdb *v1.VerticaDB, log logr.Logger, prunner *cmds.ClusterPodRunner,
pfacts *vdbcontroller.PodFacts, dispatcher vadmin.Dispatcher, configMap *corev1.ConfigMap) []controllers.ReconcileActor {
pfacts *podfacts.PodFacts, dispatcher vadmin.Dispatcher, configMap *corev1.ConfigMap) []controllers.ReconcileActor {
// The actors that will be applied, in sequence, to reconcile a sandbox configmap.
return []controllers.ReconcileActor{
// Ensure we support sandboxing and vclusterops
Expand Down
8 changes: 4 additions & 4 deletions pkg/controllers/sandbox/unsandboxsubcluster_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
vapi "github.com/vertica/vertica-kubernetes/api/v1"
"github.com/vertica/vertica-kubernetes/pkg/cmds"
"github.com/vertica/vertica-kubernetes/pkg/controllers"
vdbcontroller "github.com/vertica/vertica-kubernetes/pkg/controllers/vdb"
"github.com/vertica/vertica-kubernetes/pkg/events"
vmeta "github.com/vertica/vertica-kubernetes/pkg/meta"
"github.com/vertica/vertica-kubernetes/pkg/podfacts"
"github.com/vertica/vertica-kubernetes/pkg/vadmin"
"github.com/vertica/vertica-kubernetes/pkg/vadmin/opts/unsandboxsc"
"github.com/vertica/vertica-kubernetes/pkg/vdbstatus"
Expand All @@ -43,15 +43,15 @@ type UnsandboxSubclusterReconciler struct {
Log logr.Logger
client.Client
Dispatcher vadmin.Dispatcher
PFacts *vdbcontroller.PodFacts
OriginalPFacts *vdbcontroller.PodFacts
PFacts *podfacts.PodFacts
OriginalPFacts *podfacts.PodFacts
ConfigMap *corev1.ConfigMap
InitiatorIP string // The IP of the pod that we run vclusterOps from
PRunner cmds.PodRunner
}

func MakeUnsandboxSubclusterReconciler(r *SandboxConfigMapReconciler, vdb *vapi.VerticaDB, log logr.Logger,
cli client.Client, pfacts *vdbcontroller.PodFacts, dispatcher vadmin.Dispatcher,
cli client.Client, pfacts *podfacts.PodFacts, dispatcher vadmin.Dispatcher,
configMap *corev1.ConfigMap, prunner cmds.PodRunner) controllers.ReconcileActor {
pfactsForMainCluster := pfacts.Copy(vapi.MainCluster)
return &UnsandboxSubclusterReconciler{
Expand Down
14 changes: 7 additions & 7 deletions pkg/controllers/sandbox/unsandboxsubcluster_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
vapi "github.com/vertica/vertica-kubernetes/api/v1"
"github.com/vertica/vertica-kubernetes/pkg/builder"
"github.com/vertica/vertica-kubernetes/pkg/cmds"
vdbcontroller "github.com/vertica/vertica-kubernetes/pkg/controllers/vdb"
vmeta "github.com/vertica/vertica-kubernetes/pkg/meta"
"github.com/vertica/vertica-kubernetes/pkg/names"
"github.com/vertica/vertica-kubernetes/pkg/podfacts"
"github.com/vertica/vertica-kubernetes/pkg/test"
"github.com/vertica/vertica-kubernetes/pkg/vadmin"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -54,7 +54,7 @@ var _ = Describe("sandboxsubcluster_reconcile", func() {
defer test.DeletePods(ctx, k8sClient, vdb)

fpr := &cmds.FakePodRunner{}
pfacts := vdbcontroller.MakePodFacts(sbRec, fpr, logger, TestPassword)
pfacts := podfacts.MakePodFacts(sbRec, fpr, logger, TestPassword)
dispatcher := vadmin.MakeVClusterOps(logger, vdb, k8sClient, TestPassword, sbRec.EVRec, vadmin.SetupVClusterOps)
r := MakeUnsandboxSubclusterReconciler(sbRec, vdb, logger, k8sClient, &pfacts, dispatcher, nil, fpr)
Expect(vdb.IsEON()).Should(BeFalse())
Expand All @@ -75,7 +75,7 @@ var _ = Describe("sandboxsubcluster_reconcile", func() {
defer test.DeletePods(ctx, k8sClient, vdb)

fpr := &cmds.FakePodRunner{}
pfacts := vdbcontroller.MakePodFacts(sbRec, fpr, logger, TestPassword)
pfacts := podfacts.MakePodFacts(sbRec, fpr, logger, TestPassword)
dispatcher := vadmin.MakeVClusterOps(logger, vdb, k8sClient, TestPassword, sbRec.EVRec, vadmin.SetupVClusterOps)
r := MakeUnsandboxSubclusterReconciler(sbRec, vdb, logger, k8sClient, &pfacts, dispatcher, nil, fpr)
Expect(r.Reconcile(ctx, &ctrl.Request{})).Should(Equal(ctrl.Result{}))
Expand All @@ -97,7 +97,7 @@ var _ = Describe("sandboxsubcluster_reconcile", func() {
defer test.DeleteConfigMap(ctx, k8sClient, vdb, sandbox1)

fpr := &cmds.FakePodRunner{}
pfacts := vdbcontroller.MakePodFacts(sbRec, fpr, logger, TestPassword)
pfacts := podfacts.MakePodFacts(sbRec, fpr, logger, TestPassword)
dispatcher := vadmin.MakeVClusterOps(logger, vdb, k8sClient, TestPassword, sbRec.EVRec, vadmin.SetupVClusterOps)
rec := MakeUnsandboxSubclusterReconciler(sbRec, vdb, logger, k8sClient, &pfacts, dispatcher, cm, fpr)
r := rec.(*UnsandboxSubclusterReconciler)
Expand Down Expand Up @@ -137,7 +137,7 @@ var _ = Describe("sandboxsubcluster_reconcile", func() {
Expect(k8sClient.Status().Update(ctx, vdb)).Should(Succeed())

fpr := &cmds.FakePodRunner{}
pfacts := vdbcontroller.MakePodFacts(sbRec, fpr, logger, TestPassword)
pfacts := podfacts.MakePodFacts(sbRec, fpr, logger, TestPassword)
dispatcher := vadmin.MakeVClusterOps(logger, vdb, k8sClient, TestPassword, sbRec.EVRec, vadmin.SetupVClusterOps)
rec := MakeUnsandboxSubclusterReconciler(sbRec, vdb, logger, k8sClient, &pfacts, dispatcher, cm, fpr)
r := rec.(*UnsandboxSubclusterReconciler)
Expand Down Expand Up @@ -177,7 +177,7 @@ var _ = Describe("sandboxsubcluster_reconcile", func() {
Expect(k8sClient.Status().Update(ctx, vdb)).Should(Succeed())

fpr := &cmds.FakePodRunner{}
pfacts := vdbcontroller.MakePodFacts(sbRec, fpr, logger, TestPassword)
pfacts := podfacts.MakePodFacts(sbRec, fpr, logger, TestPassword)
dispatcher := vadmin.MakeVClusterOps(logger, vdb, k8sClient, TestPassword, sbRec.EVRec, vadmin.SetupVClusterOps)
rec := MakeUnsandboxSubclusterReconciler(sbRec, vdb, logger, k8sClient, &pfacts, dispatcher, nil, fpr)
r := rec.(*UnsandboxSubclusterReconciler)
Expand Down Expand Up @@ -211,7 +211,7 @@ var _ = Describe("sandboxsubcluster_reconcile", func() {
Expect(k8sClient.Status().Update(ctx, vdb)).Should(Succeed())

fpr := &cmds.FakePodRunner{}
pfacts := vdbcontroller.MakePodFacts(sbRec, fpr, logger, TestPassword)
pfacts := podfacts.MakePodFacts(sbRec, fpr, logger, TestPassword)
dispatcher := vadmin.MakeVClusterOps(logger, vdb, k8sClient, TestPassword, sbRec.EVRec, vadmin.SetupVClusterOps)
rec := MakeUnsandboxSubclusterReconciler(sbRec, vdb, logger, k8sClient, &pfacts, dispatcher, cm, fpr)
r := rec.(*UnsandboxSubclusterReconciler)
Expand Down
11 changes: 6 additions & 5 deletions pkg/controllers/vdb/altersubcluster_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/vertica/vertica-kubernetes/pkg/controllers"
"github.com/vertica/vertica-kubernetes/pkg/events"
vmeta "github.com/vertica/vertica-kubernetes/pkg/meta"
"github.com/vertica/vertica-kubernetes/pkg/podfacts"
"github.com/vertica/vertica-kubernetes/pkg/vadmin"
"github.com/vertica/vertica-kubernetes/pkg/vadmin/opts/altersc"
"github.com/vertica/vertica-kubernetes/pkg/vk8s"
Expand All @@ -36,13 +37,13 @@ type AlterSubclusterTypeReconciler struct {
VRec *VerticaDBReconciler
Log logr.Logger
Vdb *vapi.VerticaDB // Vdb is the CRD we are acting on.
PFacts *PodFacts
PFacts *podfacts.PodFacts
Dispatcher vadmin.Dispatcher
}

// MakeAlterSubclusterTypeReconciler will build a AlterSubclusterTypeReconciler object
func MakeAlterSubclusterTypeReconciler(vdbrecon *VerticaDBReconciler, log logr.Logger,
vdb *vapi.VerticaDB, pfacts *PodFacts, dispatcher vadmin.Dispatcher) controllers.ReconcileActor {
vdb *vapi.VerticaDB, pfacts *podfacts.PodFacts, dispatcher vadmin.Dispatcher) controllers.ReconcileActor {
return &AlterSubclusterTypeReconciler{
VRec: vdbrecon,
Log: log.WithName("AlterSubclusterTypeReconciler"),
Expand Down Expand Up @@ -153,12 +154,12 @@ func (a *AlterSubclusterTypeReconciler) alterSubclusterType(ctx context.Context,
// getInitiatorIP returns the initiator ip that will be used for
// alterSubclusterType
func (a *AlterSubclusterTypeReconciler) getInitiatorIP() (string, bool) {
initiator, ok := a.PFacts.findFirstPodSorted(func(v *PodFact) bool {
return v.isPrimary && v.upNode
initiator, ok := a.PFacts.FindFirstPodSorted(func(v *podfacts.PodFact) bool {
return v.GetIsPrimary() && v.GetUpNode()
})
if !ok {
a.Log.Info("No Up nodes found. Requeue reconciliation.")
return "", true
}
return initiator.podIP, false
return initiator.GetPodIP(), false
}
3 changes: 2 additions & 1 deletion pkg/controllers/vdb/altersubcluster_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
. "github.com/onsi/gomega"
vapi "github.com/vertica/vertica-kubernetes/api/v1"
vmeta "github.com/vertica/vertica-kubernetes/pkg/meta"
"github.com/vertica/vertica-kubernetes/pkg/podfacts"
)

var _ = Describe("altersubcluster_reconcile", func() {
Expand Down Expand Up @@ -66,7 +67,7 @@ var _ = Describe("altersubcluster_reconcile", func() {
},
}
a := AlterSubclusterTypeReconciler{
PFacts: &PodFacts{SandboxName: sbName},
PFacts: &podfacts.PodFacts{SandboxName: sbName},
Vdb: vdb,
Log: logger,
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/controllers/vdb/annotateandlabelpod_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
vapi "github.com/vertica/vertica-kubernetes/api/v1"
"github.com/vertica/vertica-kubernetes/pkg/controllers"
vmeta "github.com/vertica/vertica-kubernetes/pkg/meta"
"github.com/vertica/vertica-kubernetes/pkg/podfacts"
config "github.com/vertica/vertica-kubernetes/pkg/vdbconfig"
"github.com/vertica/vertica-kubernetes/pkg/vk8s"
corev1 "k8s.io/api/core/v1"
Expand All @@ -35,12 +36,12 @@ type AnnotateAndLabelPodReconciler struct {
Rec config.ReconcilerInterface
Log logr.Logger
Vdb *vapi.VerticaDB
PFacts *PodFacts
PFacts *podfacts.PodFacts
}

// MakeAnnotateAndLabelPodReconciler will build a AnnotateAndLabelPodReconciler object
func MakeAnnotateAndLabelPodReconciler(recon config.ReconcilerInterface, log logr.Logger,
vdb *vapi.VerticaDB, pfacts *PodFacts) controllers.ReconcileActor {
vdb *vapi.VerticaDB, pfacts *podfacts.PodFacts) controllers.ReconcileActor {
return &AnnotateAndLabelPodReconciler{
Rec: recon,
Log: log.WithName("AnnotateAndLabelPodReconciler"),
Expand All @@ -66,7 +67,7 @@ func (s *AnnotateAndLabelPodReconciler) Reconcile(ctx context.Context, _ *ctrl.R

// Iterate over pod that exists.
for pn, pf := range s.PFacts.Detail {
if pf.exists {
if pf.GetExists() {
if err := s.applyAnnotationsAndLabels(ctx, pn, annotations, labels); err != nil {
return ctrl.Result{}, err
}
Expand Down Expand Up @@ -124,7 +125,7 @@ func (s *AnnotateAndLabelPodReconciler) applyAnnotationsAndLabels(ctx context.Co
if updated {
// We have added/updated the annotations. Refresh the podfacts.
// This saves having to invalidate the entire thing.
s.PFacts.Detail[podName].hasDCTableAnnotations = true
s.PFacts.Detail[podName].SetHasDCTableAnnotations(true)
}
return err
}
17 changes: 9 additions & 8 deletions pkg/controllers/vdb/at.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/vertica/vertica-kubernetes/pkg/events"
"github.com/vertica/vertica-kubernetes/pkg/names"
"github.com/vertica/vertica-kubernetes/pkg/paths"
"github.com/vertica/vertica-kubernetes/pkg/podfacts"
config "github.com/vertica/vertica-kubernetes/pkg/vdbconfig"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -35,7 +36,7 @@ import (
// base pod is successful, then it will attempt to copy to all of the other pods
// -- checking errors at the end to ensure we attempt at each pod.
func distributeAdmintoolsConf(ctx context.Context, vdb *vapi.VerticaDB, rec config.ReconcilerInterface,
pf *PodFacts, pr cmds.PodRunner, atConfTempFile string) error {
pf *podfacts.PodFacts, pr cmds.PodRunner, atConfTempFile string) error {
// We always distribute to a well known base pod first. The admintools.conf
// on this pod is used as the base for any subsequent changes.
basePod, err := findPodForFirstCopy(vdb, pf)
Expand All @@ -51,14 +52,14 @@ func distributeAdmintoolsConf(ctx context.Context, vdb *vapi.VerticaDB, rec conf
// checking at the end so that we try to copy it to each pod.
errs := []error{}
for _, p := range pf.Detail {
if !p.isPodRunning {
if !p.GetIsPodRunning() {
continue
}
// Skip base pod as it was copied at the start of this function.
if p.name == basePod {
if p.GetName() == basePod {
continue
}
_, _, e := pr.CopyToPod(ctx, p.name, names.ServerContainer, atConfTempFile, paths.AdminToolsConf)
_, _, e := pr.CopyToPod(ctx, p.GetName(), names.ServerContainer, atConfTempFile, paths.AdminToolsConf)
// Save off any error and go onto the next pod
if e != nil {
errs = append(errs, e)
Expand All @@ -77,22 +78,22 @@ func distributeAdmintoolsConf(ctx context.Context, vdb *vapi.VerticaDB, rec conf
// findATBasePod will return the pod to use for the base admintools.conf file.
// The base is used as the initial state of admintools.conf. The caller then
// applies any addition or removals of hosts from that base.
func findATBasePod(vdb *vapi.VerticaDB, pf *PodFacts) (types.NamespacedName, error) {
func findATBasePod(vdb *vapi.VerticaDB, pf *podfacts.PodFacts) (types.NamespacedName, error) {
// We always use pod -0 from the first subcluster as the base for the
// admintools.conf. We assume that all pods are running by the time we get
// here.
for i := range vdb.Spec.Subclusters {
sc := &vdb.Spec.Subclusters[i]
pn := names.GenPodName(vdb, sc, 0)
if pf.Detail[pn].isInstalled {
if pf.Detail[pn].GetIsInstalled() {
return pn, nil
}
}
return types.NamespacedName{}, fmt.Errorf("couldn't find a suitable pod to install from")
}

// findPodForFirstCopy will pick the first pod that admintools.conf should be copied to.
func findPodForFirstCopy(vdb *vapi.VerticaDB, pf *PodFacts) (types.NamespacedName, error) {
func findPodForFirstCopy(vdb *vapi.VerticaDB, pf *podfacts.PodFacts) (types.NamespacedName, error) {
basePod, _ := findATBasePod(vdb, pf)
if basePod != (types.NamespacedName{}) {
return basePod, nil
Expand All @@ -102,7 +103,7 @@ func findPodForFirstCopy(vdb *vapi.VerticaDB, pf *PodFacts) (types.NamespacedNam
for i := range vdb.Spec.Subclusters {
sc := &vdb.Spec.Subclusters[i]
pn := names.GenPodName(vdb, sc, 0)
if pf.Detail[pn].isPodRunning {
if pf.Detail[pn].GetIsPodRunning() {
return pn, nil
}
}
Expand Down
20 changes: 11 additions & 9 deletions pkg/controllers/vdb/clientroutinglabel_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/vertica/vertica-kubernetes/pkg/controllers"
verrors "github.com/vertica/vertica-kubernetes/pkg/errors"
vmeta "github.com/vertica/vertica-kubernetes/pkg/meta"
"github.com/vertica/vertica-kubernetes/pkg/podfacts"
config "github.com/vertica/vertica-kubernetes/pkg/vdbconfig"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -46,13 +47,13 @@ type ClientRoutingLabelReconciler struct {
Rec config.ReconcilerInterface
Vdb *vapi.VerticaDB // Vdb is the CRD we are acting on.
Log logr.Logger
PFacts *PodFacts
PFacts *podfacts.PodFacts
ApplyMethod ApplyMethodType
ScName string // Subcluster we are going to reconcile. Blank if all subclusters.
}

func MakeClientRoutingLabelReconciler(recon config.ReconcilerInterface, log logr.Logger,
vdb *vapi.VerticaDB, pfacts *PodFacts, applyMethod ApplyMethodType, scName string) controllers.ReconcileActor {
vdb *vapi.VerticaDB, pfacts *podfacts.PodFacts, applyMethod ApplyMethodType, scName string) controllers.ReconcileActor {
return &ClientRoutingLabelReconciler{
Rec: recon,
Vdb: vdb,
Expand All @@ -76,7 +77,7 @@ func (c *ClientRoutingLabelReconciler) Reconcile(ctx context.Context, _ *ctrl.Re

var savedRes ctrl.Result
for pn, pf := range c.PFacts.Detail {
if c.ScName != "" && pf.subclusterName != c.ScName {
if c.ScName != "" && pf.GetSubclusterName() != c.ScName {
continue
}
if res, err := c.reconcilePod(ctx, pn, c.PFacts.Detail[pn]); verrors.IsReconcileAborted(res, err) {
Expand All @@ -92,7 +93,8 @@ func (c *ClientRoutingLabelReconciler) Reconcile(ctx context.Context, _ *ctrl.Re
}

// reconcilePod will handle checking for the label of a single pod
func (c *ClientRoutingLabelReconciler) reconcilePod(ctx context.Context, pn types.NamespacedName, pf *PodFact) (ctrl.Result, error) {
func (c *ClientRoutingLabelReconciler) reconcilePod(ctx context.Context, pn types.NamespacedName,
pf *podfacts.PodFact) (ctrl.Result, error) {
var res ctrl.Result
// We retry if case someone else updated the pod since we last fetched it
err := retry.RetryOnConflict(retry.DefaultBackoff, func() error {
Expand All @@ -114,16 +116,16 @@ func (c *ClientRoutingLabelReconciler) reconcilePod(ctx context.Context, pn type
}
c.Log.Info("pod has been patched", "name", pod.Name, "labels", pod.Labels)

if c.ApplyMethod == AddNodeApplyMethod && c.Vdb.IsEON() && pf.upNode && pf.shardSubscriptions == 0 && !pf.isPendingDelete {
c.Log.Info("Will requeue reconciliation because pod does not have any shard subscriptions yet", "name", pf.name)
if c.ApplyMethod == AddNodeApplyMethod && c.Vdb.IsEON() && pf.GetUpNode() && pf.GetShardSubscriptions() == 0 && !pf.GetIsPendingDelete() {
c.Log.Info("Will requeue reconciliation because pod does not have any shard subscriptions yet", "name", pf.GetName())
res.Requeue = true
}
return nil
})
return res, err
}

func (c *ClientRoutingLabelReconciler) manipulateRoutingLabelInPod(pod *corev1.Pod, pf *PodFact) {
func (c *ClientRoutingLabelReconciler) manipulateRoutingLabelInPod(pod *corev1.Pod, pf *podfacts.PodFact) {
_, labelExists := pod.Labels[vmeta.ClientRoutingLabel]

// There are 4 cases this reconciler is used:
Expand All @@ -144,13 +146,13 @@ func (c *ClientRoutingLabelReconciler) manipulateRoutingLabelInPod(pod *corev1.P
// entire subcluster, so pending delete isn't checked.
switch c.ApplyMethod {
case AddNodeApplyMethod, PodRescheduleApplyMethod:
if !labelExists && pf.upNode && (pf.shardSubscriptions > 0 || !c.Vdb.IsEON()) && !pf.isPendingDelete {
if !labelExists && pf.GetUpNode() && (pf.GetShardSubscriptions() > 0 || !c.Vdb.IsEON()) && !pf.GetIsPendingDelete() {
pod.Labels[vmeta.ClientRoutingLabel] = vmeta.ClientRoutingVal
c.Log.Info("Adding client routing label", "pod",
pod.Name, "label", fmt.Sprintf("%s=%s", vmeta.ClientRoutingLabel, vmeta.ClientRoutingVal))
}
case DelNodeApplyMethod, DrainNodeApplyMethod:
if labelExists && (c.ApplyMethod == DrainNodeApplyMethod || pf.isPendingDelete) {
if labelExists && (c.ApplyMethod == DrainNodeApplyMethod || pf.GetIsPendingDelete()) {
delete(pod.Labels, vmeta.ClientRoutingLabel)
c.Log.Info("Removing client routing label", "pod",
pod.Name, "label", fmt.Sprintf("%s=%s", vmeta.ClientRoutingLabel, vmeta.ClientRoutingVal))
Expand Down
Loading

0 comments on commit 2a87a60

Please sign in to comment.