-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use static labels in pods #791
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ package vdb | |
import ( | ||
"context" | ||
"fmt" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/go-logr/logr" | ||
|
@@ -349,9 +348,8 @@ func (o *OnlineUpgradeReconciler) iterateSubclusterType(ctx context.Context, scT | |
|
||
for i := range stss.Items { | ||
sts := &stss.Items[i] | ||
if matches, err := o.isMatchingSubclusterType(sts, scType); err != nil { | ||
return ctrl.Result{}, err | ||
} else if !matches { | ||
matches := o.isMatchingSubclusterType(sts, scType) | ||
if !matches { | ||
continue | ||
} | ||
|
||
|
@@ -426,12 +424,17 @@ func (o *OnlineUpgradeReconciler) processSecondary(ctx context.Context, sts *app | |
|
||
// isMatchingSubclusterType will return true if the subcluster type matches the | ||
// input string. Always returns false for the transient subcluster. | ||
func (o *OnlineUpgradeReconciler) isMatchingSubclusterType(sts *appsv1.StatefulSet, scType string) (bool, error) { | ||
isTransient, err := strconv.ParseBool(sts.Labels[vmeta.SubclusterTransientLabel]) | ||
if err != nil { | ||
return false, fmt.Errorf("could not parse label %s: %w", vmeta.SubclusterTransientLabel, err) | ||
func (o *OnlineUpgradeReconciler) isMatchingSubclusterType(sts *appsv1.StatefulSet, scType string) bool { | ||
stsScType := sts.Labels[vmeta.SubclusterTypeLabel] | ||
if stsScType != scType { | ||
return false | ||
} | ||
|
||
transientName, hasTransient := o.Vdb.GetTransientSubclusterName() | ||
if !hasTransient { | ||
return true | ||
} | ||
return sts.Labels[vmeta.SubclusterTypeLabel] == scType && !isTransient, nil | ||
return sts.Labels[vmeta.SubclusterNameLabel] != transientName | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it is been a while but why dowe need to return false for transient sc? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When online upgrade iterates over subclusters (i.e. to upgrade, add client routing, etc), we always want to skip transient. Those aren't ever upgraded. They are meant to only serve read requests during the upgrade. |
||
} | ||
|
||
// drainSubcluster will reroute traffic away from a subcluster and wait for it to be idle. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update this comment now that we find sts instead of svc?