Skip to content

Commit

Permalink
Update to handle non-tls and no cert-url tink server
Browse files Browse the repository at this point in the history
See tinkerbell/tink#567 and tinkerbell/tink#584.

Signed-off-by: Manuel Mendez <[email protected]>
  • Loading branch information
mmlb committed Feb 14, 2022
1 parent 2378606 commit a060aeb
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions bootkit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type tinkConfig struct {

// Grpc stuff (dunno)
grpcAuthority string
grpcCertURL string
tinkerbellTLS string

// Worker ID(s) .. why are there two?
workerID string
Expand Down Expand Up @@ -63,19 +63,23 @@ func main() {
// Generate the path to the tink-worker
imageName := fmt.Sprintf("%s/tink-worker:latest", cfg.registry)

env := []string{
fmt.Sprintf("DOCKER_REGISTRY=%s", cfg.registry),
fmt.Sprintf("REGISTRY_USERNAME=%s", cfg.username),
fmt.Sprintf("REGISTRY_PASSWORD=%s", cfg.password),
fmt.Sprintf("TINKERBELL_GRPC_AUTHORITY=%s", cfg.grpcAuthority),
fmt.Sprintf("WORKER_ID=%s", cfg.workerID),
fmt.Sprintf("ID=%s", cfg.workerID),
fmt.Sprintf("container_uuid=%s", cfg.MetadataID),
}
if cfg.tinkerbellTLS != "" {
env = append(env, fmt.Sprintf("TINKERBELL_TLS=%s", cfg.tinkerbellTLS))
}

// Generate the configuration of the container
tinkContainer := &container.Config{
Image: imageName,
Env: []string{
fmt.Sprintf("DOCKER_REGISTRY=%s", cfg.registry),
fmt.Sprintf("REGISTRY_USERNAME=%s", cfg.username),
fmt.Sprintf("REGISTRY_PASSWORD=%s", cfg.password),
fmt.Sprintf("TINKERBELL_GRPC_AUTHORITY=%s", cfg.grpcAuthority),
fmt.Sprintf("TINKERBELL_CERT_URL=%s", cfg.grpcCertURL),
fmt.Sprintf("WORKER_ID=%s", cfg.workerID),
fmt.Sprintf("ID=%s", cfg.workerID),
fmt.Sprintf("container_uuid=%s", cfg.MetadataID),
},
Image: imageName,
Env: env,
AttachStdout: true,
AttachStderr: true,
}
Expand Down Expand Up @@ -173,8 +177,8 @@ func parseCmdLine(cmdLines []string) (cfg tinkConfig) {
// Find GRPC configuration
case "grpc_authority":
cfg.grpcAuthority = cmdLine[1]
case "grpc_cert_url":
cfg.grpcCertURL = cmdLine[1]
case "tinkerbell_tls":
cfg.tinkerbellTLS = cmdLine[1]
// Find the worker configuration
case "worker_id":
cfg.workerID = cmdLine[1]
Expand Down

0 comments on commit a060aeb

Please sign in to comment.