Skip to content

Support native sidecar by default#56428

Merged
istio-testing merged 22 commits intoistio:masterfrom
irenezhong2861:irenezhong/default-native-sidecar
Jul 7, 2025
Merged

Support native sidecar by default#56428
istio-testing merged 22 commits intoistio:masterfrom
irenezhong2861:irenezhong/default-native-sidecar

Conversation

@irenezhong2861
Copy link
Copy Markdown
Contributor

@irenezhong2861 irenezhong2861 commented May 27, 2025

Please provide a description of this PR:
Enables native sidecar by default

@irenezhong2861 irenezhong2861 requested review from a team as code owners May 27, 2025 17:46
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented May 27, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@istio-policy-bot
Copy link
Copy Markdown

😊 Welcome @irenezhong2861! 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 27, 2025
@istio-testing
Copy link
Copy Markdown
Collaborator

Hi @irenezhong2861. 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.

@jaellio
Copy link
Copy Markdown
Contributor

jaellio commented May 27, 2025

/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 27, 2025
@irenezhong2861 irenezhong2861 force-pushed the irenezhong/default-native-sidecar branch 2 times, most recently from 8d311f3 to 08c79ad Compare May 27, 2025 19:34
@irenezhong2861 irenezhong2861 requested a review from a team as a code owner May 27, 2025 19:34
@irenezhong2861 irenezhong2861 requested a review from a team May 27, 2025 19:34
@irenezhong2861 irenezhong2861 force-pushed the irenezhong/default-native-sidecar branch 2 times, most recently from aa7d148 to d39664b Compare May 27, 2025 19:45
{{ $nativeSidecar := (or (and (not (isset .ObjectMeta.Annotations `sidecar.istio.io/nativeSidecar`)) (eq (env "ENABLE_NATIVE_SIDECARS" "false") "true")) (eq (index .ObjectMeta.Annotations `sidecar.istio.io/nativeSidecar`) "true")) }}
{{ $nativeSidecar := .NativeSidecars }}
{{ if (isset .ObjectMeta.Annotations `sidecar.istio.io/nativeSidecar`) }}
{{ $nativeSidecar = eq (index .ObjectMeta.Annotations `sidecar.istio.io/nativeSidecar`) "true" }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this duplicated in the injection template logic?

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.

Cleaned up this line. The injection-template is ran here, with params.nativeSidecar being passed in and read in injection-template.yaml via .NativeSidecars. The is to generate the template pod. Later on, the same annotation logic is used to generate the merged pod. Both places need code to overwrite the param.nativeSidecar value with the annotation value.

Name: "node-1",
},
Status: corev1.NodeStatus{
NodeInfo: corev1.NodeSystemInfo{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we get more of a range of kubelet versions?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about old kubelet versions? We should probably test that they have classic sidecars right?

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.

added test case below with old version and added golden files. The new test case has one 1.33 node and one 1.28 node so native sidecar will be off without needing to set any flags.

}

var nodes kclient.Client[*corev1.Node]
if wh.nodes != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should probably log or something if this isn't initialized for some reason


minVersion := 29
allNodesValid := false
for _, n := range nodes.List(metav1.NamespaceAll, klabels.Everything()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens if someone adds an older node to their k8s cluster? Talk through the process in a code comment.

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.

add comment around how older nodes will switch the native sidecar value to false since this checks versions of all nodes.

Copy link
Copy Markdown
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

this needs to take into account Kubernetes version of wait until the minimum supported version is GA. this would be about 3 years so a long wait.

If you look through the issue you'll see I had a WIP PR to do so that we could leverage.

edit: I skimmed quickly on my phone and I think I missed some logic, so I may be wrong - will look closer soon. Sorry!

return false
}

minVersion := 29
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should do 1.33 imo. we cannot GA a beta feature

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 to this - I missed it in my initial pass. There is also a bug in older versions that doesn't really affect Istio, but still shouldn't expose users to it by default if we can help it IMO

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in my initial PR I had a way for a user to say "automatically detect, minimum beta" as an opt-in to 1.29. but for default should be 1.33 IMO

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if the pod has a node name assigned explicitly (very rare) we can also probably check only that node. maybe niche though

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.

Updated the version to 1.33, with a branch to check if only the corresponding node if pod.Spec.nodeName is not empty. Currently have a log.warn if the the node name is set but the node can't be found, and not enabling native sidecar in that case, open to suggestions!

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.

With this kubelet version check though, I don't think we need to wait until 1.33 is the min supported k8s version. It handles the case of nodes on ineligible versions by not defaulting native side cars for them. We might not need a check like this at all once 1.33 is the min version and just enable all by default.

Copy link
Copy Markdown
Contributor

@keithmattix keithmattix Jun 6, 2025

Choose a reason for hiding this comment

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

Yes, once we get past the supported 1.33 version skew, we could remove a lot of these checks, though folks who are running LTS in a cloud provider need to keep them around

Name: "node-1",
},
Status: corev1.NodeStatus{
NodeInfo: corev1.NodeSystemInfo{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about old kubelet versions? We should probably test that they have classic sidecars right?

@irenezhong2861 irenezhong2861 force-pushed the irenezhong/default-native-sidecar branch from b3cc938 to 74b4cce Compare June 5, 2025 00:41
@irenezhong2861
Copy link
Copy Markdown
Contributor Author

/test integ-ambient-mc

@irenezhong2861 irenezhong2861 force-pushed the irenezhong/default-native-sidecar branch from a383473 to 76daf96 Compare July 7, 2025 19:50
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Jul 7, 2025
Copy link
Copy Markdown
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

As a fast followup, can we make sure we turn this off in the compatbility profiles for the older versions?

@istio-testing istio-testing merged commit da90b35 into istio:master Jul 7, 2025
30 checks passed
@irenezhong2861
Copy link
Copy Markdown
Contributor Author

As a fast followup, can we make sure we turn this off in the compatbility profiles for the older versions?

opened #56903 to update compatibility profiles

@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 8, 2025
@keithmattix
Copy link
Copy Markdown
Contributor

/cherry-pick release-1.27

@istio-testing
Copy link
Copy Markdown
Collaborator

@keithmattix: new pull request created: #56918

Details

In response to this:

/cherry-pick 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:
  set VERSION on master to 1.28 (istio#56902)
  Automator: update ztunnel@master in istio/istio@master (istio#56900)
  Move Alpha Gateway API Inference Extension support to master (istio#56845)
  Support native sidecar by default (istio#56428)
  feat: represent revision tags using services (istio#56851)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. release-notes-none Indicates a PR that does not require release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants