-
Notifications
You must be signed in to change notification settings - Fork 698
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
Scope tf-operator to a namespace #789
Scope tf-operator to a namespace #789
Conversation
Based on the KUBEFLOW_NAMESPACE, tf-operator will be scoped to a particular namespace. If KUBEFLOW_NAMESPACE is not set or left as empty, tf-operator will be scoped to cluster-wide. If it is set to a namespace value, tf-operator will only operate in the namespace
Once we merge this, we can create a new image and then I will update the tfjob prototype to parametrize this. |
/retest |
/lgtm |
/retest |
Why an environment variable and not a command line option? A command line option seems more discoverable to me; e.g. run the binary with --help. And in the intended use case we aren't really inheriting namespace from the environment. I think of the namespace as something we will explicitly set as opposed to something that will be inherited e.g. the NAMESPACE of the pod. I don't think we want the namespace the operator is handling to be the same as the namespace the operator is running in. This should allow further separation between "core kubeflow" and user space. |
Done. |
/retest |
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM.
cmd/tf-operator.v2/app/server.go
Outdated
@@ -65,6 +65,12 @@ func Run(opt *options.ServerOption) error { | |||
log.Infof("EnvKubeflowNamespace not set, use default namespace") | |||
namespace = metav1.NamespaceDefault | |||
} | |||
if len(opt.Namespace) == 0 { | |||
opt.Namespace = v1.NamespaceAll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about set the default value in fs.StringVar()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -40,6 +41,10 @@ func (s *ServerOption) AddFlags(fs *flag.FlagSet) { | |||
`The url of the Kubernetes API server, | |||
will overrides any value in kubeconfig, only required if out-of-cluster.`) | |||
|
|||
fs.StringVar(&s.Namespace, "namespace", "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can set default value as v1.NamespaceAll
here.
nit: please update the PR description to reflect the fact its an argument now not an environment variable. |
Addressed comments. PTAL. |
Looks like some transient SSL error failure
/test all |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jlewi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Based on the KUBEFLOW_NAMESPACE, tf-operator will be scoped to a
particular namespace.
If
--namespace
flag is not set or left as empty, tf-operator will bescoped to cluster-wide. If it is set to a namespace value, tf-operator
will only operate in the namespace
Fixes #759
/cc @gaocegege @jlewi
This change is