Unverified Commit b8dc0150 authored by mohammedabdulwahhab's avatar mohammedabdulwahhab Committed by GitHub
Browse files

fix: dockerhub registry issues in dynamo operator (#1350)

parent e83009a6
......@@ -85,10 +85,16 @@ fi
if [[ -n "${DOCKER_USERNAME:-}" && -n "${DOCKER_PASSWORD:-}" ]]; then
echo "Creating/updating Docker registry secret '$DOCKER_SECRET_NAME' in namespace '$NAMESPACE'..."
# Transform docker.io URLs to index.docker.io/v1/
DOCKER_SERVER_FOR_SECRET="$DOCKER_SERVER"
if [[ "$DOCKER_SERVER" == "docker.io" || "$DOCKER_SERVER" == "docker.io/"* ]]; then
DOCKER_SERVER_FOR_SECRET="https://index.docker.io/v1/"
fi
kubectl create secret docker-registry "$DOCKER_SECRET_NAME" \
--docker-username="$DOCKER_USERNAME" \
--docker-password="$DOCKER_PASSWORD" \
--docker-server="$DOCKER_SERVER" \
--docker-server="$DOCKER_SERVER_FOR_SECRET" \
--namespace "$NAMESPACE" \
--dry-run=client -o yaml | kubectl apply -f -
else
......
......@@ -85,6 +85,9 @@ Generate docker config json for registry credentials
*/}}
{{- define "dynamo-operator.dockerconfig" -}}
{{- $server := .Values.dynamo.dockerRegistry.server -}}
{{- if or (eq $server "docker.io") (hasPrefix "docker.io/" $server) -}}
{{- $server = "https://index.docker.io/v1/" -}}
{{- end -}}
{{- $username := .Values.dynamo.dockerRegistry.username -}}
{{- $password := .Values.dynamo.dockerRegistry.password -}}
{{- if .Values.dynamo.dockerRegistry.passwordExistingSecretName -}}
......
......@@ -663,9 +663,6 @@ func (r *DynamoComponentReconciler) getDockerRegistry(ctx context.Context, Dynam
dynamoRepositoryName = dockerRegistryConfig.DynamoComponentsRepositoryName
}
dynamoRepositoryURI := fmt.Sprintf("%s/%s", strings.TrimRight(dockerRegistryConfig.Server, "/"), dynamoRepositoryName)
if strings.Contains(dockerRegistryConfig.Server, "docker.io") {
dynamoRepositoryURI = fmt.Sprintf("docker.io/%s", dynamoRepositoryName)
}
if DynamoComponent != nil && DynamoComponent.Spec.DockerConfigJSONSecretName != "" {
dockerRegistryConfig.SecretName = DynamoComponent.Spec.DockerConfigJSONSecretName
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment