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

Add namspace parameter for CreateContent redirect to overview #4328

Closed

Conversation

anshulahuja98
Copy link
Contributor

Fixes #4282

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 24, 2019
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 24, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: anshulahuja98
To complete the pull request process, please assign mhenc
You can assign the PR to them by writing /assign @mhenc in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link

codecov bot commented Sep 24, 2019

Codecov Report

Merging #4328 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...p/backend/integration/metric/common/aggregation.go 89.09% <0%> (-1.82%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a1b8c6...7680a79. Read the comment docs.

@@ -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},
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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'], {

Copy link
Contributor Author

@anshulahuja98 anshulahuja98 Sep 24, 2019

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(),

Copy link
Member

@floreks floreks Sep 25, 2019

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.

Copy link
Member

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

Copy link
Contributor

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.

@anshulahuja98 anshulahuja98 changed the title Add namspace parameter for deploy() redirect to overview Add namspace parameter for CreateService redirect to overview Sep 24, 2019
@anshulahuja98 anshulahuja98 changed the title Add namspace parameter for CreateService redirect to overview Add namspace parameter for CreateContent redirect to overview Sep 24, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 2, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 3, 2020
@maciaszczykm
Copy link
Member

I've investigated this, checked the previous version and the current implementation is correct. We have 3 ways of deploying something from the app:

  • deploy from file
  • deploy from input
  • deploy from settings (using the form)

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:
Zrzut ekranu 2020-03-26 o 14 26 51

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard does not remember namespace after adding resource.
7 participants