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

SetHeader option support #21

Closed
mvishnevsky opened this issue Aug 24, 2023 · 5 comments · Fixed by #31
Closed

SetHeader option support #21

mvishnevsky opened this issue Aug 24, 2023 · 5 comments · Fixed by #31
Assignees
Labels
enhancement New feature or request

Comments

@mvishnevsky
Copy link

Hi,
I was wondering if there is a plan or a roadmap for when the plugin will support the SetHeader option.
Thank you!

@cevret
Copy link

cevret commented Aug 29, 2023

I am also interested in this. Thanks!

@Philipp-Plotnikov
Copy link
Collaborator

Philipp-Plotnikov commented Sep 15, 2023

Hi, thank you for idea. I think it will be nice feature for the plugin. I think we can implement it and I have suggestion how we can do it.

  1. Set setHeaderRoute function as available feature for argoproj-labs/gatewayAPI in argo rollouts manifest
  2. We will create additional httpRoute resource that will overwrite the main httpRoute using the following rules(they are identical to the gateway api rules).
    You can find them here
    https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1beta1.HTTPRouteRule

I tested it locally. It works.

What do you think ?
@kostis-codefresh @zachaller

@Philipp-Plotnikov
Copy link
Collaborator

Philipp-Plotnikov commented Sep 15, 2023

The structure of Argo Rollouts manifest will be the following

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: rollouts-demo
spec:
  replicas: 5
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app: rollouts-demo
  template:
    metadata:
      labels:
        app: rollouts-demo
    spec:
      containers:
      - name: rollouts-demo
        image: argoproj/rollouts-demo:green
        ports:
        - name: http
          containerPort: 8080
          protocol: TCP
  strategy:
    canary:
      stableService: stable-service
      canaryService: canary-service
      trafficRouting:
        managedRoutes:
          - name: header-route
        plugins:
          argoproj-labs/gatewayAPI:
            namespace: default
            httpRoute: http-route
      steps:
        - setWeight: 20
        - setHeaderRoute: # enable header based traffic routing where
             name: "header-route"
             match:
               - headerName: Custom-Header1 # Custom-Header1=Mozilla
                  headerValue:
                    exact: Mozilla
               - headerName: Custom-Header2 # or Custom-Header2 has a prefix Mozilla
                  headerValue:
                    prefix: Mozilla
               - headerName: Custom-Header3 # or Custom-Header3 value match regex: Mozilla(.*)
                  headerValue:
                    regex: Mozilla(.*)
        - pause: {}
        - setHeaderRoute:
             name: "header-route"

If match header type in argo manifest is exact we use header match type Exact in HttpRoute
If match header type in argo manifest is regex we use header match type RegularExpression in HttpRoute
If match header type in argo manifest is prefix we use header match type RegularExpression in HttpRoute and add .* to the end of %user value%
%user value%.*

@Philipp-Plotnikov Philipp-Plotnikov self-assigned this Sep 18, 2023
@Philipp-Plotnikov
Copy link
Collaborator

You can see the progress here
#31

@Philipp-Plotnikov
Copy link
Collaborator

@kostis-codefresh @mvishnevsky @cevret PR is ready. You can go to the PR and try it locally. Run make local-build and you will get binary to test. I also put the description to the PR to understand how it works

@Philipp-Plotnikov Philipp-Plotnikov added the enhancement New feature or request label Feb 2, 2024
@Philipp-Plotnikov Philipp-Plotnikov linked a pull request Feb 6, 2024 that will close this issue
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
3 participants