This repository was archived by the owner on Mar 16, 2024. It is now read-only.
NetworkPolicies: Handle case where an Ingress routes to an ExternalName Service (#456) #1408
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
re: #456
Using a router and links, it is possible to expose a port in a service in a different namespace than the namespace in which the corresponding Ingress lives. Here is an example:
Run the above Acornfile:
acorn run --name two .Run the above Acornfile and link it to the container from the previous one:
acorn run --name one --link two:two .This will create an Ingress in
one's namespace that routes to an ExternalName Service, which then resolves to a ClusterIP service intwo's namespace. I wasn't accounting for this scenario before, so these changes deal with that.Unfortunately I also had to add a finalizer in here. Since we sometimes create NetworkPolicies in namespaces outside where the owning Ingress lives, if the app that created the Ingress is removed (in this example,
acorn rm one), the namespace for the app might delete too quickly, and the NetworkPolicy in the other namespace (two's namespace in this example) will get left behind. The finalizer ensures that the NetworkPolicy gets cleaned up properly.Checklist
This is a title (#1216). Here's an example