From 4a5618d3233624be16234f68e1c6c227f8cdc763 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Sun, 17 Apr 2022 12:09:21 -0600 Subject: [PATCH 1/2] Allow registry, registry username and password to be empty strings: These values are passed as kernel command line args for OSIE's boot up and then used by Tink worker when it pulls and runs containers. With a recent change Tink worker, allowing the empty string here provides Tink worker the ability to specify any full qualified container image in a template. This change is backward compatible and shouldn't negatively affect using the Cacher backend. Signed-off-by: Jacob Weinstock --- installers/osie/mirror.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installers/osie/mirror.go b/installers/osie/mirror.go index 796beba2..9dedce44 100644 --- a/installers/osie/mirror.go +++ b/installers/osie/mirror.go @@ -52,11 +52,11 @@ func mustBuildOSIEURL() *url.URL { } func buildWorkerParams() { - dockerRegistry = getParam("DOCKER_REGISTRY") + dockerRegistry = os.Getenv("DOCKER_REGISTRY") grpcAuthority = getParam("TINKERBELL_GRPC_AUTHORITY") grpcCertURL = getParam("TINKERBELL_CERT_URL") - registryUsername = getParam("REGISTRY_USERNAME") - registryPassword = getParam("REGISTRY_PASSWORD") + registryUsername = os.Getenv("REGISTRY_USERNAME") + registryPassword = os.Getenv("REGISTRY_PASSWORD") } func getParam(key string) string { From 3a3f97b82eb095c168a8f3bf2703db6486cf68fe Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Mon, 18 Apr 2022 16:12:52 -0600 Subject: [PATCH 2/2] Don't add kernel args if registry values are empty. Signed-off-by: Jacob Weinstock --- installers/osie/main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/installers/osie/main.go b/installers/osie/main.go index 3354955f..d6b82a5c 100644 --- a/installers/osie/main.go +++ b/installers/osie/main.go @@ -114,12 +114,18 @@ func kernelParams(ctx context.Context, action, state string, j job.Job, s ipxe.S if j.CanWorkflow() { buildWorkerParams() - s.Args("docker_registry=" + dockerRegistry) + if dockerRegistry != "" { + s.Args("docker_registry=" + dockerRegistry) + } s.Args("grpc_authority=" + grpcAuthority) s.Args("grpc_cert_url=" + grpcCertURL) s.Args("instance_id=" + j.InstanceID()) - s.Args("registry_username=" + registryUsername) - s.Args("registry_password=" + registryPassword) + if registryUsername != "" { + s.Args("registry_username=" + registryUsername) + } + if registryPassword != "" { + s.Args("registry_password=" + registryPassword) + } s.Args("packet_base_url=" + workflowBaseURL()) s.Args("worker_id=" + j.HardwareID().String()) }