Bug 1202707

Summary: [origin_runtime_664] Should notify user that the current using project doesn't exist anymore after deleted by admin
Product: OKD Reporter: Meng Bo <bmeng>
Component: ContainersAssignee: Fabiano Franz <ffranz>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: decarr, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-21 18:00:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Meng Bo 2015-03-17 09:40:53 UTC
Description of problem:
Try to use the previous owning project which has been deleted by cluster-admin via user, there is no warning message about the using project has been deleted.

Version-Release number of selected component (if applicable):
openshift v0.4.1-101-g0ac00c6
kubernetes v0.11.0-330-g6241a21


How reproducible:
always

Steps to Reproduce:
1. Setup openshift v3 env
2. Create project and set the user to user2
# openshift ex new-project project21 --admin="anypassword:user2"
3. Create pod in this project with the user2
$ osc login -u user2
$ osc create -f pod.json
4. Delete the project via admin
# osc delete project project21
5. Try to get/delete/create the pods via the user2
$ osc get po
$ osc delete po --all
$ osc create po -f pod.json
6. Check the user's context
$ openshift ex config view --kubeconfig=.config/openshift/.config
7. Try to login again with the user

Actual results:
5. All the actions work
6. The user still using the deleted project.
$ openshift ex config view --kubeconfig=.config/openshift/.config
apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://localhost:8443
  name: localhost:8443
contexts:
- context:
    cluster: localhost:8443
    namespace: project21
    user: user2
  name: localhost:8443-user2
- context:
    cluster: localhost:8443
    user: user2
  name: localhost:8443-user2-0
current-context: localhost:8443-user2
kind: Config
preferences: {}
users:
- name: user2
  user:
    token: NjNhMjM5MTgtMzg5Yy00YWVjLWE2ZTUtMDg5MzA4MzQ3YmE4

7. Will raise up that the user dose not have a project

Expected results:
5. The action should be failed or not, but the warning message that the current project has been deleted should be shown.

Additional info:

Comment 1 Fabiano Franz 2015-03-17 21:52:05 UTC
(In reply to Meng Bo from comment #0)
> 4. Delete the project via admin
> # osc delete project project21
> 5. Try to get/delete/create the pods via the user2
> $ osc get po
> $ osc delete po --all
> $ osc create po -f pod.json

> 5. All the actions work

Could you confirm if still succeeds after waiting a few minutes? I *think* this may be related to project caching.

Comment 2 Fabiano Franz 2015-03-17 21:57:22 UTC
Derek, could you confirm why this happens?

1. Create project 'foo'
2. Create pod when project 'foo' is active
3. List pods when project 'foo' is active, succeeds listing the pod created in 2
4. Delete project created in 1
5. List pods, still succeeds listing the pod created in 2

Is it because of caching, or because after the project gets deletes we still keep the namespace (to which the pod is related)?

Comment 3 Meng Bo 2015-03-18 07:05:14 UTC
Hi Fabiano,

I have tried to wait about 10 minutes after the project deleted, the user still can list the pod.

Comment 4 Fabiano Franz 2015-03-18 14:57:55 UTC
I spoke with Derek, basically the expectation is that when you delete a project , all the content in that project gets deleted. But that's not implemented yet, will be part of the following story:

https://trello.com/c/kqFBoSUF/313-5-when-i-delete-a-project-namespace-i-need-to-ensure-that-all-resources-in-that-project-namespace-are-deleted-manage-beta3

The flow will be something like you delete a project, it goes into a terminating phase, and then all your stuff is deleted, and once all the stuff is deleted, your project is finally purged from storage.

There is a PR for Kubernetes already and there will be one for Origin:

https://github.com/GoogleCloudPlatform/kubernetes/pull/5554

So not exactly a bug, I think we should close it and handle this in the Trello card.

Comment 5 Meng Bo 2015-03-20 06:43:31 UTC
Close the bug and use the trello card to track the feature.