Skip to content

Fallback to clusterip to determine the service ipfamily - #1238

Merged
fedepaol merged 1 commit into
metallb:mainfrom
fedepaol:fixsinglestack
Mar 3, 2022
Merged

fedepaol merged 1 commit into
metallb:mainfrom
fedepaol:fixsinglestack

Conversation

@fedepaol

Copy link
Copy Markdown
Member

K8s versions prior to 1.20 do not have ClusterIPs set, so we fallback to clusterip (singular) to determine the ip family.

Tested locally with
inv dev-env --node-img=kindest/node:v1.19.11@sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729 as the CI lanes are running against 1.21.

@fedepaol

Copy link
Copy Markdown
Member Author

Fixes #1231

@rata rata left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot @fedepaol

I haven't tested this, but what you did seems enough :)

@msherif1234

Copy link
Copy Markdown
Contributor

I feel if we are in this mode we should fail any attempt to provision svc with dual stack ?

@fedepaol

Copy link
Copy Markdown
Member Author

I feel if we are in this mode we should fail any attempt to provision svc with dual stack ?

That will come for free as in 1.19 there's no dual stack fields, which is exactly the reason why we need to fallback to ClusterIP

@msherif1234

Copy link
Copy Markdown
Contributor

I feel if we are in this mode we should fail any attempt to provision svc with dual stack ?

That will come for free as in 1.19 there's no dual stack fields, which is exactly the reason why we need to fallback to ClusterIP

we have annotations that someone mistakenly can use with older k8s right ?

@fedepaol

Copy link
Copy Markdown
Member Author

I feel if we are in this mode we should fail any attempt to provision svc with dual stack ?

That will come for free as in 1.19 there's no dual stack fields, which is exactly the reason why we need to fallback to ClusterIP

we have annotations that someone mistakenly can use with older k8s right ?

Yes, and that would fail because the ip families would not match

@msherif1234

Copy link
Copy Markdown
Contributor

I feel if we are in this mode we should fail any attempt to provision svc with dual stack ?

That will come for free as in 1.19 there's no dual stack fields, which is exactly the reason why we need to fallback to ClusterIP

we have annotations that someone mistakenly can use with older k8s right ?

Yes, and that would fail because the ip families would not match

maybe worth adding testcase to make sure this should fail if it not already there

@fedepaol

Copy link
Copy Markdown
Member Author

I feel if we are in this mode we should fail any attempt to provision svc with dual stack ?

That will come for free as in 1.19 there's no dual stack fields, which is exactly the reason why we need to fallback to ClusterIP

we have annotations that someone mistakenly can use with older k8s right ?

Yes, and that would fail because the ip families would not match

maybe worth adding testcase to make sure this should fail if it not already there

We don't have 1.19 in our CI lanes (and I don't think it's worth adding a lane for a k8s version that is not supported)

@msherif1234

Copy link
Copy Markdown
Contributor

I feel if we are in this mode we should fail any attempt to provision svc with dual stack ?

That will come for free as in 1.19 there's no dual stack fields, which is exactly the reason why we need to fallback to ClusterIP

we have annotations that someone mistakenly can use with older k8s right ?

Yes, and that would fail because the ip families would not match

maybe worth adding testcase to make sure this should fail if it not already there

We don't have 1.19 in our CI lanes (and I don't think it's worth adding a lane for a k8s version that is not supported)

I was asking about unit-test test case

@fedepaol

Copy link
Copy Markdown
Member Author

I feel if we are in this mode we should fail any attempt to provision svc with dual stack ?

That will come for free as in 1.19 there's no dual stack fields, which is exactly the reason why we need to fallback to ClusterIP

we have annotations that someone mistakenly can use with older k8s right ?

Yes, and that would fail because the ip families would not match

maybe worth adding testcase to make sure this should fail if it not already there

We don't have 1.19 in our CI lanes (and I don't think it's worth adding a lane for a k8s version that is not supported)

I was asking about unit-test test case

Ah then yes, I can add it, and makes sense, you are right.

Comment thread controller/service.go Outdated
})
return reflect.DeepEqual(ipsA, ipsB)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we have this function in ipfamily package ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I put this here was that the ipfamily package is (was) about ips and families and independent from k8s concepts, so it's a bit borderline and felt more like a local util function.
I don't have a strong opinion though, ipfamily.ForService sounds as much as good. Will move it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh, I started a similar comment, then realized the ipFamily pkg was agnostic of k8s and decided it was fine too.

I am all for ipfamily.ForService, but if you do it and decide it doesn't fit, I'm ok with how the code currently is too :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed the change :-)

@fedepaol
fedepaol force-pushed the fixsinglestack branch 2 times, most recently from 4c52758 to 0f708ff Compare March 2, 2022 15:25
K8s versions prior to 1.20 do not have ClusterIPs set, so we fallback to
clusterip (singular) to determine the ip family.

Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>

@rata rata left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fedepaol
fedepaol merged commit 632042d into metallb:main Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants