Skip to content

Commit

Permalink
Allow registry, registry username and password to be empty strings (#254
Browse files Browse the repository at this point in the history
)

## Description


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 [this](tinkerbell/tink#607) change to Tink worker, allowing the empty string here provides Tink worker the ability to specify any fully qualified container image in a template. e.g. `docker.io/alpine`, `quay.io/tinkerbell-actions/cexec`, `public.ecr.aws/l0g8r8j6/tinkerbell/pbnj`, etc

This change is backward compatible and shouldn't negatively affect using the Cacher backend.

## Why is this needed



Fixes: #

## How Has This Been Tested?





## How are existing users impacted? What migration steps/scripts do we need?





## Checklist:

I have:

- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
  • Loading branch information
mergify[bot] authored Apr 18, 2022
2 parents de2d781 + 3a3f97b commit 1efcbab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions installers/osie/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
6 changes: 3 additions & 3 deletions installers/osie/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1efcbab

Please sign in to comment.