Skip to content

Commit

Permalink
Deprecate the ENV MY_POD_NAMESPACE and MY_POD_NAME
Browse files Browse the repository at this point in the history
And use NamespaceDefault by default
  • Loading branch information
ScorpioCPH committed Jan 26, 2018
1 parent 8caa0c9 commit 43e99c9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
7 changes: 1 addition & 6 deletions cmd/tf_operator/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ var (
)

func Run(opt *options.ServerOption) error {
namespace := os.Getenv("MY_POD_NAMESPACE")
if len(namespace) == 0 {
glog.Fatalf("must set env MY_POD_NAMESPACE")
}

glog.Infof("tf_operator Version: %v", version.Version)
glog.Infof("Git SHA: %s", version.GitSHA)
glog.Infof("Go Version: %s", runtime.Version())
Expand Down Expand Up @@ -103,7 +98,7 @@ func Run(opt *options.ServerOption) error {

rl := &resourcelock.EndpointsLock{
EndpointsMeta: metav1.ObjectMeta{
Namespace: namespace,
Namespace: metav1.NamespaceDefault,
Name: "tf-operator",
},
Client: leaderElectionClient.CoreV1(),
Expand Down
6 changes: 0 additions & 6 deletions developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,8 @@ a K8s cluster. Set your environment:

```sh
export KUBECONFIG=$(echo ~/.kube/config)
export MY_POD_NAMESPACE=default
export MY_POD_NAME=my-pod
```

* MY_POD_NAMESPACE is used because the CRD is namespace scoped and we use the namespace of the controller to
set the corresponding namespace for the resource.
* TODO(jlewi): Do we still need to set MY_POD_NAME? Why?

Now we are ready to run operator locally:

```sh
Expand Down
9 changes: 0 additions & 9 deletions tf-job-operator-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ spec:
{{- end }}
- -alsologtostderr
- -v=1
env:
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
{{- if .Values.config.configmap }}
volumeMounts:
- name: config-volume
Expand Down

0 comments on commit 43e99c9

Please sign in to comment.