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: add auto create namespace #9328

Merged
merged 4 commits into from
Jun 25, 2024

Conversation

amandavialva01
Copy link
Contributor

@amandavialva01 amandavialva01 commented May 7, 2024

Ticket

DET-10224

Description

Implement backend logic for auto-creating Kubernetes namespaces and implement the CLI arguments for this feature.
det w create <workspace-name> --cluster-name <cluster_name> --auto-create-namespace,
det w create <workspace_name> --auto-create-namespace-all-clusters,
det w bindings set <workspace-name> --cluster-name <cluster_name> --auto-create-namespace, and
det w bindings set <workspace-name> --auto-create-namespace-all-clusters

Test Plan

  • Start up a multiRM cluster using two kubernetes resource managers with names c1 and c2 respectively.
  • Run det w create <workspace-name> --cluster-name c1 --auto-create-namespace
  • Run kubectl get namespaces and verify that the namespace name returned from the above CLI command is listed
  • Run det w bindings list and verify that the correct workspace-namespace bindings show up (default for c2, and the auto-created namespace name for c1

Now, create a workspace and verify that the auto-create feature works with det w bindings set

  • Run det w create <second_workspace_name>

  • Run det w bindings set <second_workspace_name> --auto-create-namespace --cluster_name c2

  • Run det w bindings list and verify that the auto-created namespace is listed for cluster c1 while the default namespace is listed for cluster c2

  • Run det w create <third_workspace_name> --auto-create-namespace-all-clusters and verify that the output of this command shows workspace-namespace bindings to an auto-created namespace for both clusters.

  • Run det w bindings list and verify that both auto-created namespaces show up appropriately.

-Run det w create <fourth_workspace_name> and det w bindings set <fourth_workspace_name> --auto-create-namespace-all-clusters and verify the output shows the auto-created workspace-namespace bindings.

  • Run det w bindings list <fourth_workspace_name> to verify that both auto-created namespaces show up appropriately.

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Copy link

netlify bot commented May 7, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit f35e221
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/663bf552fc99aa0008e0b890
😎 Deploy Preview https://deploy-preview-9328--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@amandavialva01 amandavialva01 force-pushed the amanda/addAutoCreateNamespace branch from 9523e69 to f35e221 Compare May 8, 2024 21:57
@amandavialva01 amandavialva01 changed the base branch from main to amanda/cleanupNamespaces May 13, 2024 18:12
Copy link
Contributor

@carolinaecalderon carolinaecalderon left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -194,12 +195,12 @@ def create_workspace(args: argparse.Namespace) -> None:
agent_user_group = _parse_agent_user_group_args(args)
checkpoint_storage = _parse_checkpoint_storage_args(args)

if args.cluster_name and not args.namespace:
if args.cluster_name and (not args.namespace and not args.auto_create_namespace):
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a cleaner way to represent this logic instead of A & (!B & !C)? maybe just remove the parentheses?

@amandavialva01 amandavialva01 force-pushed the amanda/cleanupNamespaces branch 4 times, most recently from 5a9a17e to a40904e Compare June 7, 2024 15:29
@amandavialva01 amandavialva01 requested review from a team as code owners June 24, 2024 16:43
Base automatically changed from amanda/addWkspNmspMeta to wksp-namespace-binding June 24, 2024 17:40
@determined-ci
Copy link
Collaborator

Docsite preview being generated for this PR.
You can (eventually) find the generated docsite here.

@amandavialva01 amandavialva01 force-pushed the amanda/addAutoCreateNamespace branch 2 times, most recently from 380b4da to 5cbca53 Compare June 25, 2024 01:17
@amandavialva01 amandavialva01 force-pushed the amanda/addAutoCreateNamespace branch 8 times, most recently from 5d25015 to 9164a9f Compare June 25, 2024 03:08
@amandavialva01 amandavialva01 merged commit 5b4fd87 into wksp-namespace-binding Jun 25, 2024
57 of 85 checks passed
@amandavialva01 amandavialva01 deleted the amanda/addAutoCreateNamespace branch June 25, 2024 03:37
amandavialva01 added a commit that referenced this pull request Jun 25, 2024
salonig23 pushed a commit that referenced this pull request Jul 1, 2024
salonig23 pushed a commit that referenced this pull request Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants