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 ClusterIP in upstreams in VirtualServers/VirtualServerRoutes #1449

Merged
merged 5 commits into from
Mar 12, 2021

Conversation

lucacome
Copy link
Member

@lucacome lucacome commented Mar 11, 2021

Add support for ClusterIP in upstreams

TODO:

  • docs

@lucacome lucacome requested a review from pleshakov March 11, 2021 20:13
@lucacome lucacome self-assigned this Mar 11, 2021
@github-actions github-actions bot added the enhancement Pull requests for new features/feature enhancements label Mar 11, 2021
@github-actions github-actions bot added the documentation Pull requests/issues for documentation label Mar 11, 2021
@lucacome lucacome linked an issue Mar 11, 2021 that may be closed by this pull request
@lucacome lucacome marked this pull request as ready for review March 11, 2021 22:19
@lucacome lucacome requested a review from soneillf5 March 11, 2021 22:19
Copy link
Contributor

@pleshakov pleshakov left a comment

Choose a reason for hiding this comment

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

Hi @lucacome

Please see my feedback

There is one more issue - when the new field is enabled, since the IC no longer uses endpoints, but rather uses the service ClusterIP, there is no need to update and reload NGINX config (or update API for Plus) for the affected VirtualServers/VirtualServerRoutes, when the endpoints related to the service are updated.
I think we can easily prevent it if we update FindResourcesForEndpoints in Configuration to use a different referenceChecker - the one that could take into consideration the upstream use-cluster-ip field. What do you think?

internal/k8s/controller.go Outdated Show resolved Hide resolved
internal/k8s/controller.go Outdated Show resolved Hide resolved
internal/k8s/controller.go Outdated Show resolved Hide resolved
var podEndps []podEndpoint
var err error
var endps []string
if u.UseClusterIP {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to refactor the getting endpoints logic into a function so that we can use it both for VS and VSR (prob after this PR) - the code looks identical

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I thought about that but decided to leave it for later 👍

@lucacome lucacome enabled auto-merge (squash) March 12, 2021 00:58
@@ -1044,3 +1044,129 @@ func TestIsPolicyIsReferenced(t *testing.T) {
}
}
}

func TestEndpointIsReferencedByVirtualServerAndVirtualServerRoutes(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

great tests!

@lucacome lucacome merged commit 252b41b into master Mar 12, 2021
@lucacome lucacome deleted the feat/upstream-cluster-ip branch March 12, 2021 16:18
@pleshakov pleshakov changed the title Add support for ClusterIP in upstreams Add support for ClusterIP in upstreams in VirtualServers/VirtualServerRoutes Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests/issues for documentation enhancement Pull requests for new features/feature enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can VirtualServers use Services as upstream instead of endpoints?
3 participants