forked from k8sgateway/k8sgateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.go
33 lines (27 loc) · 911 Bytes
/
flags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package setuputils
import (
"flag"
"os"
"github.com/solo-io/gloo/projects/gloo/pkg/defaults"
)
const (
PodNamespace = "POD_NAMESPACE"
)
var (
setupNamespace string
setupName string
setupDir string
)
// TODO (ilackarms): move to a flags package
func init() {
// Allow for more dynamic setting of settings namespace
// Based on article https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#the-downward-api
defaultNamespace := os.Getenv(PodNamespace)
if defaultNamespace == "" {
defaultNamespace = defaults.GlooSystem
}
flag.StringVar(&setupNamespace, "namespace", defaultNamespace, "namespace to watch for settings crd/file")
flag.StringVar(&setupName, "name", defaults.SettingsName, "name of settings crd/file to use")
flag.StringVar(&setupDir, "dir", "",
"directory to find bootstrap settings if not using kubernetes crds")
}