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

Don't automatically create namespace if it does not exist #28

Open
meain opened this issue Jul 7, 2022 · 3 comments
Open

Don't automatically create namespace if it does not exist #28

meain opened this issue Jul 7, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@meain
Copy link
Member

meain commented Jul 7, 2022

Briefly describe the feature

As of now, if the user selects a namespace when specifying a project-user-role mapping which does not exist, we create the namespace on the first use. This is done as we rely on the namespace being available to generate SA and other necessary resources, but it would be better to not create the namespace and just return with error/empty if they try to access it.

What problem does this feature solve? Please link any relevant documentation or Issues

Make the behavior of missing namespaces more to what people might expect out of the box.

(optional) What is your current workaround?

-

@meain meain added the enhancement New feature or request label Jul 7, 2022
@niravparikh05 niravparikh05 self-assigned this Jul 15, 2022
@niravparikh05
Copy link
Contributor

As part of this fix, Paralus will not create a namespace if it does not exists whenever a namespaced role is associated to any user. It is the responsibility of the admin to ensure a valid existant namespace is provided during role association.

User will see below error messsage while trying to access details from a namespace that does not exist in target cluster

Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:paralus-system:nsadmin-64paralus-46local" cannot list resource "pods" in API group "" in the namespace "paralus"

@niravparikh05 niravparikh05 linked a pull request Jul 15, 2022 that will close this issue
5 tasks
@niravparikh05 niravparikh05 added this to the v0.1.1 milestone Jul 18, 2022
@niravparikh05 niravparikh05 removed this from the v0.1.1 milestone Feb 24, 2023
@akshay196 akshay196 added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Mar 23, 2023
@akshay196
Copy link
Member

akshay196 commented Mar 23, 2023

@niravparikh05 Adding needs-triage label to this issue. Please confirm if it is already triaged and good to be work on.

@akshay196
Copy link
Member

akshay196 commented Apr 1, 2023

I have verified this issue on my side. Attaching recording that shows namespace (named ns-read-user-ns) is automatically created in the cluster when user perform a kubectl operation.

Screencast.from.01-04-23.07.21.58.PM.IST.webm

As per design, Paralus is creating role and rolebinding in the namespace based on user permissions.

$ kubectl get role,rolebinding -n ns-read-user-ns
NAME                                                                  CREATED AT
role.rbac.authorization.k8s.io/paralus-ns-role-read-ns-read-user-ns   2023-04-01T13:58:10Z

NAME                                                                                                               ROLE                                        AGE
rolebinding.rbac.authorization.k8s.io/paralus-ns-role-read-ns-read-user-ns-ns-45read-64paralus-46local-r-binding   Role/paralus-ns-role-read-ns-read-user-ns   6m15s
  1. If user has write kubectl access (eg. kubectl.fullaccess, kubectl.namespace.write, kubectl.cluster.write) to the cluster then is it fair action that user manually create a namespace s/he has access to?
  2. If ns does not exist then no role and rolebinding are created. If user perform operation on granted namespace, they might get "forbidden" error. I think Paralus should detect no namespace available and inform user likewise. So that user can ask admin to create missing namespace. Is this the expected behavior?

@akshay196 akshay196 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants