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

Added headers manipulations capabilities to DestinationWeight #626

Merged
merged 1 commit into from
Sep 14, 2018

Conversation

omersadika
Copy link
Contributor

added 3 new fields to DestinationWeight: append_headers, remove_response_headers and append_response_headers.

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@googlebot googlebot added the cla: no Set by the Google CLA bot to indicate the author of a PR has not signed the Google CLA. label Aug 29, 2018
@omersadika
Copy link
Contributor Author

This PR is needed for istio PR:
istio/istio#8340

@omersadika
Copy link
Contributor Author

I signed it!

@rshriram
Copy link
Member

/ok-to-test

@rshriram
Copy link
Member

Hi. Soprry for the delay. I can't merge this until the CLA thing is set.. can you take care of the CLA and ping me again?

@rshriram
Copy link
Member

Thanks for the test. Can you take care of the CLA please?

@rshriram
Copy link
Member

/lgtm

@istio-testing
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rshriram

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sebastienvas
Copy link
Contributor

@omersadika which identity did you use the sign the CLA ? I cannot find you in the database.

@omersadika
Copy link
Contributor Author

I signed as a company, the name is Bevyx

@sebastienvas sebastienvas added cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. and removed cla: no Set by the Google CLA bot to indicate the author of a PR has not signed the Google CLA. labels Sep 14, 2018
@googlebot
Copy link
Collaborator

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

@sebastienvas
Copy link
Contributor

Bevyx Inc has signed the agreement

@istio-testing istio-testing merged commit 61f3835 into istio:master Sep 14, 2018
@omersadika
Copy link
Contributor Author

Thank you a lot @sebastienvas and @rshriram

What about the PR in Istio repo?

istio/istio#8340

@rshriram
Copy link
Member

@omersadika @frankbu pointed out an important fact. This destination weight is shared across tcp and other future protos. Instead of having append_headers, etc.. can you create a separate sub message in DestinationWeight, like http:.. within which, you can stick in any thing you want (append_headers, remove.., etc.). This leaves the door for TCP and TLS to do some things in future..

Something like this:

route:
- destination:
    host:...
    port:...
    subset:...
    httpOperations: or just http:
       requestHeaders:
          add: map<string, string>
          remove: array..
       responseHeaders:
          add: map<string,string>
          remove: <array>

Please rework the current structs accordingly.

Sorry for not spotting this earlier.

@omersadika
Copy link
Contributor Author

Really good point @rshriram
I totally agree that since destination is shared we should take it into consideration.
The thing is that route has 3 different variations for each type - http, tls or tcp and maybe more in the future.
When I write the destination I see it as in the context of the route that I chose, http for example, and I assume that everything I do is for the same type. To add subtypes inside destination seems for me too redundant and could be more complex in the future.
The best solution that I see is to create destination per type, same as route although it won't be an small change for the API.
What do you think?

@frankbu
Copy link
Contributor

frankbu commented Sep 14, 2018

A possibility is to add one new message, HTTPDestination, which has the same contents as DestinationWeight plus the xxx_headers fields, and then use it in HTTPRoute instead of DestinationWieght. The other route types can stay unchanged (for now).

I'm also wondering why we need these headers fields in both the HTTPRoute, as well as in the weighted routes. Are the HTTPRoute ones a mistake that should be deprecated, or do we really need them in both places. Also, if we need them in both places, shouldn't we add append_response_headers in HTTPRoute as well?

@omersadika
Copy link
Contributor Author

Sounds good. It makes sense to have it also in HTTPRoute if you want to add it to all destinations at once. Actually the way it's done today is deprecated in Envoy so I can also update to the new way, I will also check to add the other xxx_headers options for route. Do I have a green light to make the changes?

@frankbu
Copy link
Contributor

frankbu commented Sep 17, 2018

Now that I think about it, DestinationWeight is not a great name. Maybe we should rename DestinationWeight to RouteDestination, since it is the value of the destination field of the three "route" types. Then the new one, I'm suggesting could be HTTPRouteDestination. I think that would be a lot clearer.

Edit: Actually DestinationWeight is the value of the route field of the three route types (not the destination field), but I still think RouteDestination would be a better name.

@rshriram WDYT?

@rshriram
Copy link
Member

As long as this does not involve any changes in teh field names (for backward compatibility), I am okay with the renaming and adding the header operations under the destination weight. Also, please have an option for adding/removing both request and response headers (envoy has a PR in flight to remove request headers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants