A little fix to configure the podCIDR in the virtual kubelet config file
@@ -17,6 +17,7 @@ package advertisement_operator
import (
"context"
+ "strings"
"github.com/go-logr/logr"
@@ -70,7 +71,8 @@ func (r *AdvertisementReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
if adv.Status.AdvertisementStatus != "ACCEPTED" {
return ctrl.Result{}, errors.NewBadRequest("advertisement ignored")
}
-
+ token := strings.Split(adv.Spec.Network.PodCIDR, ".")
+ podCIDR := token[0] + "." + token[1] + "." + "0" + "." + "0/16"
// create configuration for virtual-kubelet with data from adv
vkConfig := v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
@@ -86,7 +88,7 @@ func (r *AdvertisementReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
"cpu": "` + adv.Spec.Availability.Cpu().String() + `",
"memory": "` + adv.Spec.Availability.Memory().String() + `",
"pods": "` + adv.Spec.Availability.Pods().String() + `",
- "remoteNewPodCidr": "` + "172.48.0.0/16" + `"
+ "remoteNewPodCidr": "` + podCIDR + `"
}
}`},
}
