change: no default image for node creation in local cluster where image should be copied from existing nodes (#1034)

pull/1035/head
Thorsten Klein 2 years ago committed by GitHub
parent 258e953487
commit 15d7dc9c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      cmd/node/nodeCreate.go
  2. 5
      pkg/client/node.go

@ -35,7 +35,6 @@ import (
l "github.com/k3d-io/k3d/v5/pkg/logger"
"github.com/k3d-io/k3d/v5/pkg/runtimes"
k3d "github.com/k3d-io/k3d/v5/pkg/types"
"github.com/k3d-io/k3d/v5/version"
)
// NewCmdNodeCreate returns a new cobra command
@ -77,7 +76,7 @@ func NewCmdNodeCreate() *cobra.Command {
l.Log().Fatalln("Failed to register flag completion for '--cluster'", err)
}
cmd.Flags().StringP("image", "i", fmt.Sprintf("%s:%s", k3d.DefaultK3sImageRepo, version.K3sVersion), "Specify k3s image used for the node(s)")
cmd.Flags().StringP("image", "i", "", "Specify k3s image used for the node(s) (default: copied from existing node)")
cmd.Flags().String("memory", "", "Memory limit imposed on the node [From docker]")
cmd.Flags().BoolVar(&createNodeOpts.Wait, "wait", true, "Wait for the node(s) to be ready before returning.")

@ -45,6 +45,7 @@ import (
"github.com/k3d-io/k3d/v5/pkg/runtimes"
"github.com/k3d-io/k3d/v5/pkg/runtimes/docker"
runtimeTypes "github.com/k3d-io/k3d/v5/pkg/runtimes/types"
"github.com/k3d-io/k3d/v5/version"
runtimeErrors "github.com/k3d-io/k3d/v5/pkg/runtimes/errors"
k3d "github.com/k3d-io/k3d/v5/pkg/types"
@ -283,6 +284,10 @@ func NodeAddToClusterRemote(ctx context.Context, runtime runtimes.Runtime, node
node.RuntimeLabels[k3d.LabelClusterExternal] = "true"
node.RuntimeLabels[k3d.LabelClusterToken] = createNodeOpts.ClusterToken
if node.Image == "" { // we don't set a default, because on local clusters the value is copied from existing nodes
node.Image = fmt.Sprintf("%s:%s", k3d.DefaultK3sImageRepo, version.K3sVersion)
}
if node.Env == nil {
node.Env = []string{}
}

Loading…
Cancel
Save