Skip to content

destination: Remove support for IP Queries in Get API#6018

Merged
Pothulapati merged 12 commits intomainfrom
tarun/dest-drop-get-ip
Apr 21, 2021
Merged

destination: Remove support for IP Queries in Get API#6018
Pothulapati merged 12 commits intomainfrom
tarun/dest-drop-get-ip

Conversation

@Pothulapati
Copy link
Contributor

Fixes #5246

This PR updates the destination to report an error when Get
is called for IP Queries. As the issue mentions, The proxies
are not using this API anymore and it helps to simplify and
remove unecessary logic.

This change is aimed for stable-2.11, and depends on
linkerd/linkerd2-proxy#972

Signed-off-by: Tarun Pothulapati [email protected]

Fixes #5246

This PR updates the destination to report an error when `Get`
is called for IP Queries. As the issue mentions, The proxies
are not using this API anymore and it helps to simplify and
remove unecessary logic.

This change is aimed for `stable-2.11`, and depends on
linkerd/linkerd2-proxy#972

Signed-off-by: Tarun Pothulapati <[email protected]>
@Pothulapati Pothulapati marked this pull request as ready for review April 15, 2021 07:25
@Pothulapati Pothulapati requested a review from a team as a code owner April 15, 2021 07:25
as `Get` no longer returns pod IP queries, We don't have to maintain
the logic for subscriptions.

Signed-off-by: Tarun Pothulapati <[email protected]>
Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

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

So the IP watcher is used for GetSvcID and GetPod now. However, both of those functions only use the k8sAPI field which we have access to in the server. We should change those from methods on IPWatcher to methods on Server.

NewIPWatcher has a side effect which adds the podIPIndex and hostIPIndex indexers to the k8sAPI that is passed in. Adding those indexers should probably move to Server's initialization. After doing that, I think we should be able to fully get rid of IPWatcher.

This commit moves the indexer creations into Server.go, so that there
is a single place where all indexers are created instead of each watcher
doing its own. This works because the same `k8s.API` is used across watchers
and the server.

With this change, The golang watcher tests are expected to fail as the informers
are outside of the watcher logic that they test.

Signed-off-by: Tarun Pothulapati <[email protected]>
… tests

This commit updates the unit tests to call `initializeIndexers` to initialize
indexers before running the watcher specific unit tests.

The `initializeIndexers` had to be in `k8s.go` in `watcher` pkg as it had to be
used across watcher and the destination pkg.

Signed-off-by: Tarun Pothulapati <[email protected]>
@Pothulapati Pothulapati requested a review from kleimkuhler April 16, 2021 12:25
Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

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

Overall this looks good. I think moving the watcher setup into a function makes sense so that it's more obvious that we are adding indexers as part of its initialization.

I was going to suggest making getSvcID and getPod as methods on Server, but since we don't use any other fields from the server I think they are okay as regular functions. That being said, it may be worth making them methods on k8s.API in the controller package. That way we can keep functions like this in a singular place.

Old:

svcID, err := getSvcID(s.k8sAPI, ip.String(), log)

New:

svcID, err := s.k8sAPI.getSvcID(ip.String(), log)

Copy link
Member

@adleong adleong left a comment

Choose a reason for hiding this comment

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

👑 💇

Signed-off-by: Tarun Pothulapati <[email protected]>
@Pothulapati
Copy link
Contributor Author

That being said, it may be worth making them methods on k8s.API in the controller package.

I'm not sure if it is the right way to do it for the following reasons:

  • It would introduce a lot of the indexing logic and types into controller/api.go
  • This also introduces circular dependencies and makes the logic complicated.

How about we keep this logic in the same pkg but into a different file, so that server.go is cleaner?

Copy link
Contributor

@kleimkuhler kleimkuhler left a comment

Choose a reason for hiding this comment

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

I'm okay with it is as is then. I don't think introducing a new file will necessarily make it easier to read or understand. It'd be nice if we had a way to track these functions that are based off having a k8sAPI—and making them methods does seem ideal—but if it brings in a lot of extra dependencies and all then I also don't think that's the right solution.

Signed-off-by: Tarun Pothulapati <[email protected]>
Signed-off-by: Tarun Pothulapati <[email protected]>
@Pothulapati Pothulapati merged commit fac28ff into main Apr 21, 2021
@Pothulapati Pothulapati deleted the tarun/dest-drop-get-ip branch April 21, 2021 07:10
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.

Drop support for IP queries in destination.Get

3 participants