Bug 1689036

Summary: Unjoin a cluster which not exists in the federation gives an unclear err msg
Product: OpenShift Container Platform Reporter: Qin Ping <piqin>
Component: FederationAssignee: Ivan Font <ifont>
Status: CLOSED CURRENTRELEASE QA Contact: Qin Ping <piqin>
Severity: low Docs Contact:
Priority: low    
Version: 4.1.0CC: bmcelvee, mnewby, pmorie
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-09 19:15:55 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 Qin Ping 2019-03-15 01:54:39 UTC
Description of problem:
Unjoin a cluster which not exists in the federation gives an unclear err msg

Version-Release number of selected component (if applicable):
kubefed2 version: version.Info{Version:"0.0.6", GitCommit:"de6a0a909418f5ddf2d04d232b0ca55aa9cffb49", GitTreeState:"clean", BuildDate:"2019-03-14T00:43:37Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Federation v2 controller-manager version: version.Info{Version:"0.0.6", GitCommit:"de6a0a909418f5ddf2d04d232b0ca55aa9cffb49", GitTreeState:"clean", BuildDate:"2019-03-14T00:43:37Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
Always

Steps to Reproduce:
1. Install federationV2 control plane with marketplace undernamespace: federation-llng
2. Join "cluster1" to federation with cmd: kubefed2 join cluster1 --host-cluster-context=host-admin --cluster-context=cluster1-admin --federation-namespace=federation-llng --registry-namespace=federation-llng --add-to-registry 
3. Unjoin "cluster1" with cmd: kubefed2 unjoin cluster1 --cluster-context=cluster1-admin --host-cluster-context=host-admin --federation-namespace=federation-llng --registry-namespace=federation-llng --remove-from-registry
4. Unjoin "cluster1" again.

Actual results:
E0315 09:13:07.474598    2572 unjoin.go:308] Error deleting service account: cluster1-host-admin in unjoining cluster. serviceaccounts "cluster1-host-admin" not found

Expected results:
cluster1 not found.

Additional info:

Comment 1 Paul Morie 2019-03-19 03:44:32 UTC
I think it's right for repeat invocations of 'unjoin' to attempt to delete the associated resources, _but_ it shouldn't be an error if they don't exist (since they may have already been deleted).

WDYT?

Comment 2 Qin Ping 2019-03-19 05:18:57 UTC
Return an error message is ok for me, but I think we should give an message to tell people, he already unjoined the cluster from the federation, he does not need to try creating serviceaccout then try  unjoining again.

For exampla:
$ oc delete federatedsecrets test-secret
Error from server (NotFound): federatedsecrets.types.federation.k8s.io "test-secret" not found.

Comment 3 Maru Newby 2019-04-10 19:38:35 UTC
I've filed an upstream bug: https://github.com/kubernetes-sigs/federation-v2/issues/745

Comment 4 Maru Newby 2019-06-05 17:55:05 UTC
The upstream issue was resolved 3 weeks ago and the fix will appear in subsequent releases (0.1.0-rc2 and greater).

Comment 5 Maru Newby 2019-07-23 18:18:33 UTC
The fix should appear in releases rc2 and greater.

Comment 6 Qin Ping 2019-08-08 08:53:06 UTC
Verified with kubefedctl version: version.Info{Version:"v4.2.0", GitCommit:"ee84d241d0d8038640f9dad7cbeb0ea8cce58b6c", GitTreeState:"clean", BuildDate:"2019-08-06T18:27:54Z", GoVersion:"go1.12.6", Compiler:"gc", Platform:"linux/amd64"}

$ kubefedctl unjoin cluster1 --host-cluster-context=admin --cluster-context=admin --kubefed-namespace=federation-system
$ kubefedctl unjoin cluster1 --host-cluster-context=admin --cluster-context=admin --kubefed-namespace=federation-system
F0808 16:51:58.317988    5271 unjoin.go:95] Error: Failed to get kubefed cluster "federation-system/cluster1": kubefedclusters.core.kubefed.io "cluster1" not found

Comment 7 Brandi Munilla 2019-10-08 17:26:24 UTC
Does this bug require doc text? The Doc Type/Text field is not currently set. Thanks!