fix(k8s): preserve service network fields on redeploy - #4013
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Elvand-Lie The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Elvand-Lie. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
The raw deployer reconstructs a Service during redeployment and previously copied only ResourceVersion from the existing Service. This omitted the Service's allocated ClusterIP configuration, causing Kubernetes to reject the update with an immutable clusterIP error. Preserve ClusterIP, ClusterIPs, IPFamilies, and IPFamilyPolicy from the existing Service while continuing to generate mutable Service fields from the function configuration. The KEDA deployer inherits the fix through its embedded raw deployer.
aefc46d to
1aec7b1
Compare
Changes
The raw Kubernetes deployer reconstructs a
corev1.Servicewhen redeploying a function. On updates, it previously preserved only the existing Service'sResourceVersion.Because the generated Service does not contain the network configuration allocated by Kubernetes, redeploying an existing function could submit an empty
spec.clusterIPand fail with:This change preserves the existing Service's
ClusterIP,ClusterIPs,IPFamilies, andIPFamilyPolicybefore callingUpdate, while continuing to generate mutable fields such as ports, selectors, labels, and annotations from the function configuration.New Service creation is unchanged, so Kubernetes continues to allocate and default its network fields.
The KEDA deployer inherits the fix because it delegates workload deployment to the raw Kubernetes deployer.
Regression tests cover IPv4 single-stack, IPv6 single-stack, dual-stack, preservation of generated mutable fields, and the initial Service creation path.
Testing
make test), linting and repository checks (make check), and test coverage for single-stack IPv4/IPv6 and dual-stack Service network field preservation.func deploy --deployer=rawverified against a Kubernetes cluster, confirming existing Service ClusterIP and network configuration are preserved across updates./kind bug
Release Note
Docs