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

would like to configure the namespace cadvisor is found in #88

Open
brennantaylor opened this issue Apr 29, 2020 · 5 comments
Open

would like to configure the namespace cadvisor is found in #88

brennantaylor opened this issue Apr 29, 2020 · 5 comments

Comments

@brennantaylor
Copy link

brennantaylor commented Apr 29, 2020

Right now it is hardcoded to cadvisor. It would be nice to be able to configure this.

Not sure how you like configuration to be extracted. If you provide some guidance I can open a PR.

@brennantaylor brennantaylor changed the title would like to configure the namespace cadvisor runs in would like to configure the namespace cadvisor is found in Apr 29, 2020
@astefanutti
Copy link
Owner

Thanks a lot for the suggestion. That makes totally sense.

I see a couple of options:

  • Pass the namespace as a CLI option. Having a proper CLI is something we plan provide (e.g. for Startup namespace #77). However, I was more thinking of it as an emulation of kubectl CLI, rather than to configure Kubebox itself. Besides, the cAdvisor namespace is a rather static information, per cluster, so you may not want to pass it each time, but rather define it once. That leads to the next option;
  • Have a dot configuration file for Kubebox.

Ideally, it should work also for the Web version. CLI can be emulated with arguments passed in the URL. A dot file could be emulated with a config map. Maybe even for the non-Web version, a config map could old the configuration and be looked up, but that's probably better to stick to the dot file convention.

WDYT?

@brennantaylor
Copy link
Author

Yeah I've also struggled defining an isomorphic config that feels right in both the cli and web.

It's pretty standard to inject env vars or mount entire files into a container with configmaps. Env vars also let you use env or envFrom in podSpecs to define it. Changing the cli args is trivial too.

Env vars could be made to work ok in the browser with query params like you mentioned:

# using dotenv somewhere in index.js: require('dotenv').config()
echo "CADVISOR_NAMESPACE=default" > .env
npm index.js
# just on the command line
env "CADVISOR_NAMESPACE=default" npm index.js
# in the browser parse the query params as env vars?
http://kubebox.mydomain.com/?CADVISOR_NAMESPACE=default
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kubebox
spec:
  selector:
    matchLabels:
      name: kubebox
  template:
    metadata:
      name: kubebox
    spec:
      serviceAccountName: kubebox
      containers:
      - image: astefanutti/kubebox:server
        name: kubebox
        env:
        - name: CADVISOR_NAMESPACE # EZ in k8s too
           value: default
        ports:
        - containerPort: 8080
          protocol: TCP

@astefanutti
Copy link
Owner

That looks great! I think your proposal would make a very good start!

@593769290
Copy link
Contributor

how about CADVISOR_NAMESPACE just use kubebox namespace ? not to maintain so many namespace.

@astefanutti
Copy link
Owner

@593769290 I've seen people used to create a namespace per application, other having inter-dependent applications into a single namespace. I'd be inclined to think cAdvisor is a rather cross-cutting kind of application, so it may be ok that it's installed in its own namespace.

Anyway I like the idea of leaving that decision to the user, and exposing CADVISOR_NAMESPACE so that it's configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants