Skip to content
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

Rework OSM integration into generic external bootstrap "interface" #1428

Merged

Conversation

embik
Copy link
Member

@embik embik commented Sep 9, 2022

What this PR does / why we need it:

This PR is essentially both proposal and code change in one go. Let me explain the reasoning behind this PR first:

Essentially, we have a consumer/producer relationship between MC (as consumer) and OSM (as producer) when it comes to the user-data passed to new machines. However, I believe the consumer/producer relationship bits are a bit all over the place. Some logic exists in MC, some in OSM. The consumer/producer relationship here is very similar to Go interfaces, and a rule of thumb there is that interfaces should not be aware of types that implement them.

The same, IMHO, goes for the MC-OSM relationship: MC should support a standard (or interface, if you want; pkg/bootstrap defines this in this PR) that any producer of bootstrapping user-data can "slot" into. But MC should not be aware of the producer component in any way, other than the defined interface (which, in this PR, is a Secret created under a certain naming pattern). Theoretically, you should be able to create bootstrapping user-data manually.

The point of all this is that MC should not be aware of OSM or depend on it. If this is accepted, I plan to follow up in OSM with adding some of the logic removed here back into it.

In addition, the current MC code does a referential integrity check on an OSP resource - with all the previous explanation this does not make sense anymore anyway (as it's implementation-specific for OSP), but we do not apply referential integrity checks anywhere else for a specific reason: It's against Kubernetes design principles (you won't find this in HPAs referencing a non-existing Deployment, or RBAC role bindings referencing non-existing roles). So, I propose that the check for OSP is removed and replaced with events on MachineDeployments, highlighting that the referenced OSP does not (yet) exist. But that is for the follow-up PR in OSM.

TL;DR: This PR does the following things:

  • Remove the code dependency on OSM to stop the dependency loop we have between MC and OSM.
  • Remove OSM-specific validation and mutation.
  • Document "external bootstrap" mechanism in pkg/bootstrap that relies on some third-party component (such as OSM) creating a user-data bootstrap secret (following the same pattern that OSM applies right now).

Note: The OSP annotation magic should move to KKP, I'll follow up on that as well.

Which issue(s) this PR fixes:

Fixes #

What type of PR is this?
/kind cleanup

Special notes for your reviewer:

Does this PR introduce a user-facing change? Then add your Release Note here:

Remove dependency on operating-system-manager (OSM) and instead rely on generic external bootstrap secret "interface" (which can be fulfilled by any provider)

Documentation:

NONE

@kubermatic-bot kubermatic-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. labels Sep 9, 2022
@kubermatic-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubermatic-bot kubermatic-bot added sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. sig/osm Denotes a PR or issue as being assigned to SIG OSM. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 9, 2022
@embik embik force-pushed the external-bootstrap-mechanism branch from 29eb2e8 to 18ee0ff Compare September 26, 2022 07:55
@embik embik marked this pull request as ready for review September 26, 2022 08:42
@embik embik changed the title WIP: Rework OSM integration into generic external bootstrap "interface" Rework OSM integration into generic external bootstrap "interface" Sep 26, 2022
@kubermatic-bot kubermatic-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 26, 2022
Signed-off-by: Marvin Beckers <[email protected]>
@embik
Copy link
Member Author

embik commented Sep 26, 2022

/retest

@embik embik changed the title Rework OSM integration into generic external bootstrap "interface" WIP: Rework OSM integration into generic external bootstrap "interface" Sep 26, 2022
@kubermatic-bot kubermatic-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 26, 2022
@embik
Copy link
Member Author

embik commented Sep 26, 2022

/retest

@embik embik changed the title WIP: Rework OSM integration into generic external bootstrap "interface" Rework OSM integration into generic external bootstrap "interface" Sep 26, 2022
@kubermatic-bot kubermatic-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 26, 2022
@embik
Copy link
Member Author

embik commented Sep 27, 2022

/retest

Copy link
Member

@ahmedwaleedmalik ahmedwaleedmalik left a comment

Choose a reason for hiding this comment

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

Great job @embik, this brings us a lot closer to what we wanted to achieve; remove this circle of dependency between OSM and MC.

/approve 💙

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 4, 2022
@kubermatic-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: ba643ae37221b57b859e0c2207a568ba3d48b70e

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmedwaleedmalik, embik

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 4, 2022
@embik
Copy link
Member Author

embik commented Oct 4, 2022

/retest

@kubermatic-bot kubermatic-bot merged commit d41d7d9 into kubermatic:master Oct 4, 2022
@embik embik deleted the external-bootstrap-mechanism branch October 4, 2022 14:55
mate4st pushed a commit to mate4st/machine-controller that referenced this pull request Mar 13, 2023
…ubermatic#1428)

* Deprecate use-osm flag, remove osm dependency

Signed-off-by: Marvin Beckers <[email protected]>

* Add a note to pkg/bootstrap/types.go

Signed-off-by: Marvin Beckers <[email protected]>

* Remove provisioning secret as implementation detail of OSM

Signed-off-by: Marvin Beckers <[email protected]>

* Add legacy label again but also set it if external bootstrapping is disabled

Signed-off-by: Marvin Beckers <[email protected]>

* Fix linting issues

Signed-off-by: Marvin Beckers <[email protected]>

* Annotate testdata with default OSPs

Signed-off-by: Marvin Beckers <[email protected]>

Signed-off-by: Marvin Beckers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-management Denotes a PR or issue as being assigned to SIG Cluster Management. sig/osm Denotes a PR or issue as being assigned to SIG OSM. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants