-
Notifications
You must be signed in to change notification settings - Fork 83
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
Support for GlobalTrafficPolicy priority processing #249
Conversation
db4c256
to
6b94a0b
Compare
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.
Please take a look at the comments.
admiral/cmd/admiral/cmd/root.go
Outdated
@@ -115,6 +115,8 @@ func GetRootCmd(args []string) *cobra.Command { | |||
"The label value, on a namespace or service, which tells Istio to perform sidecar injection") | |||
rootCmd.PersistentFlags().StringVar(¶ms.LabelSet.AdmiralIgnoreLabel, "admiral_ignore_label", "admiral-ignore", | |||
"The label value, on a namespace, which tells Istio to perform sidecar injection") | |||
rootCmd.PersistentFlags().StringVar(¶ms.LabelSet.ResourcePriorityKey, "resource_priority_key", "admiral.io/resource-priority", |
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.
Simply call it priority instead of resource priority.
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.
updated to priority label
@@ -40,6 +40,7 @@ func init() { | |||
|
|||
p.LabelSet.WorkloadIdentityKey = "identity" | |||
p.LabelSet.GlobalTrafficDeploymentLabel = "identity" | |||
p.LabelSet.ResourcePriorityKey = "admiral.io/resource-priority" |
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.
Same suggestion as above.
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.
updated to priority label
admiral/pkg/clusters/serviceentry.go
Outdated
@@ -276,6 +290,15 @@ func updateGlobalGtpCache(cache *AdmiralCache, identity, env string, gtps map[st | |||
} | |||
} | |||
|
|||
func sortFetchedGtps(gtpsToOrder []*v1.GlobalTrafficPolicy, identity string, env string) { |
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.
func sortFetchedGtps(gtpsToOrder []*v1.GlobalTrafficPolicy, identity string, env string) { | |
func sortGtpsByCreationTime(gtpsToOrder []*v1.GlobalTrafficPolicy, identity string, env string) { |
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.
Updated the method name
} | ||
mostRecentGtp = priorityGtpsOrdered[0] | ||
} | ||
} |
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.
Can't we build this into sorting function itself? Sort by priority label present followed by date created?
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.
Updated the sorting function
admiral/pkg/clusters/serviceentry.go
Outdated
} | ||
} else { | ||
for _, matchedGtp := range gtpsOrdered { | ||
if matchedGtp.ObjectMeta.Labels[common.GetAdmiralParams().LabelSet.ResourcePriorityKey] == "true" { |
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.
@vrushalijoshi , just a thought. This would mean that any GTP created by "anyone" with admiral.io/resource-priority: true
would be treated as a higher priority.
Do you think it would make sense to have a value that could be passed as a param when the admiral starts and we only look for that value in the label?
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.
Added fix for priority to value instead of true/false
Signed-off-by: vjoshi3 <[email protected]>
Signed-off-by: vjoshi3 <[email protected]>
Signed-off-by: vjoshi3 <[email protected]>
8442430
to
78b5e4d
Compare
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.
lgtm
* Changes to report coverage to ODL+ test fixes+ catering to review * Removing codecov force flag
Adding support to handle GlobalTrafficPolicy with priority label