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

Allow the package controller to create destination namesapces for Curated Package deployments #601

Closed
cryptk opened this issue Oct 31, 2022 · 2 comments · Fixed by #624
Closed
Assignees
Labels
enhancement New feature or request

Comments

@cryptk
Copy link

cryptk commented Oct 31, 2022

What would you like to be added:
Curated Packages should be allowed to create their targetNamespace perhaps with an addition to the packages.packages.eks.amazonaws.com CRD for spec.createNamespace which will default to false and provide the exact current behavior, but could optionally be set to true to tell the package controller to create the targetNamespace before deploying the package.

If you wanted to be extra safe, the package controller could error out if spec.createNamespace was set to true and the namespace already exists, unless the namespace was created by the package controller, which could be tracked via an annotation on the namespace.

Why is this needed:
Currently to deploy a Curated Package, you must first create the namespace that the package will deploy into, then you must create the Package resource in the correct eksa-packages- namespace. This becomes even more tedious when you are deploying a Curated Package onto a workload cluster which is managed by a management cluster as you must then perform the following dance:

  • change kubectl context to the target workload cluster
  • create the required kubernetes namespace
  • change kubectl context to the management cluster that the workload cluster belongs to
  • create the requred Package resource

When deploying Curated Packages via a management tool (such as terraform) this becomes even more annoying as you must pass multiple kubernetes providers around to create namespaces on one cluster while defining packages on another cluster.

@lewisdiamond
Copy link
Member

We could add support for automatically creating namespaces but this would have to be enabled by the administrator on the controller configuration side first. The reason we don't automatically create the namespace is because the controller runs with admin privileges and this would allow users with no access to namespace creation to leverage the controller to create any namespace they want.

We would add a packagebundlecontroller setting that allows packages to create namespaces and if it's true and the package also has createNamespace: true, the controller would then create the namespace. This would most likely default to false but we can also add a flag at install for it to be true everywhere. Does that sound like a solution that would work for your use-case?

@lewisdiamond lewisdiamond self-assigned this Nov 17, 2022
@TerryHowe TerryHowe added the enhancement New feature or request label Nov 22, 2022
@lewisdiamond
Copy link
Member

This is now available in the latest release. In order to have the controller automatically create a namespace, set createNamespace to true in the packagebundlecontroller for the cluster. See https://anywhere.eks.amazonaws.com/docs/reference/packagespec/packages/#packagebundlecontrollerspec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants