Skip to content

Commit 69861de

Browse files
authored
Merge pull request #272 from hhyasdf/cherry-pick/manager-should-not-work-with-old-crds
[CHERRY PICK] make manager unable to work with old crds
2 parents 66b37be + 83b262d commit 69861de

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

cmd/manager/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func main() {
125125
os.Exit(1)
126126
}
127127

128-
// init IPAM manager and stort
128+
// init IPAM manager and start
129129
ipamManager, err := networking.NewIPAMManager(globalContext, mgr.GetClient())
130130
if err != nil {
131131
entryLog.Error(err, "unable to create IPAM manager")

pkg/apis/networking/v1/conversion.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func CanonicalizeIPInstance(c client.Client) (err error) {
6868
var patchFuncs []func() error
6969
for i := range ipInstanceList.Items {
7070
var ipInstance = &ipInstanceList.Items[i]
71-
if parseIPInstanceVersion(ipInstance) == IPInstanceLatestVersion {
71+
if parseIPInstanceVersion(ipInstance) == IPInstanceLatestVersion && !IsLegacyModel(ipInstance) {
7272
continue
7373
}
7474

pkg/controllers/networking/pod_ip_cache.go

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ func NewPodIPCache(ctx context.Context, c client.Reader, logger logr.Logger) (Po
6767
}
6868

6969
for _, ip := range ipList.Items {
70+
if networkingv1.IsLegacyModel(&ip) {
71+
return nil, fmt.Errorf("get legacy model ip instance, if this happens more than once, " +
72+
"please check if the networking CRD yamls is updated to the latest v0.5 version")
73+
}
74+
7075
podName := networkingv1.FetchBindingPodName(&ip)
7176
if len(podName) != 0 {
7277
var podUID types.UID

0 commit comments

Comments
 (0)