Skip to content

Commit

Permalink
Merge pull request spidernet-io#3168 from ty-dc/k8s-fix
Browse files Browse the repository at this point in the history
enable coordinate to support serviceCIDR according to a matched k8s version.
  • Loading branch information
weizhoublue authored Feb 3, 2024
2 parents 79093be + d4e2fe8 commit acceb8e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pkg/coordinatormanager/coordinator_informer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/spidernet-io/spiderpool/pkg/utils"
stringutil "github.com/spidernet-io/spiderpool/pkg/utils/string"
networkingv1 "k8s.io/api/networking/v1alpha1"
"k8s.io/apimachinery/pkg/api/meta"

"github.com/cilium/cilium/pkg/ipam/option"
clientset "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned"
Expand Down Expand Up @@ -554,7 +553,7 @@ func (cc *CoordinatorController) fetchServiceCIDR(ctx context.Context, logger *z

var serviceCIDR networkingv1.ServiceCIDRList
err := cc.APIReader.List(ctx, &serviceCIDR)
if err != nil && meta.IsNoMatchError(err) {
if err != nil {
event.EventRecorder.Eventf(
coordCopy,
corev1.EventTypeWarning,
Expand Down
10 changes: 9 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,15 @@ setup_kind:
else \
sed -i ''"$${INSERT_LINE}"' a \ podSubnet: "$(CLUSTER_POD_SUBNET_V4),$(CLUSTER_POD_SUBNET_V6)"' $${NEW_KIND_YAML} ; \
sed -i ''"$${INSERT_LINE}"' a \ serviceSubnet: "$(K8S_IPV4_SERVICE_CIDR),$(K8S_IPV6_SERVICE_CIDR)"' $${NEW_KIND_YAML} ; \
fi
fi ; \
MultiCIDRServiceGateVersion="v1.29.0" ; \
if [ $$(echo -e "$(E2E_KIND_IMAGE_TAG)\n$${MultiCIDRServiceGateVersion}" | sort -V | tail -n1) == "$(E2E_KIND_IMAGE_TAG)" ]; then \
echo "the following features are only fully supported in versions higher than $${MultiCIDRServiceGateVersion}." ; \
sed -i '$$ a\featureGates: ' $${NEW_KIND_YAML} ; \
sed -i '$$ a\ MultiCIDRServiceAllocator: true' $${NEW_KIND_YAML} ; \
sed -i '$$ a\runtimeConfig: ' $${NEW_KIND_YAML} ; \
sed -i '$$ a\ api/alpha: "true"' $${NEW_KIND_YAML} ; \
fi
$(QUIET) cat $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME)/kind-config.yaml
KIND_OPTION="" ; \
[ -n "$(E2E_KIND_IMAGE_TAG)" ] && KIND_OPTION=" --image $(E2E_KIND_IMAGE_NAME):$(E2E_KIND_IMAGE_TAG) " && echo "setup kind with $(E2E_KIND_IMAGE_NAME):$(E2E_KIND_IMAGE_TAG)"; \
Expand Down
3 changes: 2 additions & 1 deletion test/scripts/install-default-cni.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ function install_cilium() {
--set tunnel=disabled \
--set ipv6NativeRoutingCIDR=${CILIUM_CLUSTER_POD_SUBNET_V6} \
--set autoDirectNodeRoutes=true \
--set enableIPv6Masquerade=true "
--set enableIPv6Masquerade=true \
--set routingMode=native "
;;
dual)
CILIUM_HELM_OPTIONS+=" --set ipam.operator.clusterPoolIPv4PodCIDRList=${CILIUM_CLUSTER_POD_SUBNET_V4} \
Expand Down
4 changes: 0 additions & 4 deletions test/yamls/global-kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ kubeadmConfigPatches:
nodes:
- role: control-plane
- role: worker
featureGates:
"MultiCIDRServiceAllocator": true
runtimeConfig:
"api/alpha": "true"

0 comments on commit acceb8e

Please sign in to comment.