From 10b9279312473d96bcf2082d108660940101e1a3 Mon Sep 17 00:00:00 2001 From: Ziang Guo Date: Mon, 25 Mar 2024 18:30:01 +0800 Subject: [PATCH] fix: service.spec.ipFamilies field incorrectly overwritten (#6876) --- controllers/apps/transformer_cluster_service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/apps/transformer_cluster_service.go b/controllers/apps/transformer_cluster_service.go index d05be880482..13e0078c82b 100644 --- a/controllers/apps/transformer_cluster_service.go +++ b/controllers/apps/transformer_cluster_service.go @@ -349,7 +349,7 @@ func resolveServiceDefaultFields(obj, objCopy *corev1.ServiceSpec) { if len(objCopy.SessionAffinity) == 0 { objCopy.SessionAffinity = obj.SessionAffinity } - if len(objCopy.IPFamilies) == 0 { + if len(objCopy.IPFamilies) == 0 || (len(objCopy.IPFamilies) == 1 && *objCopy.IPFamilyPolicy != corev1.IPFamilyPolicySingleStack) { objCopy.IPFamilies = obj.IPFamilies } if objCopy.IPFamilyPolicy == nil {