Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clients kubernetes function requires a .kube config #30

Closed
shawn-hurley opened this issue Mar 21, 2018 · 1 comment
Closed

Clients kubernetes function requires a .kube config #30

shawn-hurley opened this issue Mar 21, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@shawn-hurley
Copy link
Contributor

I don't that we should require anything here.

I don't have an idea on how to fix ATM.

@shawn-hurley shawn-hurley added this to the 1.0.0 milestone Mar 23, 2018
@maleck13
Copy link
Contributor

One option here is to accept the client interface type as part of the constructor. This is generally how go does dependency injection, which I think makes a lot of sense here. We would maintain the central place to get and configure the client but accept the mockable interface in the constructor.
This would allow us to use the fake clients without requiring a user to have a valid .kube config set up

func NewStateManager(k8sClient kubernetes.Interface) *StateManager{
    return &StateManager{
                   client: k8sClient,
               }
}

func (sm *StateManager)DoSomething()error{
     sm.client.CoreV1().Configmaps("namespace")....

}

@jmrodri jmrodri removed this from the 1.0.0 milestone Jun 26, 2018
@jmrodri jmrodri added the enhancement New feature or request label Jun 26, 2018
@jmrodri jmrodri closed this as completed Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants