Skip to content

add env vars for ip auto allocate ipv4/v6 cidr prefixes#56276

Merged
istio-testing merged 8 commits intoistio:masterfrom
slickwilli:master
Jul 10, 2025
Merged

add env vars for ip auto allocate ipv4/v6 cidr prefixes#56276
istio-testing merged 8 commits intoistio:masterfrom
slickwilli:master

Conversation

@slickwilli
Copy link
Copy Markdown
Contributor

@slickwilli slickwilli commented May 13, 2025

Please provide a description of this PR:
Adds the ability to specify the IPv4/v6 CIDRs for use by the IP auto allocator controller. We have found in testing istio/ambient with Windows/kubevirt the default 240.240.0.0/16 range for VIPs does not work with Windows (I think this is an issue with the Windows networking stack?).

Changing the defined IPv4 range to something like 10.213.64.0/18 and deploying that pilot container (built off of 1.25.2) to our cluster fixed the issue and allowed traffic to properly flow through egress proxy.

  • Adds PILOT_IP_AUTOALLOCATE_IPV4_PREFIX (default: 240.240.0.0/16) and PILOT_IP_AUTOALLOCATE_IPV6_PREFIX (default: 2001:2::/48) Pilot env vars

This change keeps the default behavior of the ip autoallocator controller while also allowing end users to change the CIDR prefix(es) for whatever reason.

To help us figure out who should review this PR, please put an X in all the areas that this PR affects.

  • Ambient
  • Networking

@istio-testing istio-testing added the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label May 13, 2025
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented May 13, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@istio-policy-bot istio-policy-bot added area/ambient Issues related to ambient mesh area/networking labels May 13, 2025
@istio-policy-bot
Copy link
Copy Markdown

😊 Welcome @slickwilli! This is either your first contribution to the Istio istio repo, or it's been
a while since you've been here.

You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines
by referring to Contributing to Istio.

Thanks for contributing!

Courtesy of your friendly welcome wagon.

@istio-testing istio-testing added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 13, 2025
@istio-testing
Copy link
Copy Markdown
Collaborator

Hi @slickwilli. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@Stevenjin8
Copy link
Copy Markdown
Contributor

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels May 13, 2025
@istio-testing istio-testing added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 13, 2025
Comment on lines +123 to +124
v4allocator: newPrefixUse(netip.MustParsePrefix(features.IPAutoallocateIPv4Prefix)),
v6allocator: newPrefixUse(netip.MustParsePrefix(features.IPAutoallocateIPv6Prefix)),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let me know if you want me to change these, I added validation in initControllers so it should be okay to still use this. However, I could also refactor the initialization of the ipallocate controller to take the parsed netip.Prefix and remove MustParsePrefix.

@istio-testing istio-testing added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 20, 2025
@slickwilli slickwilli marked this pull request as ready for review May 20, 2025 14:19
@slickwilli slickwilli requested a review from a team as a code owner May 20, 2025 14:19
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label May 20, 2025
@slickwilli
Copy link
Copy Markdown
Contributor Author

Any input on this would be great, currently this is causing us issues with running Windows server on ambient, thanks

@ilrudie
Copy link
Copy Markdown
Contributor

ilrudie commented Jun 4, 2025

Hi @slickwilli,
My apologies, I started thinking about this but got sidetracked onto a bunch of other things.

Rather than arbitrarily configurable ranges, which opens up possibilities for misconfiguration, could we instead offer an alternative range option which we've chosen ahead of time? That way we know it will parse and is reasonable in size. The user just flips alt range to "true" if they are on a platform that requires it.

@slickwilli
Copy link
Copy Markdown
Contributor Author

slickwilli commented Jun 4, 2025

@ilrudie No worries. Thanks for taking a look!

While I’m in favor of preventing misconfiguration, I’m hesitant to enforce predefined alternative range(s), as end-users may have specific reasons for choosing certain range(s). Would additional validation on the supplied range(s) be sufficient? For example, we could enforce minimum usable space requirements or validate against other relevant criteria.

Additionally, appending OVERRIDE to the environment variable names might help clarify their intended use.

That being said, I think 100.64.0.0/10 would be an effective alternative range.

@ilrudie
Copy link
Copy Markdown
Contributor

ilrudie commented Jun 5, 2025

yeah, there's definitely some options. I'll try to capture my view of the tradeoffs here:

  • full yolo, users configure what they think is good and we do our best with that (mostly how it sits now)

    • If they supply a range thats invalid: I think istiod won't come up (maybe not what we want, maybe right?)
    • If they supply a range that's in conflict: probably undefined behavior today (we could do better by making sure kube addresses are always preferred over SE addresses but hypothetically at least a user might accidentally overlap their pod range and this might weird/awkward to figure out)
    • If they supply a range that is too small: we start up but they run into IP exhaustion later. This could be partially mitigated by better ip garbage collection (presently I think we only garbage collect when the controller initializes and records the currently assigned addresses).
  • full walled garden, we provide a toggle for alt range and the user chooses one of our ranges

    • Possible both ranges are not suitable for some user out there?
    • (anything else?)
    • What should we do when there are addresses from the default range assigned but the alt-range is toggled on? Re-assign those? Nothing, user can clean status if they want?
  • middle ground with more validation

    • Now we have other error/warn states which need to do something. we need to decide what that something should be (prevent starting istiod, warn, prevent starting auto-allocation but allow istiod to start, something I didn't think of)

@slickwilli
Copy link
Copy Markdown
Contributor Author

I imagine these ranges won't be touched by 99.99% of Istio users, and those who are looking to use them are probably pretty advanced users. For example, we only ran into this issue while running Windows VMs via KubeVirt and hit a limitation in the Windows networking stack with the default range (definitely not a common use case, lol).

I’m aligned on guarding against the sharper edge cases:

  • We should probably document what happens if someone switches the range mid-flight. We hit that ourselves and just deleted/recreated the offending SEs, but it could trip people up.
  • If the override range is invalid or too narrow (or whatever else, like common overlaps), maybe we log a warning and fall back to the default rather than failing Istiod outright? That feels like a safer middle ground and better UX?

That said, this is my first Istio PR, so happy to defer to whatever direction you all feel is most appropriate.

@ilrudie
Copy link
Copy Markdown
Contributor

ilrudie commented Jun 18, 2025

Hi @slickwilli, I brought this up in the combined WG call today to help unblock. The consensus among the folks who joined in on the discussion is:

  • We like having ranges being built in to Istio instead of allowing arbitrary user values
  • We want a flexible API for future proofing

To that end, the proposal would be to define the current ranges as default and a second set of ranges which we would call something like alt1. We will need to document what these ranges are.

We can then have an env var which specifies a csv list of ranges to use. If the list is empty, unspecified, invalid, anything else which renders it unusable: we just use the default ranges so we never fail to start the controller due to bad user input. If the list can be parsed we will use the first valid entry from the list as our range (in the future we might want to allow combining ranges so a csv list is a useful bit of future proofing).

@jbilliau-rcd
Copy link
Copy Markdown

@ilrudie what if the second set of ranges that is deemed as "alternate" doesn't fit a user's use case? what then? We back to this original PR....how can you possibly define an alternate CIDR to use that will fit every single person's use case?

This is a HIGHLY advanced feature....anybody using this will likely know what they are doing and are accepting the risk in doing so. By limiting this to a CIDR(s) determined by whatever group of folks, all you are doing is kicking the bucket down the road until those ranges don't work for the next user.

My 2 cents.

@ilrudie
Copy link
Copy Markdown
Contributor

ilrudie commented Jun 18, 2025

Hi @jbilliau-rcd,

We did consider the possibility that both the default and alt1 ranges might be unsuitable for some unlucky folks (hence the name alt1, allowing for alt2...N in the future if need arises). We thought it to be sufficiently unlikely that this was a step forward which is likely to solve for most uses.

Using a list (as opposed to a binary "enable alt range") does allow the flexibility to enable free-form CIDR in the same API as well if we see a need for having that, so it's not ruled out so much as not the first step.

@cpfarhood
Copy link
Copy Markdown

It's not feasible to predict why an end user might want to change this subnet or what specific configuration they intend to use, Istio shouldn't need to account for that. Validating a proper subnet is straightforward compared to the complexity introduced by the proposed logic. The suggested approach introduces unnecessary ambiguity, making it unclear which subnet will be used under varying conditions. This complexity not only risks confusion for the user but may also fail to solve the underlying issue given the unpredictable nature of the inputs involved, especially now that kubevirt opened the door to Istio in front of virtually every operating system in existence. If 99% of users will never change this, why would the desired state for those 1% of users not be the goal if it's less arduous to implement in addition?

@howardjohn
Copy link
Copy Markdown
Member

howardjohn commented Jun 18, 2025 via email

@jbilliau-rcd
Copy link
Copy Markdown

There hasn't been any movement on this PR in a while and we need this functionality to move forward with a kubevirt/Istio project, otherwise we are hosed. @ilrudie where do we stand currently? How can we get this moving forward?

@ilrudie
Copy link
Copy Markdown
Contributor

ilrudie commented Jul 10, 2025

It's unclear if @slickwilli is still looking to work on this. If they don't have time anymore I suppose someone else would need to take over.

TBD:

  • if we're going to choose an alternate range to try to avoid input mistakes, what range?
  • if we're going to allow arbitrary range(s), what validation do we do and what to we do when the input isn't usable?
    • based on the discussion in WG, it seems a sensible choice might be
      • zero validation
      • when given input we can't parse, log it and start with the defaults
  • how to communicate that this is an experimental/advanced setting and you shouldn't use it in nearly any Istio installation?

@jbilliau-rcd
Copy link
Copy Markdown

He's still working on it (he's a co-worker of mine), just hasn't done anything further since, while we've gone back and forth on certain points regarding this, no specific decisions have been made so there isn't any further work for him to do (yet).

To respond to your points:

if we're going to choose an alternate range to try to avoid input mistakes, what range?

Well, that's kind of our point; what alternate range would we pick? and what if it doesn't work for someone else for any other reason? are we just going to keep adding endless alternate ranges? Seems the better fit is to make this an advanced, experimental setting, and let the users use what they want. 99.9% of users won't likely touch this anyway, so trying to add in guardrails isn't worth it imo.

if we're going to allow arbitrary range(s), what validation do we do and what to we do when the input isn't usable?
based on the discussion in WG, it seems a sensible choice might be
zero validation
when given input we can't parse, log it and start with the defaults

Either/or....if the latter, sure, take whatever has been given, and if it can't parse, log error, default to defaults, and move on.

how to communicate that this is an experimental/advanced setting and you shouldn't use it in nearly any Istio installation?

Same way I assume any other experimental/alpha features are communicated. Examples are here and here

So if you agree, let's move forward. If not, we just need to know what changes to make to get this PR approved and pushed through. Appreciate your time on this!

@slickwilli
Copy link
Copy Markdown
Contributor Author

Yep, sorry I just wasn't sure what the status of this discussion was.. A quick parse of the provided ranges and falling back to the defaults is simple enough and provides the most flexibility

@howardjohn
Copy link
Copy Markdown
Member

/test integ-ambient-dual

@istio-testing istio-testing merged commit 8fde463 into istio:master Jul 10, 2025
31 checks passed
@keithmattix
Copy link
Copy Markdown
Contributor

If we're all good with arbitrary ranges (/cc @louiscryan if he's around), then we'll need to make sure we manually cherry-pick this to the 1.27 branch

@jbilliau-rcd
Copy link
Copy Markdown

Awesome, thanks for pushing this forward guys!

@keithmattix keithmattix added the cherrypick/release-1.27 Set this label on a PR to auto-merge it to the release-1.27 branch label Jul 28, 2025
@keithmattix
Copy link
Copy Markdown
Contributor

@zirain @grnmeira @kfaseela Looks like this merged before feature freeze date but we missed a cherry0pick

@zirain
Copy link
Copy Markdown
Member

zirain commented Jul 29, 2025

/cherrypick release-1.27

@zirain
Copy link
Copy Markdown
Member

zirain commented Jul 29, 2025

it will be part of beta.1

@istio-testing
Copy link
Copy Markdown
Collaborator

@zirain: new pull request created: #57189

Details

In response to this:

/cherrypick release-1.27

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

fjglira pushed a commit to fjglira/istio that referenced this pull request Sep 26, 2025
* upstream/master: (21 commits)
  feat: skip queue for status updates on gw (istio#56962)
  Automator: update proxy@master in istio/istio@master (istio#56993)
  Automator: update proxy@master in istio/istio@master (istio#56990)
  Change host iptables rule addition from Append to Insert to ensure Istio's rules take precedence (istio#56414)
  support specifying proxy admin port for describe (istio#56854)
  support reset log level or stack trace level separately for admin log (istio#56642)
  improve example format for istioctl x describe (istio#56951)
  Automator: update ztunnel@master in istio/istio@master (istio#56971)
  Remove flaky test (istio#56919)
  fix: fixes test which fails for distroless (istio#56965)
  Automator: update proxy@master in istio/istio@master (istio#56969)
  Ambient Multicluster SplitHorizon WDS Implementation (istio#56844)
  Fix log message in cni install.go file (istio#56966)
  add env vars for ip auto allocate ipv4/v6 cidr prefixes (istio#56276)
  Update BASE_VERSION to master-2025-07-10T19-01-16 (istio#56967)
  Add AllowCRDsMismatch parameter to gateway conformance options. (istio#56945)
  Revert "feat: represent revision tags using services (istio#56851)" (istio#56941)
  Automator: update proxy@master in istio/istio@master (istio#56954)
  Automator: update istio/client-go@master dependency in istio/istio@master (istio#56911)
  Automator: update common-files@master in istio/istio@master (istio#56952)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ambient Issues related to ambient mesh area/networking cherrypick/release-1.27 Set this label on a PR to auto-merge it to the release-1.27 branch ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. 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.

10 participants