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

Add support for gtp with multiple traffic policies #162

Conversation

aattuluri
Copy link
Contributor

No description provided.

Signed-off-by: aattuluri <anil_attuluri@intuit.com>
Signed-off-by: aattuluri <anil_attuluri@intuit.com>
Signed-off-by: aattuluri <anil_attuluri@intuit.com>
Signed-off-by: aattuluri <anil_attuluri@intuit.com>
@@ -90,18 +90,18 @@ jobs:
cd tests
export IS_LOCAL=false
./run.sh "1.16.8" "1.5.7" "../out"
# - run:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not keep commented out code

.circleci/config.yml Show resolved Hide resolved
if gtpWrapper != nil {
processGtp := true
if len(locality) == 0 {
log.Errorf(LogErrFormat, "Process", "GlobalTrafficPolicy", host, "", "Skipping gtp processing, locality of the cluster nodes cannot be determined. Is this minikube?")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be warning? Since it seems like the overall processing is able to continue

admiral/pkg/clusters/handler.go Show resolved Hide resolved
admiral/pkg/clusters/serviceentry.go Show resolved Hide resolved
func AddServiceEntriesWithDr(cache *AdmiralCache, sourceClusters map[string]string, rcs map[string]*RemoteController, serviceEntries map[string]*networking.ServiceEntry) {
syncNamespace := common.GetSyncNamespace()
for _, se := range serviceEntries {

//add service entry
serviceEntryName := getIstioResourceName(se.Hosts[0], "-se")
//Add a label
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this comment accurate?

admiral/pkg/clusters/serviceentry.go Show resolved Hide resolved
var modifiedSe *networking.ServiceEntry
var host = se.Hosts[0]
var drName, seName = defaultDrName, defaultSeName
if gtpTrafficPolicy.Dns != env && gtpTrafficPolicy.Dns != common.Default {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you possible mean some other comparison here? Is it possible that the DNS = env?

labels:
identity: greeting
spec:
policy:
- dns: stage.greeting.global
- dns: default # default is a keyword, alternatively you can use `env` (ex: stage)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Connecting to my previous comment Do you possible mean some other comparison here? Is it possible that the DNS = env? - could we maybe document this behavior a little bit more clearly? I find it a little counterintuitive that the DNS field should be the relevant environment (and it's distinctly different from how the docs say things work: https://github.com/istio-ecosystem/admiral/blob/master/docs/Architecture.md)

@josephpeacock
Copy link
Collaborator

The change from the DNS field in the GTP to be the environment seems to be backwards incompatible to me. Are we concerned that may break any existing users?

@aattuluri
Copy link
Contributor Author

The change from the DNS field in the GTP to be the environment seems to be backwards incompatible to me. Are we concerned that may break any existing users?

I changed the implementation to treat dns as a dns prefix rather than FQQN, the rationale is as follows:
Currently, we generate default service entries based on the env label and they look something like ..global. Now when a gtp is defined, repeating the fully qualified domain name for every dns is error prone and cannot guarantee uniqueness across envs and namespaces. The dns field will act as a dnsPrefix except for scenarios where dns = 'default' (a keyword) or dns = env in which case its assumed that someone is trying to define override for locality load balancing via gtp for the default name. This will actually preserve backward compatibility and make sure the generated entries are unique.

That being said, I can add an additional check to see if the dns in gtp matches the full default host for backward compatibility but that will retain hybrid behavior (dns prefix vs full dns), so I think it makes sense to introduce this backward incompatible change and then call it out in the release notes.

@josephpeacock
Copy link
Collaborator

I agree 100% that this is a good direction in which to go. I just want to make sure we're not breaking anyone else. Not sure how careeful we want to be, but the most foolproof option would probably be to introduce a new field in the GTP spec (something like DNSPrefix) and mark DNS as deprecated.

Copy link
Collaborator

@josephpeacock josephpeacock left a comment

Choose a reason for hiding this comment

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

Approving as all of your updates look good, but please update the GTP section here: https://github.com/istio-ecosystem/admiral/blob/master/docs/Architecture.md to use the DNS prefix and show how it's used.

@aattuluri aattuluri merged commit c604d11 into istio-ecosystem:master Jan 19, 2021
Mengying-Li pushed a commit that referenced this pull request Apr 28, 2021
Fixes #163
Fixes #161

Signed-off-by: Mengying <mengyinglimandy@gmail.com>
Mengying-Li added a commit that referenced this pull request May 24, 2021
* Add support for gtp with multiple traffic policies (#162)

Fixes #163
Fixes #161

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* Fix mesh port match against to look at k8s svc target port (#165)

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* Add basic health check API  (#171)

* some basic folder

* get the basic curl /health/ready working

* Refactoring api server files

* reverting a very tiny comment that I shouldn't have pushed

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* trying to fix the circle CI error

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* addressed the comment

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

Co-authored-by: vjoshi3 <vrushali_joshi@intuit.com>
Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* Admiral apis (#175)

* added the get all cluste api

Signed-off-by: Mengying <mengyinglimandy@gmail.com>
Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* fixed the unit test

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* updated the comment a little bit

Signed-off-by: Mengying <mengyinglimandy@gmail.com>
Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Adding api to get service entries based on given cluster or given identity

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Refactoring api code

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Fixing failing tests for service.go

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Fixing review comments and ci failures

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Fixing review comments

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* added some unit tests

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added the cluster id inside deployment controller (#176)

* added the cluster id inside deployment controller

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* fixed the helm setup failure

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added cluster id in other remote controllers

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added unit test for api function GetServiceEntriesByCluster

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* fixed a small typing in test

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* fixed some indentation

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added test for get se by identity

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added cluster id to be print in log

Co-authored-by: Mengying <mengyinglimandy@gmail.com>
Co-authored-by: vjoshi3 <vrushali_joshi@intuit.com>
Co-authored-by: Mengying-Li <43981707+Mengying-Li@users.noreply.github.com>

* added more context to the API call

Co-authored-by: aattuluri <44482891+aattuluri@users.noreply.github.com>
Co-authored-by: vjoshi3 <vrushali_joshi@intuit.com>
Co-authored-by: vrushalijoshi <vrushalijoshi.cummins@gmail.com>
psikka1 pushed a commit to psikka1/admiral that referenced this pull request Jun 15, 2022
* Add support for gtp with multiple traffic policies (istio-ecosystem#162)

Fixes istio-ecosystem#163
Fixes istio-ecosystem#161

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* Fix mesh port match against to look at k8s svc target port (istio-ecosystem#165)

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* Add basic health check API  (istio-ecosystem#171)

* some basic folder

* get the basic curl /health/ready working

* Refactoring api server files

* reverting a very tiny comment that I shouldn't have pushed

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* trying to fix the circle CI error

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* addressed the comment

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

Co-authored-by: vjoshi3 <vrushali_joshi@intuit.com>
Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* Admiral apis (istio-ecosystem#175)

* added the get all cluste api

Signed-off-by: Mengying <mengyinglimandy@gmail.com>
Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* fixed the unit test

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* updated the comment a little bit

Signed-off-by: Mengying <mengyinglimandy@gmail.com>
Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Adding api to get service entries based on given cluster or given identity

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Refactoring api code

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Fixing failing tests for service.go

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Fixing review comments and ci failures

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* Fixing review comments

Signed-off-by: vjoshi3 <vrushali_joshi@intuit.com>

* added some unit tests

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added the cluster id inside deployment controller (istio-ecosystem#176)

* added the cluster id inside deployment controller

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* fixed the helm setup failure

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added cluster id in other remote controllers

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added unit test for api function GetServiceEntriesByCluster

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* fixed a small typing in test

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* fixed some indentation

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added test for get se by identity

Signed-off-by: Mengying <mengyinglimandy@gmail.com>

* added cluster id to be print in log

Co-authored-by: Mengying <mengyinglimandy@gmail.com>
Co-authored-by: vjoshi3 <vrushali_joshi@intuit.com>
Co-authored-by: Mengying-Li <43981707+Mengying-Li@users.noreply.github.com>

* added more context to the API call

Co-authored-by: aattuluri <44482891+aattuluri@users.noreply.github.com>
Co-authored-by: vjoshi3 <vrushali_joshi@intuit.com>
Co-authored-by: vrushalijoshi <vrushalijoshi.cummins@gmail.com>
Signed-off-by: psikka1 <pankaj_sikka@intuit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants