Skip to content

Commit

Permalink
feat: allow passing image in simpleConfig.Registries.Create
Browse files Browse the repository at this point in the history
  • Loading branch information
flaneur2020 committed Apr 22, 2022
1 parent feeb4c5 commit 3998bdc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/config/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,15 @@ func TransformSimpleToClusterConfig(ctx context.Context, runtime runtimes.Runtim
regName = simpleConfig.Registries.Create.Name
}

image := fmt.Sprintf("%s:%s", k3d.DefaultRegistryImageRepo, k3d.DefaultRegistryImageTag)
if simpleConfig.Registries.Create.Image != "" {
image = simpleConfig.Registries.Create.Image
}

clusterCreateOpts.Registries.Create = &k3d.Registry{
ClusterRef: newCluster.Name,
Host: regName,
Image: fmt.Sprintf("%s:%s", k3d.DefaultRegistryImageRepo, k3d.DefaultRegistryImageTag),
Image: image,
ExposureOpts: *regPort,
}
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/config/v1alpha3/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@
"2345"
],
"default": "random"
},
"image": {
"type": "string",
"examples": [
"myregistry/registry:2"
],
"default": "docker.io/library/registry:2"
}
},
"additionalProperties": false
Expand Down
1 change: 1 addition & 0 deletions pkg/config/v1alpha4/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ type SimpleConfigRegistryCreateConfig struct {
Name string `mapstructure:"name" yaml:"name,omitempty" json:"name,omitempty"`
Host string `mapstructure:"host" yaml:"host,omitempty" json:"host,omitempty"`
HostPort string `mapstructure:"hostPort" yaml:"hostPort,omitempty" json:"hostPort,omitempty"`
Image string `mapstructure:"image" yaml:"image,omitempty" json:"image,omitempty"`
}

// SimpleConfigOptionsKubeconfig describes the set of options referring to the kubeconfig during cluster creation.
Expand Down

0 comments on commit 3998bdc

Please sign in to comment.