@@ -26,16 +26,16 @@ const registryPort = 5000
2626// InitRegistry deploys and starts a new docker registry if necessary
2727func InitRegistry (kubectl * kubernetes.Clientset , helm * helm.HelmClientWrapper ) error {
2828 config := configutil .GetConfig (false )
29- registryConfig := config .Services .Registry
30- registryUser := registryConfig .User
31- registryAuthEncoded := base64 .StdEncoding .EncodeToString ([]byte (* registryUser .Username + ":" + * registryUser .Password ))
29+ registryConfig := config .Image .Registry
30+ internalRegistryConfig := config .Services .InternalRegistry
31+ registryAuth := config .Image .Registry .Auth
32+ registryAuthEncoded := base64 .StdEncoding .EncodeToString ([]byte (* registryAuth .Username + ":" + * registryAuth .Password ))
3233
33- if registryConfig .External == nil {
34- registry := registryConfig .Internal
35- registryReleaseName := * registry .Release .Name
36- registryReleaseNamespace := * registry .Release .Namespace
34+ if registryConfig .URL == nil {
35+ registryReleaseName := * internalRegistryConfig .Release .Name
36+ registryReleaseNamespace := * internalRegistryConfig .Release .Namespace
3737
38- _ , err := helm .InstallChartByName (registryReleaseName , registryReleaseNamespace , "stable/docker-registry" , "" , registry .Release .Values )
38+ _ , err := helm .InstallChartByName (registryReleaseName , registryReleaseNamespace , "stable/docker-registry" , "" , internalRegistryConfig .Release .Values )
3939
4040 if err != nil {
4141 return fmt .Errorf ("Unable to initialize docker registry: %s" , err .Error ())
@@ -64,7 +64,7 @@ func InitRegistry(kubectl *kubernetes.Clientset, helm *helm.HelmClientWrapper) e
6464 oldHtpasswdDataBytes := []byte (oldHtpasswdData )
6565 newHtpasswdData , _ = htpasswd .ParseHtpasswd (oldHtpasswdDataBytes )
6666 }
67- err = newHtpasswdData .SetPassword (* registryUser .Username , * registryUser .Password , htpasswd .HashBCrypt )
67+ err = newHtpasswdData .SetPassword (* registryAuth .Username , * registryAuth .Password , htpasswd .HashBCrypt )
6868
6969 if err != nil {
7070 return fmt .Errorf ("Unable to set password in htpasswd: %s" , err .Error ())
@@ -97,7 +97,7 @@ func InitRegistry(kubectl *kubernetes.Clientset, helm *helm.HelmClientWrapper) e
9797 }
9898
9999 if len (registryService .Spec .ClusterIP ) > 0 {
100- registryConfig . Internal .Host = configutil .String (registryService .Spec .ClusterIP + ":" + strconv .Itoa (registryPort ))
100+ internalRegistryConfig .Host = configutil .String (registryService .Spec .ClusterIP + ":" + strconv .Itoa (registryPort ))
101101 break
102102 }
103103
@@ -165,13 +165,13 @@ func GetImageURL(includingLatestTag bool) string {
165165//GetRegistryHostname returns the hostname of the registry including the port
166166func GetRegistryHostname () string {
167167 config := configutil .GetConfig (false )
168- registryConfig := config .Services .Registry
168+ registryConfig := config .Image .Registry
169169
170- if registryConfig .External != nil {
171- return * registryConfig .External
170+ if registryConfig .URL != nil {
171+ return * registryConfig .URL
172172 }
173173 registryHostname := ""
174- registryReleaseValues := registryConfig . Internal .Release .Values
174+ registryReleaseValues := config . Services . InternalRegistry .Release .Values
175175
176176 if registryReleaseValues != nil {
177177 registryValues := yamlq .NewQuery (* registryReleaseValues )
@@ -188,7 +188,7 @@ func GetRegistryHostname() string {
188188
189189 if len (registryHostname ) == 0 {
190190 registryConfig .Insecure = configutil .Bool (true )
191- registryHostname = * registryConfig . Internal .Host
191+ registryHostname = * config . Services . InternalRegistry .Host
192192 } else {
193193 registryConfig .Insecure = configutil .Bool (false )
194194 }
0 commit comments