Skip to content
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

feat: support multiple routes per rollout #34

Merged

Conversation

svrakitin
Copy link
Contributor

@svrakitin svrakitin commented Feb 5, 2024

Closes #33

Introduces httpRoutes and tcpRoutes fields to plugin config, which allows us to reference multiple HTTPRoute and TCPRoute resources.

Given following routes:

apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: first-route
spec:
  parentRefs:
    - name: gateway
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /first
    backendRefs:
    - name: argo-rollouts-stable-service
      kind: Service
      port: 80
    - name: argo-rollouts-canary-service
      kind: Service
      port: 80
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: second-route
spec:
  parentRefs:
    - name: gateway
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /second  
    backendRefs:
    - name: argo-rollouts-stable-service
      kind: Service
      port: 80
    - name: argo-rollouts-canary-service
      kind: Service
      port: 80

We can configure the plugin to update weights for each referenced route. For example:

plugins:
  argoproj-labs/gatewayAPI:
    httpRoutes:
       - name: first-route
          useHeaderRoutes: true
       - name: second-route

useHeaderRoutes field indicates we will add header routes for this specific route or no

@Philipp-Plotnikov
Copy link
Collaborator

Philipp-Plotnikov commented Feb 6, 2024

@svrakitin please ping me when you will resolve all comments. Thank you for contribution!

@svrakitin
Copy link
Contributor Author

@Philipp-Plotnikov Made some changes

gatewayAPIConfig := GatewayAPITrafficRouting{}
err := json.Unmarshal(rollout.Spec.Strategy.Canary.TrafficRouting.Plugins[PluginName], &gatewayAPIConfig)
gatewayAPIConfig := &GatewayAPITrafficRouting{}
err := json.Unmarshal(rollout.Spec.Strategy.Canary.TrafficRouting.Plugins[PluginName], gatewayAPIConfig)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json.Unmarshal(rollout.Spec.Strategy.Canary.TrafficRouting.Plugins[PluginName], &gatewayAPIConfig)

@Philipp-Plotnikov
Copy link
Collaborator

Philipp-Plotnikov commented Feb 6, 2024

@svrakitin Dont you think that

plugins:
  argoproj-labs/gatewayAPI:
    httpRoutes: 
      - first
      - second
     tcpRoutes:
...

Will be easier to use ? And also in so case we dont need additional structure in GatewayAPIConfig, right ? We will have seperate fields

HTTPRouteList []string 
TCPRouteList []string

@svrakitin
Copy link
Contributor Author

I don't have a preference as long as it does the job. If you feel this makes more sense I'll update.

@Philipp-Plotnikov
Copy link
Collaborator

I don't have a preference as long as it does the job. If you feel this makes more sense I'll update.

Then, please update as it seems easier to use and less code

@svrakitin
Copy link
Contributor Author

Done. Not sure that using separate fields makes it easier though.

@Philipp-Plotnikov
Copy link
Collaborator

Philipp-Plotnikov commented Feb 6, 2024

Please update description to the PR to understand how to test this feature for users who wants to test it. I think it is very useful feature and somebody wants to test it not reading the code

@Philipp-Plotnikov
Copy link
Collaborator

Done. Not sure that using separate fields makes it easier though.

Code became cleaner and tcpRoutes and httpRoutes will be seperated and easier to find needing route in manifest

@Philipp-Plotnikov
Copy link
Collaborator

When you will finish please update me to be sure that it is ok, but I think it was last comments. We will wait a little bit on this week to give users a chance to run it locally and test it. After I or Kostis merge this PR and ping you here with congratulations )

Signed-off-by: Stepan Rakitin <[email protected]>
@svrakitin
Copy link
Contributor Author

Alright, I hope that's it. Everything else can be addressed by other PRs as pure cosmetics. Thanks.

@Philipp-Plotnikov
Copy link
Collaborator

@svrakitin great job!

@supersyn
Copy link

supersyn commented Feb 12, 2024

Hi all! I've built the plugin using this branch locally (run the make release command in the main folder), but when trying to use it I've stumbled upon the same issue as already reported here:

failed to get traffic router plugin argoproj-labs/gatewayAPI: unable to start plugin system: unable to get plugin client (argoproj-labs/gatewayAPI) for ping: exec: Stdout already set\n" error="<nil>"

The official v0.0.0-rc1 version of the plugin works without problems.

go version used for local build: go1.20.14 darwin/arm64

Built artifact I am using for testing.

I tried to reset the Argo Rollouts Controller deployment multiple times, delete the rollout, and reapply it again, but nothing helped.

Do you maybe have any idea what could be the issue here?

Thank you!

@Philipp-Plotnikov
Copy link
Collaborator

Philipp-Plotnikov commented Feb 13, 2024

Hi @supersyn ! It seems because some process have been already using needing resources. Im using Vscode and in development in some cases I need to kill process manually to free resources to start new version of plugin. Did you check it ? Also I created PR with the fix for setHeaderRoute feature, you can try it, it would be great.
#37
Here you can find the example how to use it
#31

@svrakitin
Copy link
Contributor Author

svrakitin commented Feb 16, 2024

@Philipp-Plotnikov Recent changes in upstream introduced too many conflicts and I would appreciate help with resolving those as your team seem to have much more context and opinion on how to incorporate these changes. I will only be able to look at this again after Feb 24.

@kostis-codefresh
Copy link
Collaborator

@svrakitin We will resolve the conflicts since we introduced them. Sorry for the confusion.

@Philipp-Plotnikov
Copy link
Collaborator

@svrakitin it will be great if you will test it locally to be sure it is ok

@Philipp-Plotnikov
Copy link
Collaborator

Philipp-Plotnikov commented Feb 21, 2024

@kostis-codefresh it seems PR is ready. I tested locally, it works fine. It will be great if someone will test it locally too.
To create local build, run in the root of repository:

make local-build

@Philipp-Plotnikov
Copy link
Collaborator

Philipp-Plotnikov commented Feb 22, 2024

@svrakitin I think we will merge this PR on the following week if anyone will find bugs. As we have here a lot of features

@Philipp-Plotnikov Philipp-Plotnikov merged commit 18cc071 into argoproj-labs:main Feb 26, 2024
4 checks passed
@Philipp-Plotnikov
Copy link
Collaborator

@svrakitin our congratulations with contribution! Great job! Thank you!

@kostis-codefresh
Copy link
Collaborator

@svrakitin Documentation is now here https://rollouts-plugin-trafficrouter-gatewayapi.readthedocs.io/en/latest/features/multiple-routes/

Any feedback welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multiple HTTPRoute resources per rollout
4 participants