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

ambient: introduce a new "ingress mode" #53476

Merged
merged 4 commits into from
Oct 15, 2024

Conversation

howardjohn
Copy link
Member

The intent here is to better facilitate running an ingress workload in
the mesh. The ideal flow is internet client --> ingress pod --> ztunnel --> <mesh destination>.

Today, we have client --> ztunnel --> ingress --> ztunnel; this should
work, but its not really necessary.

This is done by utilizing an existing annotation,
traffic.sidecar.istio.io/excludeInboundPorts: "*".
This is the ONLY value supported here; we do not (and IMO should not)
support more customization. I used the same annotation, rather than a
new one, since its a fairly common config to have on ingress today, so
this may make adoption easier.

@howardjohn howardjohn added the release-notes-none Indicates a PR that does not require release notes. label Oct 8, 2024
@istio-testing
Copy link
Collaborator

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@istio-testing istio-testing added do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 8, 2024
}
}
}
// Also look for chains we jump to, even if we have no rules in them
Copy link
Member Author

Choose a reason for hiding this comment

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

@bleggett @leosarra this is maybe dumb but seemed like the best option. WDYT?

I was worried about removing the -J ISTIO_PRERT since we could easily introduce bugs here if we add some rules to the chain (as a dev, I would probably not think to make sure the jump rule was added!), and I was worried our cleanup logic would not handle it well

Copy link
Contributor

@bleggett bleggett Oct 8, 2024

Choose a reason for hiding this comment

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

I was worried about removing the -J ISTIO_PRERT since we could easily introduce bugs here if we add some rules to the chain

Might be worth splitting rule creation into ingress/egress and categorically skipping the former in this scenario.

If we are actually not hooking ingress at all, we will never have rules in PREROUTING anyway/it should be a bug if we do.

Copy link
Member Author

Choose a reason for hiding this comment

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

My concern was we maybe would... we do for DNS for example. Not in nat, though, so maybe moot

Copy link
Contributor

@bleggett bleggett Oct 8, 2024

Choose a reason for hiding this comment

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

Ah, I missed DNS is doing that. That's annoying.

I still think we should be fine if we just decompose this func better: inbound/outbound/DNS and that will go a ways towards de-footgunning.

I was worried about removing the -J ISTIO_PRERT since we could easily introduce bugs here if we add some rules to the chain (as a dev, I would probably not think to make sure the jump rule was added!),

Our logic should probably be smart enough to dynamically not-create the jump if the jump dest is empty, but I'm fine leaving it in place for now, jumps to empty chains are strictly harmless.

cni/pkg/nodeagent/net.go Outdated Show resolved Hide resolved
@@ -214,8 +214,13 @@ func (cfg *IptablesConfigurator) CreateInpodRules(log *istiolog.Scope, hostProbe
return nil
}

func (cfg *IptablesConfigurator) appendInpodRules(hostProbeSNAT, hostProbeV6SNAT netip.Addr) *builder.IptablesRuleBuilder {
func (cfg *IptablesConfigurator) appendInpodRules(hostProbeSNAT, hostProbeV6SNAT netip.Addr, ingressMode bool) *builder.IptablesRuleBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be more reasonable at this point to split this into appendInpodInbound/OutboundRules

}
}
}
// Also look for chains we jump to, even if we have no rules in them
Copy link
Contributor

@bleggett bleggett Oct 8, 2024

Choose a reason for hiding this comment

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

I was worried about removing the -J ISTIO_PRERT since we could easily introduce bugs here if we add some rules to the chain

Might be worth splitting rule creation into ingress/egress and categorically skipping the former in this scenario.

If we are actually not hooking ingress at all, we will never have rules in PREROUTING anyway/it should be a bug if we do.

@howardjohn howardjohn force-pushed the ambient/ingress-mode branch from 056229f to 5e01a4e Compare October 9, 2024 21:00
@howardjohn howardjohn marked this pull request as ready for review October 9, 2024 21:00
@howardjohn howardjohn requested a review from a team as a code owner October 9, 2024 21:00
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Oct 9, 2024
Copy link
Contributor

@bleggett bleggett left a comment

Choose a reason for hiding this comment

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

Actually, if this is user intent (and net-new) it should be a label, and not an annotation.

@howardjohn howardjohn force-pushed the ambient/ingress-mode branch from a2fcbf7 to c50e3c4 Compare October 10, 2024 18:11
The intent here is to better facilitate running an ingress workload in
the mesh. The ideal flow is `internet client --> ingress pod --> ztunnel
--> <mesh destination>`.

Today, we have `client --> ztunnel --> ingress --> ztunnel`; this should
work, but its not really necessary.

This is done by utilizing an existing annotation,
`traffic.sidecar.istio.io/excludeInboundPorts: "*"`.
This is the ONLY value supported here; we do not (and IMO should not)
support more customization. I used the same annotation, rather than a
new one, since its a fairly common config to have on ingress today, so
this may make adoption easier.
@howardjohn howardjohn force-pushed the ambient/ingress-mode branch from c50e3c4 to 6b4755e Compare October 15, 2024 15:09
@howardjohn
Copy link
Member Author

/retest

@istio-testing istio-testing merged commit ed37def into istio:master Oct 15, 2024
27 checks passed
howardjohn added a commit to howardjohn/api that referenced this pull request Oct 16, 2024
howardjohn added a commit to howardjohn/api that referenced this pull request Oct 18, 2024
istio-testing pushed a commit to istio/api that referenced this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes-none Indicates a PR that does not require release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants