Open brennantaylor opened 4 years ago
Thanks a lot for the suggestion. That makes totally sense.
I see a couple of options:
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;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?
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
That looks great! I think your proposal would make a very good start!
how about CADVISOR_NAMESPACE just use kubebox namespace ? not to maintain so many namespace.
@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.
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.