Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

pkg/k8sutil: change NewClientset to load kubeconfig from file content, not from path #628

Merged
merged 6 commits into from
Jul 1, 2020

Commits on Jul 1, 2020

  1. pkg/k8sutil: rename NewClientset to NewClientsetFromFile

    This commit renames NewClientset function into NewClientsetFromFile to
    better describe it's functionality, as function takes file path as an
    argument to build the clientset object.
    
    It also makes room for new NewClientset function, which will take
    content of kubeconfig file instead of file path, to make it decoupled
    from dependency on local filesystem.
    
    NewClientsetFromFile is only a temporary and should be removed once we
    switch back to use NewClientset function everywhere.
    
    This commit also adds some small documentation to NewClientsetFromFile
    function to avoid triggering the linter.
    
    Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
    invidian committed Jul 1, 2020
    Configuration menu
    Copy the full SHA
    4564be5 View commit details
    Browse the repository at this point in the history
  2. pkg/k8sutil: add new NewClientset function

    This commit adds NewClientset exported function, which allows creating
    Kubernetes Clientset from content of kubeconfig file, which allows to
    create it from sources different than file on local file system.
    
    This is required for being able to execute 'lokoctl health' without
    having kubeconfig file present in local assets directory, as it can be
    pulled from other places, e.g. Terraform state.
    
    See #608 for more details.
    
    Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
    invidian committed Jul 1, 2020
    Configuration menu
    Copy the full SHA
    c2652d6 View commit details
    Browse the repository at this point in the history
  3. cli/cmd: consistently name Kubernetes clientset object

    In some places we use 'client' to refer to it, in other 'cs', we should
    be consistent in it. This commit fixes that.
    
    The consistency is particulary useful when you grep for code calling
    the function.
    
    Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
    invidian committed Jul 1, 2020
    Configuration menu
    Copy the full SHA
    d2e160b View commit details
    Browse the repository at this point in the history
  4. cli/cmd: use NewClientset to construct Kubernetes clientset

    NewClientsetFromFile is now deprecated, as we want to gradually switch
    to loading kubeconfig file from the file content rather than from the
    file path.
    
    This commit preserves existing functionality, but uses new function,
    which should simplify the change later for loading from the file
    content.
    
    The code duplication here is intentional, to put calls to NewClientset
    function in place. In next commits, functions parameter types will be
    changed and calls to iotuil.ReadFile will be removed. This allows to do
    more step-by-step transition to different data flow.
    
    Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
    invidian committed Jul 1, 2020
    Configuration menu
    Copy the full SHA
    6241dcf View commit details
    Browse the repository at this point in the history
  5. pkg/components/util: use NewClientset to construct Kubernetes clientset

    NewClientsetFromFile is now deprecated, as we want to gradually switch
    to loading kubeconfig file from the file content rather than from the
    file path.
    
    This commit preserves existing functionality, but uses new function,
    which should simplify the change later for loading from the file
    content.
    
    Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
    invidian committed Jul 1, 2020
    Configuration menu
    Copy the full SHA
    09cdba1 View commit details
    Browse the repository at this point in the history
  6. pkg/k8sutil: remove unused NewClientsetFromFile function

    All uses of this function are now replaced by NewClientset function, so
    this function is unused and safe to remove.
    
    Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
    invidian committed Jul 1, 2020
    Configuration menu
    Copy the full SHA
    90f3c1a View commit details
    Browse the repository at this point in the history