-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate that IP addresses for ControlPlane and StaticWorkers are different #3334
Validate that IP addresses for ControlPlane and StaticWorkers are different #3334
Conversation
…ferent Signed-off-by: Artiom Diomin <artiom@kubermatic.com>
@kron4eg What if we add public and private addresses, and hostnames, of CP and static worker nodes to two different sets, and then compare sets? That seems like a great way to prevent any possible combination of what can go wrong, as long as we find any intersection, we error out. |
Hostnames are optional and may be absent at the time when validation is running. That's why I didn't included them in the check. Given nested for loop almost exactly the same as sets but without fancy APIs/functions, except one thing. It point to the exact index of the problematic static worker with with .Index() function. Which is not possible with sets. |
That's true, but if we know them, it's useful to do the validation, and with sets this is very easy.
They don't function the exactly same, for example, you might "hack" around by inverting public and private addresses. This and some other cases are much easier to catch by doing the intersection.
This is nice, but IMO it's also enough just to point out to what value is conflicting and you can do that with intersect. |
TBH I don't want to change the thing "just because" with loosing some of the info. There has to be a good reason for that and I don't see sets as one. |
@kron4eg Can we at least include the information what's the conflicting IP address? I find that much more valuable compared to the index. |
Signed-off-by: Artiom Diomin <artiom@kubermatic.com>
sure, and as a bonus optional validation on the hostname (excluding empty case). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
LGTM label has been added. Git tree hash: 23d1440fc464b6a50de1805cc0cd04d9812c3047
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: xmudrii The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/release-note-edit
|
Which issue(s) this PR fixes:
Fixes #2632
What type of PR is this?
/kind api-change
Special notes for your reviewer:
Does this PR introduce a user-facing change? Then add your Release Note here:
Documentation: