Skip to content

Commit 76a0ed2

Browse files
authored
bug(#1617) : a change in the implementation of feat(1406); (#1618)
1 parent ff235aa commit 76a0ed2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/cluster/clusterCreate.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ func NewCmdClusterCreate() *cobra.Command {
254254
cmd.Flags().String("registry-create", "", "Create a k3d-managed registry and connect it to the cluster (Format: `NAME[:HOST][:HOSTPORT]`\n - Example: `k3d cluster create --registry-create mycluster-registry:0.0.0.0:5432`")
255255
_ = ppViper.BindPFlag("cli.registries.create", cmd.Flags().Lookup("registry-create"))
256256

257+
cmd.Flags().Bool("enforce-registry-port-match", false, "Make the internal registry port match the external one")
258+
_ = ppViper.BindPFlag("cli.registries.create.enforcePortMatch", cmd.Flags().Lookup("enforce-registry-port-match"))
259+
257260
cmd.Flags().StringArray("host-alias", nil, "Add `ip:host[,host,...]` mappings")
258261
_ = ppViper.BindPFlag("hostaliases", cmd.Flags().Lookup("host-alias"))
259262

@@ -329,9 +332,6 @@ func NewCmdClusterCreate() *cobra.Command {
329332
cmd.Flags().StringArray("registry-use", nil, "Connect to one or more k3d-managed registries running locally")
330333
_ = cfgViper.BindPFlag("registries.use", cmd.Flags().Lookup("registry-use"))
331334

332-
cmd.Flags().Bool("enforce-registry-port-match", false, "Make the internal registry port match the external one")
333-
_ = cfgViper.BindPFlag("registries.create.enforcePortMatch", cmd.Flags().Lookup("enforce-registry-port-match"))
334-
335335
cmd.Flags().String("registry-config", "", "Specify path to an extra registries.yaml file")
336336
_ = cfgViper.BindPFlag("registries.config", cmd.Flags().Lookup("registry-config"))
337337
if err := cmd.MarkFlagFilename("registry-config", "yaml", "yml"); err != nil {
@@ -576,6 +576,7 @@ func applyCLIOverrides(cfg conf.SimpleConfig) (conf.SimpleConfig, error) {
576576
if cfg.Registries.Create == nil {
577577
cfg.Registries.Create = &conf.SimpleConfigRegistryCreateConfig{}
578578
}
579+
cfg.Registries.Create.EnforcePortMatch = ppViper.GetBool("cli.registries.create.enforcePortMatch")
579580
cfg.Registries.Create.Name = fvSplit[0]
580581
if len(fvSplit) > 1 {
581582
exposeAPI, err = cliutil.ParsePortExposureSpec(fvSplit[1], k3d.DefaultRegistryPort, cfg.Registries.Create.EnforcePortMatch)

0 commit comments

Comments
 (0)