From 3fbee687c991a52f6b054dab4deb0bd5e2e65980 Mon Sep 17 00:00:00 2001 From: Liwanshi Date: Mon, 30 Oct 2023 17:24:07 -0400 Subject: [PATCH 1/3] artms 515 change ipfamilypolicy IPv4/IPv6 dual-stack networking graduates to GA. Since 1.21, Kubernetes clusters are enabled to support dual-stack networking by default. In 1.23, the IPv6DualStack feature gate is removed. For Headless Service , If the service doesn't have any selectors defined then it is defaulted to RequireDualStack on any cluster (single- or dual-stack) https://github.com/kubernetes/kubernetes/blob/e6c093d87ea4cbb530a7b2ae91e54c0842d8308a/pkg/registry/core/service/storage/storage.go#L274 --- pkg/reconciliation/construct_service.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/reconciliation/construct_service.go b/pkg/reconciliation/construct_service.go index 3d15a963f..d4efac737 100644 --- a/pkg/reconciliation/construct_service.go +++ b/pkg/reconciliation/construct_service.go @@ -144,6 +144,9 @@ func newAdditionalSeedServiceForCassandraDatacenter(dc *api.CassandraDatacenter) service.Spec.Type = "ClusterIP" service.Spec.ClusterIP = "None" service.Spec.PublishNotReadyAddresses = true + // Adding ipFamilies and ipFamilyPolicy + service.Spec.IPfamilies = []corev1.IPFamily{"IPv4"} + service.Spec.IPFamilyPolicy = corev1.IPFamilyPolicySingleStack addAdditionalOptions(&service, &dc.Spec.AdditionalServiceConfig.AdditionalSeedService) From 4082c32dd5b063389ef8863cf2bb5dd28c70b599 Mon Sep 17 00:00:00 2001 From: Liwanshi Date: Thu, 2 Nov 2023 11:10:36 -0400 Subject: [PATCH 2/3] Update construct_service.go --- pkg/reconciliation/construct_service.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/reconciliation/construct_service.go b/pkg/reconciliation/construct_service.go index d4efac737..841de986a 100644 --- a/pkg/reconciliation/construct_service.go +++ b/pkg/reconciliation/construct_service.go @@ -123,6 +123,12 @@ func newSeedServiceForCassandraDatacenter(dc *api.CassandraDatacenter) *corev1.S service.Spec.Selector = buildLabelSelectorForSeedService(dc) service.Spec.PublishNotReadyAddresses = true + // Adding ipFamilies and ipFamilyPolicy + service.SpecIPFamilies = []corev1.IPFamily{corev1.IPv4Protocol} + // Create a variable of type corev1.IPFamilyPolicyType + ipFamilyPolicy := corev1.IPFamilyPolicySingleStack + // Set IPFamilyPolicy for localSeedSvc + service.Spec.IPFamilyPolicy = &ipFamilyPolicy addAdditionalOptions(service, &dc.Spec.AdditionalServiceConfig.SeedService) @@ -145,8 +151,11 @@ func newAdditionalSeedServiceForCassandraDatacenter(dc *api.CassandraDatacenter) service.Spec.ClusterIP = "None" service.Spec.PublishNotReadyAddresses = true // Adding ipFamilies and ipFamilyPolicy - service.Spec.IPfamilies = []corev1.IPFamily{"IPv4"} - service.Spec.IPFamilyPolicy = corev1.IPFamilyPolicySingleStack + service.SpecIPFamilies = []corev1.IPFamily{corev1.IPv4Protocol} + // Create a variable of type corev1.IPFamilyPolicyType + ipFamilyPolicy := corev1.IPFamilyPolicySingleStack + // Set IPFamilyPolicy for localSeedSvc + service.Spec.IPFamilyPolicy = &ipFamilyPolicy addAdditionalOptions(&service, &dc.Spec.AdditionalServiceConfig.AdditionalSeedService) From cca68303b5ce1539c09cf9196151a58b6972d91d Mon Sep 17 00:00:00 2001 From: Liwanshi Date: Thu, 2 Nov 2023 11:13:41 -0400 Subject: [PATCH 3/3] Update construct_service.go --- pkg/reconciliation/construct_service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/reconciliation/construct_service.go b/pkg/reconciliation/construct_service.go index 841de986a..ddf96d146 100644 --- a/pkg/reconciliation/construct_service.go +++ b/pkg/reconciliation/construct_service.go @@ -124,7 +124,7 @@ func newSeedServiceForCassandraDatacenter(dc *api.CassandraDatacenter) *corev1.S service.Spec.Selector = buildLabelSelectorForSeedService(dc) service.Spec.PublishNotReadyAddresses = true // Adding ipFamilies and ipFamilyPolicy - service.SpecIPFamilies = []corev1.IPFamily{corev1.IPv4Protocol} + service.Spec.IPFamilies = []corev1.IPFamily{corev1.IPv4Protocol} // Create a variable of type corev1.IPFamilyPolicyType ipFamilyPolicy := corev1.IPFamilyPolicySingleStack // Set IPFamilyPolicy for localSeedSvc @@ -151,7 +151,7 @@ func newAdditionalSeedServiceForCassandraDatacenter(dc *api.CassandraDatacenter) service.Spec.ClusterIP = "None" service.Spec.PublishNotReadyAddresses = true // Adding ipFamilies and ipFamilyPolicy - service.SpecIPFamilies = []corev1.IPFamily{corev1.IPv4Protocol} + service.Spec.IPFamilies = []corev1.IPFamily{corev1.IPv4Protocol} // Create a variable of type corev1.IPFamilyPolicyType ipFamilyPolicy := corev1.IPFamilyPolicySingleStack // Set IPFamilyPolicy for localSeedSvc