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

Multi-tenancy proposal #429

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lentzi90
Copy link
Member

@lentzi90 lentzi90 commented May 16, 2024

This adds a proposal for how to implement the CAPI multi-tenancy contract for CAPM3.

@metal3-io-bot metal3-io-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 16, 2024
@metal3-io-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

@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 16, 2024
@lentzi90 lentzi90 marked this pull request as ready for review May 17, 2024 11:31
@lentzi90 lentzi90 changed the title WIP: Multi-tenancy proposal Multi-tenancy proposal May 17, 2024
@metal3-io-bot metal3-io-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 17, 2024
@pierrecregut
Copy link

Credentials can be put either at two levels:

  • at cluster level
  • at machine level (through machine template)

With the first approach you have chosen, there can only be one source of baremetal machines, with the second you can have as many sources as machine deployments and you can smoothly transition between sources by changing the credentials.

It can be interesting to have a cluster that spans over different regions for redundancy. It is also useful in some edge scenarios where you can have a cluster with a centralized CP and many locations with potentially many baremetal providers.

As far as I know there is no explicit requirement in CAPI multi-tenancy contract that there is a single set of credentials.

@lentzi90
Copy link
Member Author

Interesting point. I'm open to add the same identityRef to the Metal3MachineTemplate also. In fact, this would be identical to how CAPO does it. In practice I don't think it changes the proposal much. We can default the identityRef for the Metal3Machines to what is set on the Metal3Cluster and then allow the user to override that in the Metal3MachineTemplate.

This adds a proposal for how to implement the CAPI multi-tenancy
contract for CAPM3.

Signed-off-by: Lennart Jern <lennart.jern@est.tech>
@pierrecregut
Copy link

The title and the user stories give the impression that the proposal solves the multi-tenancy problem. It is true that two clusters can be defined in two namespaces and point to one single namespace of baremetalhosts. But the user of those clusters will have full power over those BMHs and the content of the BMH is equivalent to the content of the cluster. Unless you have something like HostClaims hiding the baremetalhost namespaces, you cannot share BMH with users you do not trust. In fact, if there are good use cases for this remote access for HostClaim, I do not really see any for BMH.

@pierrecregut
Copy link

The implementation will be tricky. We need to maintain a watch over a namespace in a cluster generating events in another cluster and we need to know when to remove this watch. Probably when the kubeconfig secret is deleted.

@pierrecregut
Copy link

Some fields in the status are copied back. But the dataTemplate mechanism also relies on labels and annotations. I expect that they will not be copied and that the controller will use the kubeconfig to get the actual values. Is that the case ?

@lentzi90
Copy link
Member Author

From the CAPI perspective this does solve multi-tenancy. Each tenant provide credentials for accessing their BareMetalHosts, similar to how it would work with cloud resources. If two tenants share the same BareMetalHosts, then that is essentially one tenant. This is also the same as for other providers. If you have access to the same OpenStack, AWS or GCP tenant then you also have control over the same cloud resources.

I understand that this does not solve the same issue as the HostClaim, but I see this as essential. It also does not block implementing HostClaims before or after. as long as it is done with concideration. That was my goal with this, to make the design of the HostClaim easier by extracting this important part.

@Rozzii
Copy link
Member

Rozzii commented May 27, 2024

/approve

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 27, 2024
@lentzi90
Copy link
Member Author

/hold
I want to make sure people have a chance to check this and comment before we merge

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 27, 2024
@lentzi90
Copy link
Member Author

lentzi90 commented Jun 7, 2024

Two weeks have passed and we have discussed it offline. I think it is safe to remove the hold
/hold cancel

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2024
@lentzi90
Copy link
Member Author

lentzi90 commented Jun 7, 2024

/test ?

1 similar comment
@lentzi90
Copy link
Member Author

lentzi90 commented Jun 7, 2024

/test ?

@metal3-io-bot
Copy link
Contributor

@lentzi90: The following commands are available to trigger required jobs:

  • /test markdownlint
  • /test shellcheck
  • /test spellcheck

Use /test all to run the following jobs that were automatically triggered:

  • markdownlint
  • spellcheck

In response to this:

/test ?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@Rozzii Rozzii left a comment

Choose a reason for hiding this comment

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

/approve

@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Rozzii

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

context: default
```

The status of the Metal3Machine should be exteded with the information from the
Copy link
Member

Choose a reason for hiding this comment

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

typo s/exteded/extended

- `.status.errorCount` on the BMH would become
`.status.bareMetalHost.errorCount`
- `.status.errorMessage` on the BMH would become
`.status.bareMetalHost.errorMessage`
Copy link
Member

Choose a reason for hiding this comment

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

Something to think about: we might expose internal details through error messages.

# New fields
bareMetalHost:
provisioning:
ID: f1e06671-6823-4676-9827-33efd7231c3f
Copy link
Member

Choose a reason for hiding this comment

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

Mmmm, maybe filter out the ironic node UUID?

@dtantsur
Copy link
Member

dtantsur commented Jul 4, 2024

/cc @zaneb

since you have opinions on multi-tenancy.

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. 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.

None yet

6 participants