Use correct port for registry and add missing Eirini configuration
@@ -117,6 +117,16 @@ func (k Eirini) apply(c kubernetes.Cluster, options kubernetes.InstallationOptio
return errors.Wrap(err, fmt.Sprintf("%s failed:\n%s", message, out))
}
+ message = "Adding private registry configuration"
+ out, err = helpers.SpinnerWaitCommand(message,
+ func() (string, error) {
+ return k.patchOpiConfForPrivateRegistry(path.Join(releaseDir, "deploy", "core", "api-configmap.yml"))
+ },
+ )
+ if err != nil {
+ return errors.Wrap(err, fmt.Sprintf("%s failed:\n%s", message, out))
+ }
+
for _, component := range []string{"core", "events", "metrics", "workloads", "workloads/core"} {
message := "Deploying eirini " + component
out, err := helpers.SpinnerWaitCommand(message,
@@ -205,13 +215,15 @@ func (k Eirini) Upgrade(c kubernetes.Cluster, options kubernetes.InstallationOpt
}
func (k Eirini) createClusterRegistryCredsSecret(c kubernetes.Cluster, http bool) error {
- var protocol, secretName string
+ var protocol, secretName, port string
if http {
protocol = "http"
secretName = "cluster-registry-creds"
+ port = "30501"
} else {
protocol = "https"
secretName = "cluster-registry-creds-http"
+ port = "30500"
}
_, err := c.Kubectl.CoreV1().Secrets("eirini-workloads").Create(context.Background(),
&corev1.Secret{
@@ -219,7 +231,7 @@ func (k Eirini) createClusterRegistryCredsSecret(c kubernetes.Cluster, http bool
Name: secretName,
},
StringData: map[string]string{
- ".dockerconfigjson": `{"auths":{"` + protocol + `://127.0.0.1:30501":{"auth": "YWRtaW46cGFzc3dvcmQ=", "username":"admin","password":"password"}}}`,
+ ".dockerconfigjson": `{"auths":{"` + protocol + `://127.0.0.1:` + port + `":{"auth": "YWRtaW46cGFzc3dvcmQ=", "username":"admin","password":"password"}}}`,
},
Type: "kubernetes.io/dockerconfigjson",
}, metav1.CreateOptions{})
@@ -286,3 +298,17 @@ func (k Eirini) patchNamespaceForQuarks(c kubernetes.Cluster, namespace string)
}
return nil
}
+
+func (k Eirini) patchOpiConfForPrivateRegistry(path string) (string, error) {
+ f, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
+ if err != nil {
+ return "", err
+ }
+ defer f.Close()
+
+ _, err = f.WriteString(`
+ registry_secret_name: "cluster-registry-creds-http"
+`)
+
+ return "", err
+}
