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

feat(api): Add forceTenantPrefix option to Tenant spec #1244

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

Conversation

samirtahir91
Copy link

@samirtahir91 samirtahir91 commented Nov 3, 2024

This PR adds the option to require the tenant name prefix to it's namespace names, at the tenant level (opposed to setting globally in capsule configuration). With this users do not need to define forceTenantPrefix in capsule configuration if wanting to apply to certain Tenants only.

This allows admins to fine grain which Tenants should be prefixed (i.e. consumer developer teams), whilst giving flexibility on other Tenants like platform team namespaces.

forceTenantPrefix has been added in the Tenant Spec

Requires users to set the capsule.clastix.io/tenant label for Tenants with forceTenantPrefix set to true if more than 1 Tenant matches the owner as well as prefixing the Tenant name in the namespace, or just prefix the namespace with tenant name if matching to a single Tenant with forceTenantPrefix set to true.

Copy link

netlify bot commented Nov 3, 2024

Deploy Preview for capsule-documentation canceled.

Name Link
🔨 Latest commit 9193d36
🔍 Latest deploy log https://app.netlify.com/sites/capsule-documentation/deploys/673f18ebb7c058000805fe68

@oliverbaehler oliverbaehler self-assigned this Nov 4, 2024
@oliverbaehler oliverbaehler added this to the v0.8.0 milestone Nov 4, 2024
@prometherion
Copy link
Member

@oliverbaehler what are your thoughts on this?

@oliverbaehler
Copy link
Collaborator

I am okay with it, for a new minor release (v0.8.0)

What happens when a tenant has capsule.clastix.io/tenant set to another tenant in both cases. If the option is on tenant basis true or false?

@samirtahir91
Copy link
Author

I am okay with it, for a new minor release (v0.8.0)

What happens when a tenant has capsule.clastix.io/tenant set to another tenant in both cases. If the option is on tenant basis true or false?

If I am an owner of the Tenant tenant-a with forceTenantPrefix: true, when I create a namespace with label capsule.clastix.io/tenant: tenant-a and use a invalid prefix, it will be denied as label take presedence and includes the check to see if the labelled Tenant (tenant-a) needs the prefix by looking at the spec.

If tenant-a does not have forceTenantPrefix: true then it would allow the namespace

Copy link
Collaborator

@oliverbaehler oliverbaehler left a comment

Choose a reason for hiding this comment

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

Sorry reviewed on my phone bcs im in hospital. I will verify the functionality again when i am on my pc

e2e/force_tenant_prefix_tenant_scope_test.go Outdated Show resolved Hide resolved
@samirtahir91
Copy link
Author

The test failed for k8s 1.30.0, but unsure why? Can we re-trigger? @oliverbaehler

@oliverbaehler
Copy link
Collaborator

@samirtahir91
Copy link
Author

I'm unsure why, the change was 3 extra test cases which pass with forceTenantPrefix true in Capsule Configuration...

@samirtahir91
Copy link
Author

Seems fine now...

api/v1beta2/tenant_types.go Outdated Show resolved Hide resolved
@samirtahir91
Copy link
Author

@oliverbaehler - could you able to retrigger the failing test pls?

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