Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions hook-bootkit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ type tinkConfig struct {

// tinkServerTLS is whether or not to use TLS for tink-server communication.
tinkServerTLS string
httpProxy string
httpsProxy string
noProxy string
}

const maxRetryAttempts = 20
Expand Down Expand Up @@ -83,6 +86,9 @@ func main() {
fmt.Sprintf("TINKERBELL_TLS=%s", cfg.tinkServerTLS),
fmt.Sprintf("WORKER_ID=%s", cfg.workerID),
fmt.Sprintf("ID=%s", cfg.workerID),
fmt.Sprintf("HTTP_PROXY=%s", cfg.httpProxy),
fmt.Sprintf("HTTPS_PROXY=%s", cfg.httpsProxy),
fmt.Sprintf("NO_PROXY=%s", cfg.noProxy),
},
AttachStdout: true,
AttachStderr: true,
Expand Down Expand Up @@ -126,6 +132,10 @@ func main() {
time.Sleep(time.Second * 3)
fmt.Println("Starting Communication with Docker Engine")

os.Setenv("HTTP_PROXY", cfg.httpProxy)
os.Setenv("HTTPS_PROXY", cfg.httpsProxy)
os.Setenv("NO_PROXY", cfg.noProxy)

// Create Docker client with API (socket)
ctx := context.Background()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
Expand Down Expand Up @@ -204,6 +214,12 @@ func parseCmdLine(cmdLines []string) (cfg tinkConfig) {
cfg.tinkWorkerImage = cmdLine[1]
case "tinkerbell_tls":
cfg.tinkServerTLS = cmdLine[1]
case "HTTP_PROXY":
cfg.httpProxy = cmdLine[1]
case "HTTPS_PROXY":
cfg.httpsProxy = cmdLine[1]
case "NO_PROXY":
cfg.noProxy = cmdLine[1]
}
}
return cfg
Expand Down
17 changes: 17 additions & 0 deletions hook-docker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
type tinkConfig struct {
syslogHost string
insecureRegistries []string
httpProxy string
httpsProxy string
noProxy string
}

type dockerConfig struct {
Expand Down Expand Up @@ -58,6 +61,14 @@ func main() {
cmd := exec.Command("/usr/local/bin/docker-init", "/usr/local/bin/dockerd")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

myEnvs := make([]string, 0, 3)
myEnvs = append(myEnvs, fmt.Sprintf("HTTP_PROXY=%s", cfg.httpProxy))
myEnvs = append(myEnvs, fmt.Sprintf("HTTPS_PROXY=%s", cfg.httpsProxy))
myEnvs = append(myEnvs, fmt.Sprintf("NO_PROXY=%s", cfg.noProxy))

cmd.Env = append(os.Environ(), myEnvs...)

err = cmd.Run()
if err != nil {
panic(err)
Expand Down Expand Up @@ -90,6 +101,12 @@ func parseCmdLine(cmdLines []string) (cfg tinkConfig) {
cfg.syslogHost = cmdLine[1]
case "insecure_registries":
cfg.insecureRegistries = strings.Split(cmdLine[1], ",")
case "HTTP_PROXY":
cfg.httpProxy = cmdLine[1]
case "HTTPS_PROXY":
cfg.httpsProxy = cmdLine[1]
case "NO_PROXY":
cfg.noProxy = cmdLine[1]
}
}
return cfg
Expand Down