rename externalRegistry field from name to host

This commit is contained in:
iwilltry42 2020-12-10 14:34:16 +01:00
parent 46211ae9d3
commit a58785f442
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
3 changed files with 6 additions and 6 deletions

View File

@ -143,7 +143,7 @@ func ClusterPrep(ctx context.Context, runtime k3drt.Runtime, clusterConfig *conf
}
clusterConfig.ClusterCreateOpts.Registries.Use = append(clusterConfig.ClusterCreateOpts.Registries.Use, &k3d.ExternalRegistry{
Name: regNode.Name,
Host: regNode.Name,
Port: k3d.DefaultRegistryPort,
ExternalPort: clusterConfig.ClusterCreateOpts.Registries.Create.Port.Port,
})
@ -154,9 +154,9 @@ func ClusterPrep(ctx context.Context, runtime k3drt.Runtime, clusterConfig *conf
if len(clusterConfig.ClusterCreateOpts.Registries.Use) > 0 {
// ensure that all selected registries exist and connect them to the cluster network
for _, externalReg := range clusterConfig.ClusterCreateOpts.Registries.Use {
regNode, err := runtime.GetNode(ctx, &k3d.Node{Name: externalReg.Name})
regNode, err := runtime.GetNode(ctx, &k3d.Node{Name: externalReg.Host})
if err != nil {
return fmt.Errorf("Failed to find registry node '%s': %+v", externalReg.Name, err)
return fmt.Errorf("Failed to find registry node '%s': %+v", externalReg.Host, err)
}
if err := RegistryConnect(ctx, runtime, regNode, []*k3d.Cluster{&clusterConfig.Cluster}); err != nil {
return fmt.Errorf("Failed to connect registry node '%s' to cluster network: %+v", regNode.Name, err)

View File

@ -136,8 +136,8 @@ func RegistryGenerateK3sConfig(ctx context.Context, internalRegistries *k3d.Regi
regConf := &k3s.Registry{}
for _, reg := range externalRegistries {
internalAddress := fmt.Sprintf("%s:%s", reg.Name, reg.Port)
externalAddress := fmt.Sprintf("%s:%s", reg.Name, reg.ExternalPort)
internalAddress := fmt.Sprintf("%s:%s", reg.Host, reg.Port)
externalAddress := fmt.Sprintf("%s:%s", reg.Host, reg.ExternalPort)
// init mirrors if nil
if regConf.Mirrors == nil {

View File

@ -371,7 +371,7 @@ type Registry struct {
// ExternalRegistry describes a registry that is not managed together with the current cluster -> we only update the registries.yaml
type ExternalRegistry struct {
Name string `yaml:"name" json:"name"`
Host string `yaml:"host" json:"host"`
Port string `yaml:"port" json:"port"`
ExternalPort string `yaml:"externalPort" json:"externalPort"`
Proxy string `yaml:"proxy,omitempty" json:"proxy,omitempty"` // to use the external registry as a proxy for e.g. docker.io