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

Allow Ark server to run in arbitrary namespaces #106

Closed
SleepyBrett opened this issue Sep 27, 2017 · 9 comments
Closed

Allow Ark server to run in arbitrary namespaces #106

SleepyBrett opened this issue Sep 27, 2017 · 9 comments
Assignees
Milestone

Comments

@SleepyBrett
Copy link

SleepyBrett commented Sep 27, 2017

Currently the Ark server component assumes that it's configuration is stored in api.DefaultNamespace (heptio-ark) with no way to override. As cluster admins we put these kind of tools into a 'utils' namespace and would like to do the same for Ark.

The server component should probably assume it's configuration is stored in the namespace it's deployed in. The client would need to support a namespace flag or configuration or both.

@ncdc
Copy link
Contributor

ncdc commented Sep 27, 2017

To do this, we should

  1. Use the in-cluster namespace for the ark server
  2. Add --namespace/-n to the ark CLI
  3. Optionally have ~/.arkconfig or ~/.config/ark as a means to set the default namespace so you don't have to type --namespace all the time

@woop
Copy link

woop commented Oct 12, 2017

@ncdc Can I work on a PR for (1) and (2)?

@ncdc
Copy link
Contributor

ncdc commented Oct 12, 2017 via email

@ncdc
Copy link
Contributor

ncdc commented Oct 12, 2017 via email

@ncdc
Copy link
Contributor

ncdc commented Oct 17, 2017

@SleepyBrett @woop just checking in - are either of you working on this? Thanks!

@ncdc ncdc added this to the v0.6.0 milestone Oct 17, 2017
@woop
Copy link

woop commented Oct 18, 2017

@ncdc I'm not actively working on this. Bit short on time. I'll swing back when I have more free time.

@ashish-amarnath
Copy link
Member

My approach, for the server, was to inject the namespace into the server as an environment and read the environment variable, if it exists, else use the default namespace. @ncdc Can you elaborate on "Use the in-cluster namespace for the ark server"
Is this an option for one of the kubernetes APIs? Not too familiar with using the k8s APIs.

@ncdc
Copy link
Contributor

ncdc commented Nov 9, 2017

@ashish-amarnath yes, it's part of client-go. Let me see if I can dig up the exact code you'll need.

@ncdc
Copy link
Contributor

ncdc commented Nov 9, 2017

@ashish-amarnath in pkg/client/client.go, replace the call to clientcmd.BuildConfigFromKubeconfigGetter with this:

clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
  loader,
  &clientcmd.ConfigOverrides{},
)

That gives you a clientcmd.ClientConfig, upon which you can invoke Namespace(), and that will return the pod's namespace if you're running it in a Kubernetes cluster. You'll probably need to tweak it so that there's a ClientConfig() function that returns the clientcmd.ClientConfig, and then the current Config() function can just call that, and then return the *rest.Config as it currently does. Or something like that...

@ncdc ncdc modified the milestones: v0.6.0, v0.7.0 Nov 29, 2017
@ncdc ncdc self-assigned this Dec 21, 2017
@ncdc ncdc removed the Help wanted label Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants