From f187ec7e8abf1aaafb459e8a3f6f0cfb6fbaa58e Mon Sep 17 00:00:00 2001 From: zcq98 Date: Tue, 28 May 2024 14:07:13 +0800 Subject: [PATCH] fix: add ip_reserved label for vip Signed-off-by: zcq98 --- pkg/controller/vip.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/controller/vip.go b/pkg/controller/vip.go index cec712f483c..73d979bf7d7 100644 --- a/pkg/controller/vip.go +++ b/pkg/controller/vip.go @@ -520,6 +520,11 @@ func (c *Controller) createOrUpdateVipCR(key, ns, subnet, v4ip, v6ip, mac, pV4ip vip.Labels[util.SubnetNameLabel] = subnet needUpdateLabel = true } + if _, ok := vip.Labels[util.IPReservedLabel]; !ok { + op = "add" + vip.Labels[util.IPReservedLabel] = "" + needUpdateLabel = true + } if needUpdateLabel { patchPayloadTemplate := `[{ "op": "%s", "path": "/metadata/labels", "value": %s }]` raw, _ := json.Marshal(vip.Labels)