-
Notifications
You must be signed in to change notification settings - Fork 40
feat: enhance Gateway API plugin with in-progress label management #155
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
Open
stokkie90
wants to merge
12
commits into
argoproj-labs:main
Choose a base branch
from
stokkie90:label-httproute
base: main
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
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
005b751
feat: enhance Gateway API plugin with in-progress label management
stokkie90 7edbcc1
ci
stokkie90 b544239
fix ignorediff doc section
stokkie90 8ca16d5
chore: Add test
stokkie90 d6f5c27
update versions of rollouts and traefik
stokkie90 d5057a0
cleanup
stokkie90 4bf5fd8
test
stokkie90 92c9292
add wait to sanity check
stokkie90 615fb9c
chore: move label change into it's own test
stokkie90 b12ec80
Fix lint
stokkie90 5bb5308
cleanup
stokkie90 849ca81
Enhance sanity check script to retry gateway class acceptance with a …
stokkie90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| * Added support for [TLSRoute](https://rollouts-plugin-trafficrouter-gatewayapi.readthedocs.io/en/latest/features/tls/). | ||
| * You can now use [filters with Header based routing](https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi/issues/87). | ||
| * You can now use [filters with Header based routing](https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi/issues/87). | ||
| * Gateway API routes are labeled while a canary is running to avoid GitOps drift and the label is removed once traffic returns to 100% stable. |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| package defaults | ||
|
|
||
| const ConfigMap = "argo-gatewayapi-configmap" | ||
| const ( | ||
| ConfigMap = "argo-gatewayapi-configmap" | ||
| InProgressLabelKey = "rollouts.argoproj.io/gatewayapi-canary" | ||
| InProgressLabelValue = "in-progress" | ||
| ) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package plugin | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
|
||
| "github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi/internal/defaults" | ||
| ) | ||
|
|
||
| func ensureInProgressLabel(obj metav1.Object, desiredWeight int32, config *GatewayAPITrafficRouting) bool { | ||
| if obj == nil || config == nil || config.DisableInProgressLabel { | ||
| return false | ||
| } | ||
|
|
||
| key := config.inProgressLabelKey() | ||
| if key == "" { | ||
| return false | ||
| } | ||
|
|
||
| labels := obj.GetLabels() | ||
| if desiredWeight == 0 { | ||
| if labels == nil { | ||
| return false | ||
| } | ||
| if _, ok := labels[key]; ok { | ||
| delete(labels, key) | ||
| obj.SetLabels(labels) | ||
| return true | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| value := config.inProgressLabelValue() | ||
| if labels == nil { | ||
| labels = make(map[string]string) | ||
| } | ||
| if current, ok := labels[key]; ok && current == value { | ||
| return false | ||
| } | ||
| labels[key] = value | ||
| obj.SetLabels(labels) | ||
| return true | ||
| } | ||
|
|
||
| func (c *GatewayAPITrafficRouting) inProgressLabelKey() string { | ||
| if c.InProgressLabelKey != "" { | ||
| return c.InProgressLabelKey | ||
| } | ||
| return defaults.InProgressLabelKey | ||
| } | ||
|
|
||
| func (c *GatewayAPITrafficRouting) inProgressLabelValue() string { | ||
| if c.InProgressLabelValue != "" { | ||
| return c.InProgressLabelValue | ||
| } | ||
| return defaults.InProgressLabelValue | ||
| } |
Oops, something went wrong.
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.
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 experienced these issues, and only fix was to remove the configmap.