-
Notifications
You must be signed in to change notification settings - Fork 7
/
kubernetes-entrypoint.go
42 lines (36 loc) · 1.35 KB
/
kubernetes-entrypoint.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
34
35
36
37
38
39
40
41
42
package main
import (
"os"
_ "opendev.org/airship/kubernetes-entrypoint/dependencies/config"
_ "opendev.org/airship/kubernetes-entrypoint/dependencies/container"
_ "opendev.org/airship/kubernetes-entrypoint/dependencies/customresource"
_ "opendev.org/airship/kubernetes-entrypoint/dependencies/daemonset"
_ "opendev.org/airship/kubernetes-entrypoint/dependencies/job"
_ "opendev.org/airship/kubernetes-entrypoint/dependencies/pod"
_ "opendev.org/airship/kubernetes-entrypoint/dependencies/service"
_ "opendev.org/airship/kubernetes-entrypoint/dependencies/socket"
entry "opendev.org/airship/kubernetes-entrypoint/entrypoint"
"opendev.org/airship/kubernetes-entrypoint/logger"
command "opendev.org/airship/kubernetes-entrypoint/util/command"
"opendev.org/airship/kubernetes-entrypoint/util/env"
)
func main() {
var comm []string
var entrypoint *entry.Entrypoint
var err error
if entrypoint, err = entry.New(nil); err != nil {
logger.Error.Printf("Creating entrypoint failed: %v", err)
os.Exit(1)
}
entrypoint.Resolve()
if comm = env.SplitCommand(); len(comm) == 0 {
// TODO(DTadrzak): we should consider other options to handle whether pod
// is an init-container
logger.Warning.Printf("COMMAND env is empty")
os.Exit(0)
}
if err = command.Execute(comm); err != nil {
logger.Error.Printf("Cannot execute command: %v", err)
os.Exit(1)
}
}