Bug 1741478

Summary: Kubefed operator deployment scope does not match kubefed controller manager deployment scope
Product: OpenShift Container Platform Reporter: Qin Ping <piqin>
Component: FederationAssignee: Aniket Bhat <anbhat>
Status: CLOSED ERRATA QA Contact: Qin Ping <piqin>
Severity: medium Docs Contact:
Priority: high    
Version: 4.2.0CC: anbhat, ifont
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:
: 1761040 (view as bug list) Environment:
Last Closed: 2019-10-16 06:36:02 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:
Bug Depends On:    
Bug Blocks: 1761040    

Description Qin Ping 2019-08-15 09:23:52 UTC
Description of problem:
Kubefed webhook defaulting is not correct after changing the kubefed controller manager deployment scope

Version-Release number of selected component (if applicable):
KubeFed controller-manager version: version.Info{Version:"v4.2.0", GitCommit:"b8ae65cee603cc9c746911debd3dc23b922222d8", GitTreeState:"clean", BuildDate:"2019-08-13T23:14:02Z", GoVersion:"go1.12.6", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
100%

Steps to Reproduce:
1. Installed a kubefed-operator
2. Installed a cluster scoped kubefed webhook
$ oc get kubefedwebhook kubefedwebhook-resource -n default -oyaml
apiVersion: operator.kubefed.io/v1alpha1
kind: KubeFedWebHook
metadata:
  creationTimestamp: "2019-08-15T05:05:25Z"
  generation: 1
  name: kubefedwebhook-resource
  namespace: default
  resourceVersion: "578751"
  selfLink: /apis/operator.kubefed.io/v1alpha1/namespaces/default/kubefedwebhooks/kubefedwebhook-resource
  uid: 4a8ac06d-bf1a-11e9-a616-42010a000004
spec:
  scope: Cluster
status:
  version: 0.1.0
3. Created a project kube-federation-system
4. Installed a cluster scoped kubefed controller manager
$ oc get kubefedconfig kubefed -n kube-federation-system -ojson|jq .spec.scope
"Cluster"
5. Delete the kubefed object under kube-federation-system to uninstall the kubefed controller manager.
6. Created a new project federation-system
7. Try to install a namespace scoped kubefed controller manager
$ oc get kubefed kubefed-resource -n federation-system -ojson|jq .spec.scope
"Namespaced"
8. Check the kubefedconfig

Actual results:
$ oc get kubefedconfig kubefed -n federation-system -ojson|jq .spec.scope
"Cluster"


Expected results:
The scope should be "Namespaced"

Additional info:

Comment 2 Ivan Font 2019-08-15 23:53:06 UTC
There is a mismatch between the intent expressed in the operator's kubefed CR and the kubefedconfig that is currently defaulted by the kubefed controller, if none exists. I see a few options we can take depending on if there exists any precedence:

1. Delete the "kubefed" KubeFedConfig upon uninstalling the kubefed controller manager. If this is normal practice for an operator to remove resources associated with the component it's managing upon uninstallation, we should follow suit. Otherwise see the next options.
2. If there already exists a KubeFedConfig whose scope does not match the scope in the operator's kubefed CR, overwrite it.
3. Same as 2, except instead of overwriting it, report an error.

Comment 3 Ivan Font 2019-08-15 23:56:53 UTC
The kubefedconfig webhook does not perform any defaulting on the deployment scope as that is a required field that needs to be provided by the user. Currently there is a workaround for the kubefed controller manager to set this scope based on the environment variable DEFAULT_KUBEFED_SCOPE that is set by the operator. I am updating the title to better reflect the issue reported in this bug.

Comment 5 Aniket Bhat 2019-08-23 17:28:55 UTC
Ping, 

The latest downstream kubefed images should have this fixed.

Aniket.

Comment 7 Qin Ping 2019-08-28 08:17:56 UTC
Failed verification with KubeFed controller-manager version: version.Info{Version:"v4.2.0", GitCommit:"7f002471b9dd8366e1e0f080b46bc79864682f71", GitTreeState:"clean", BuildDate:"2019-08-25T20:09:07Z", GoVersion:"go1.12.6", Compiler:"gc", Platform:"linux/amd64"}

Still have the same issue.

Comment 10 Qin Ping 2019-09-10 14:21:00 UTC
Verified with:
kubefedctl version: version.Info{Version:"v4.2.0", GitCommit:"d33c8586092041e14d47555b464ede2e99b8bb5f", GitTreeState:"clean", BuildDate:"2019-09-09T18:21:24Z", GoVersion:"go1.12.8", Compiler:"gc", Platform:"linux/amd64"}

kubeFed controller-manager version: version.Info{Version:"v4.2.0", GitCommit:"d33c8586092041e14d47555b464ede2e99b8bb5f", GitTreeState:"clean", BuildDate:"2019-09-09T19:12:18Z", GoVersion:"go1.12.8", Compiler:"gc", Platform:"linux/amd64"}

Comment 11 errata-xmlrpc 2019-10-16 06:36:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2922