Bug 1880471

Summary: kubelet-config-controller's machineConfigPoolSelector does not match all objects when empty
Product: OpenShift Container Platform Reporter: bmorriso
Component: Machine Config OperatorAssignee: Antonio Murdaca <amurdaca>
Status: CLOSED NOTABUG QA Contact: Michael Nguyen <mnguyen>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.5CC: kgarriso
Target Milestone: ---   
Target Release: ---   
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: 2020-09-18 22:16:29 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 bmorriso 2020-09-18 16:06:36 UTC
Description of problem:

The documentation [1] for the KubeletConfig object states that the machineConfigPoolSelector will match all resources when the selector is empty and will match no resources when the selector is null. However, when testing I saw that an empty selector matches nothing. Also, 
the controller's source code [2] includes a comment that describes different behavior:

"// If a pool with a nil or empty selector creeps in, it should match nothing, not everything."



Version-Release number of selected component (if applicable):
OCP v4.5.9


How reproducible:
Always

Steps to Reproduce:
1. Create a KubeletConfig resource with an empty machineConfigPoolSelector
2. Look at the 'oc describe kubeletconfig <configname>' output.
3.

Actual results:
The kubeletconfig does not apply to any of the machineconfigpools and shows this condition:

'''
  Conditions:
    Last Transition Time:  2020-09-17T21:00:06Z
    Message:               Error: could not find any MachineConfigPool set for KubeletConfig
    Status:                False
    Type:                  Failure

'''


Expected results:

The kubeletconfigs behavior should be consistent with the documentation. Either the docs should be updated to reflect the current behavior of the controller or the controller should be updated to match the described behavior in the docs. 


Additional info:


[1] - https://docs.openshift.com/container-platform/4.5/rest_api/machine_apis/kubeletconfig-machineconfiguration-openshift-io-v1.html
[2] - https://github.com/openshift/machine-config-operator/blob/master/pkg/controller/kubelet-config/kubelet_config_controller.go#L614-L615

Comment 1 Kirsten Garrison 2020-09-18 22:16:29 UTC
This is expected behavior, we are in the process of updating and adding mco documentation.  Please see https://github.com/openshift/machine-config-operator/blob/master/docs/KubeletConfigDesign.md#example as we do expect a pool for the KubeletConfig.

You can follow along via the open mco documentation Jira Card here: https://issues.redhat.com/browse/GRPA-2248 which we hope to get completed soon. I have made an explicit note about this linking to this bug as well.

Thanks for pointing this out!