Skip to content

Conversation

@anshuishere
Copy link
Contributor

Issue

When flux onboards tenants in multitenant setup, it always creates manifest for namespace with no option to skip it.

When this is needed?

In a shared cluster, for example in a customer environment, namespaces are managed at infra level by cluster admin.
This means we receive a namespace already created and we don't want flux platform-admin to manage it or delete it in case of tenant removal.

What's in this PR?

This allows a flag to flux create tenant command to optionally skip namespace creation by flux. Default behaviour remains unchanged.

@anshuishere anshuishere force-pushed the skip-tenant-ns-create branch 2 times, most recently from 8e0a123 to dfe7cbe Compare October 21, 2025 09:18
@anshuishere anshuishere marked this pull request as ready for review October 21, 2025 09:19
@anshuishere
Copy link
Contributor Author

Hello,
@matheuscscp @stefanprodan
Can you please review this when you find sometime.

createTenantCmd.Flags().StringSliceVar(&tenantArgs.namespaces, "with-namespace", nil, "namespace belonging to this tenant")
createTenantCmd.Flags().StringVar(&tenantArgs.clusterRole, "cluster-role", "cluster-admin", "cluster role of the tenant role binding")
createTenantCmd.Flags().StringVar(&tenantArgs.account, "with-service-account", "", "service account belonging to this tenant")
createTenantCmd.Flags().BoolVar(&tenantArgs.skipNamespace, "skip-namespace-create", false, "skip namespace creation (namespace must exist already)")
Copy link
Member

Choose a reason for hiding this comment

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

This can just be --skip-namespace same flag we use for uninstall

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The flag is updated now.

@anshuishere anshuishere force-pushed the skip-tenant-ns-create branch from a354621 to 6d39708 Compare November 21, 2025 12:06
@stefanprodan
Copy link
Member

Please rebase your fork with upstream main and squash the commits into one and force push. This PR should contain a single commit.

Add --skip-namespace flag to the 'create tenant' command to skip automatic
namespace creation when the namespace already exists.

Signed-off-by: Anshuman Singh <[email protected]>
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks @anshuishere

@stefanprodan stefanprodan added the area/ux In pursuit of a delightful user experience label Nov 21, 2025
@stefanprodan stefanprodan merged commit d6dec73 into fluxcd:main Nov 21, 2025
7 checks passed
@stefanprodan stefanprodan added the backport:release/v2.7.x To be backported to release/v2.7.x label Nov 21, 2025
@fluxcdbot
Copy link
Member

Successfully created backport PR for release/v2.7.x:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ux In pursuit of a delightful user experience backport:release/v2.7.x To be backported to release/v2.7.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants