-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add namspace parameter for CreateContent redirect to overview #4328
Conversation
c08dda9
to
7680a79
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: anshulahuja98 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report
@@ Coverage Diff @@
## master #4328 +/- ##
==========================================
- Coverage 46.62% 46.61% -0.02%
==========================================
Files 200 200
Lines 9373 9373
Branches 105 105
==========================================
- Hits 4370 4369 -1
- Misses 4734 4735 +1
Partials 269 269
Continue to review full report at Codecov.
|
@@ -96,7 +96,9 @@ export class CreateService { | |||
this.reportError(i18n.MSG_DEPLOY_DIALOG_ERROR, error.error); | |||
throw error; | |||
} else { | |||
this.router_.navigate(['overview']); | |||
this.router_.navigate(['overview'], { | |||
queryParams: {[NAMESPACE_STATE_PARAM]: spec.namespace}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using spec.namespace
will make it follow the namespace of the created resource. I am not sure if we should switch to the namespace of created resource or simply stick with the current namespace.
@maciaszczykm WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure too, perhaps we can add dialog if the user wants his ns to be switched?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach is followed in deploy() method which is used in create from form
this.router_.navigate(['overview'], { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@floreks , the namespace assigned in the spec for createContent() is anyways the current namespace. I didn't realize to point it out earlier.
This is also because in create from input, there isn't an option to explicitly mention the ns. It's current by default
namespace: this.namespace_.current(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anshulahuja98 If you choose create from input/file then it's very easy to override the namespace via the resource definition.
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: xyz
Then the namespace from the file will be taken to create a new resource. That's why changing the namespace to the namespace of the resource might not be a good idea. It's sometimes hidden from the user eyes and possibly not really expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that when trying to create a resource specifying another namespace from the actual namespace, you will get an error "Deploying file has failed: MSG_DEPLOY_NAMESPACE_MISMATCH_ERROR"
So in case of success, the current namespace and the namespace of the created resource will be the same one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it might be more appropriate to keep the current namespace. If the user fails to create resource from yaml, switching to the namespace in yaml will cause bad results. It's also not good to get different solutions in different kind of cases, which will make users confused.
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
I've investigated this, checked the previous version and the current implementation is correct. We have 3 ways of deploying something from the app:
In first two cases we would like to avoid switching to the namespace of the new thing that was deployed as it may be unexpected. We don't want to confuse users here. The only case that we think should redirect to the new namespace was when the user was using the form in the create wizard and picked the different namespace on his own. See the implementation from last version before v2: https://github.com/kubernetes/dashboard/blob/v1.10.1/src/app/frontend/deploy/service.js#L142 Moreover, it is not possible to create from input to the namespace different than currently selected: The only problem right now seems to be that if we create from input resource in the namespace X we end up in the default namespace. I will fix that. |
Fixes #4282