This repository has been archived by the owner on Aug 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Pod labeler #115
Open
josh-ferrell-sas
wants to merge
3
commits into
aledbf:master
Choose a base branch
from
josh-ferrell-sas:pod-labeler
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Pod labeler #115
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steven-sheehy
suggested changes
Mar 21, 2020
} | ||
|
||
for k,v := range labels { | ||
pod.ObjectMeta.Labels[k] = v |
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.
This looks like it replaces all labels instead of just adding vip-holder if it doesn't exist.
@@ -195,6 +195,20 @@ func (k *keepalived) IsRunning() bool { | |||
return true | |||
} | |||
|
|||
func (k *keepalived) isMaster() bool { |
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.
This method should be called by Healthy() to reduce duplication.
@@ -466,6 +466,19 @@ func NewIPVSController(kubeClient *kubernetes.Clientset, namespace string, useUn | |||
return | |||
} | |||
|
|||
state := ipvsc.keepalived.isMaster() |
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.
I don't think it's appropriate that invoking the health check endpoint can somehow trigger pod labels to be changed. This logic should live elsewhere.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A while back I wrote a sidecar that would patch the pod with either vip-holder true or vip-holder false depending on the keepalived state. I decided to write the code into the upstream project as part of the /health endpoint.