• Kubernetes Submit Queue's avatar
    Merge pull request #46299 from ncdc/fix-DirectClientConfig-Namespace-override · 3c2e6a9f
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 46299, 46309, 46311, 46303, 46150)
    
    Fix in-cluster kubectl --namespace override
    
    **What this PR does / why we need it**:
    Before this change, if the config was empty, ConfirmUsable() would
    return an "invalid configuration" error instead of examining and
    honoring the value of the --namespace flag. This change looks at the
    overrides first, and returns the overridden value if it exists before
    attempting to check if the config is usable. This is most applicable to
    in-cluster clients, where they don't have a kubeconfig but they do have
    a token and can use KUBERNETES_SERVICE_HOST/_PORT.
    
    **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
    
    **Special notes for your reviewer**:
    
    **Release note**:
    
    ```release-note
    The --namespace flag is now honored for in-cluster clients that have an empty configuration.
    ```
    
    @kubernetes/sig-api-machinery-pr-reviews @fabianofranz @liggitt @deads2k @smarterclayton @caesarxuchao @soltysh
    3c2e6a9f
Name
Last commit
Last update
..
src/k8s.io Loading commit data...
OWNERS Loading commit data...
README.md Loading commit data...
copy.sh Loading commit data...
godeps-json-updater.go Loading commit data...
prime-apimachinery.sh Loading commit data...