Skip to content

Commit

Permalink
Update cli to sync with k3s
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <[email protected]>
  • Loading branch information
brandond committed Jan 15, 2024
1 parent 5b74716 commit c870d41
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ func Stage(resolver *images.Resolver, nodeConfig *daemonconfig.Node, cfg cmds.Ag
// If we didn't find the requested image in a tarball, pull it from the remote registry.
// Note that this will fail (potentially after a long delay) if the registry cannot be reached.
if img == nil {
registry, err := registries.GetPrivateRegistries(nodeConfig.AgentConfig.PrivateRegistry)
registry, err := registries.GetPrivateRegistries(cfg.PrivateRegistry)
if err != nil {
return "", errors.Wrapf(err, "failed to load private registry configuration from %s", nodeConfig.AgentConfig.PrivateRegistry)
return "", errors.Wrapf(err, "failed to load private registry configuration from %s", cfg.PrivateRegistry)
}
// Override registry config with version provided by (and potentially modified by) k3s agent setup
registry.Registry = nodeConfig.AgentConfig.Registry

// Try to enable Kubelet image credential provider plugins; fall back to legacy docker credentials
if agent.ImageCredProvAvailable(&nodeConfig.AgentConfig) {
Expand All @@ -124,6 +126,8 @@ func Stage(resolver *images.Resolver, nodeConfig *daemonconfig.Node, cfg cmds.Ag
}

logrus.Infof("Pulling runtime image %s", ref.Name())
// Make sure that the runtime image is also loaded into containerd
images.Pull(imagesDir, images.Runtime, ref)
img, err = registry.Image(ref, remote.WithPlatform(v1.Platform{Architecture: runtime.GOARCH, OS: runtime.GOOS}))
if err != nil {
return "", errors.Wrapf(err, "failed to get runtime image %s", ref.Name())
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/cmds/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
"image-credential-provider-config": copyFlag,
"docker": dropFlag,
"container-runtime-endpoint": copyFlag,
"disable-default-registry-endpoint": copyFlag,
"image-service-endpoint": dropFlag,
"pause-image": dropFlag,
"default-runtime": copyFlag,
Expand Down
2 changes: 2 additions & 0 deletions pkg/cli/cmds/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ var (
"image-credential-provider-config": copyFlag,
"docker": dropFlag,
"container-runtime-endpoint": copyFlag,
"disable-default-registry-endpoint": copyFlag,
"embedded-registry": copyFlag,
"pause-image": dropFlag,
"default-runtime": copyFlag,
"private-registry": copyFlag,
Expand Down

0 comments on commit c870d41

Please sign in to comment.