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

✨ Support namespace in Metal3Machine's HostSelector #795

Closed
wants to merge 5 commits into from
Closed

✨ Support namespace in Metal3Machine's HostSelector #795

wants to merge 5 commits into from

Conversation

Lirt
Copy link

@Lirt Lirt commented Dec 1, 2022

What this PR does / why we need it

This PR adds support for namespace field in a HostSelector of Metal3Machine and Metal3MachineTemplate CRDs.

Short discussion about this feature was in this Slack thread.

cc. @jsen- and @schrej

Motivation

In case each CAPI/Metal3 cluster (or tenant) is located in a dedicated namespace - it is not possible to have a shared pool of BMHs among those clusters.

This feature will allow to pick BareMetalHosts (BMHs) from different namespace than namespace of a Metal3Machine (or Cluster namespace). With namespace selection feature each cluster (or tenant) can be isolated in a dedicated namespace and reference BMHs from different namespace in which they can be pre-provisioned.

Signed-off-by: Ondrej Vasko ondrej.vaskoo@gmail.com

Support setting namespace where to look for BareMetalHosts in Metal3Machine using HostSelector

Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
During conversion from v1beta1 to v1alpha5 this field would be lost and
there is no way how to make it compatible

Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
@metal3-io-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign kashifest after the PR has been reviewed.
You can assign the PR to them by writing /assign @kashifest in a comment when ready.

The full list of commands accepted by this bot can be found 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

@metal3-io-bot metal3-io-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 1, 2022
@metal3-io-bot
Copy link
Contributor

Hi @Lirt. Thanks for your PR.

I'm waiting for a metal3-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@metal3-io-bot metal3-io-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 1, 2022
@schrej
Copy link
Member

schrej commented Dec 1, 2022

/ok-to-test

@metal3-io-bot metal3-io-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 1, 2022
@Lirt
Copy link
Author

Lirt commented Dec 2, 2022

After more tests I found out that after Metal3Machine was created, an ownerReference was added to BareMetalHost telling that owner of BMH is M3M. It looks like this:

API Version:  metal3.io/v1alpha1
Kind:         BareMetalHost
Name:         s4anb866
Namespace:    c-caas-bm-test1
Labels:       cluster.x-k8s.io/cluster-name=ovasko-test-cluster-01
Metadata:
  Owner References:
    API Version:     infrastructure.cluster.x-k8s.io/v1beta1
    Controller:      true
    Kind:            Metal3Machine
    Name:            ovasko-test-cluster-01-master-wb99h
    UID:             48464ad2-5674-4f2a-b02b-a01783595d7a
  Warning  OwnerRefInvalidNamespace  4m    garbage-collector-controller  ownerRef [infrastructure.cluster.x-k8s.io/v1beta1/Metal3Machine, namespace: c-caas-bm-test1, name: ovasko-test-cluster-01-master-wb99h, uid: 48464ad2-5674-4f2a-b02b-a01783595d7a] does not exist in namespace "c-caas-bm-test1"

The issue is that ownerReference can only point to resource in the same namespace or cluster-wide resource:

OwnerReference contains enough information to let you identify an owning
object. An owning object must be in the same namespace as the dependent, or
be cluster-scoped, so there is no namespace field.

And then BMH gets deleted as M3M could not be found (it's in different namespace for this case). I think this is a deal-breaker for this Pull Request and we cannot overcome it unless someone has idea how to combine this BMO feature with CAPM3.

@schrej
Copy link
Member

schrej commented Mar 23, 2023

/retest

@metal3-io-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues will close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@metal3-io-bot metal3-io-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 21, 2023
@Lirt Lirt closed this Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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