Skip to content

Commit b8dc015

Browse files
fix: dockerhub registry issues in dynamo operator (#1350)
1 parent e83009a commit b8dc015

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

deploy/cloud/helm/deploy.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,16 @@ fi
8585
if [[ -n "${DOCKER_USERNAME:-}" && -n "${DOCKER_PASSWORD:-}" ]]; then
8686
echo "Creating/updating Docker registry secret '$DOCKER_SECRET_NAME' in namespace '$NAMESPACE'..."
8787

88+
# Transform docker.io URLs to index.docker.io/v1/
89+
DOCKER_SERVER_FOR_SECRET="$DOCKER_SERVER"
90+
if [[ "$DOCKER_SERVER" == "docker.io" || "$DOCKER_SERVER" == "docker.io/"* ]]; then
91+
DOCKER_SERVER_FOR_SECRET="https://index.docker.io/v1/"
92+
fi
93+
8894
kubectl create secret docker-registry "$DOCKER_SECRET_NAME" \
8995
--docker-username="$DOCKER_USERNAME" \
9096
--docker-password="$DOCKER_PASSWORD" \
91-
--docker-server="$DOCKER_SERVER" \
97+
--docker-server="$DOCKER_SERVER_FOR_SECRET" \
9298
--namespace "$NAMESPACE" \
9399
--dry-run=client -o yaml | kubectl apply -f -
94100
else

deploy/cloud/helm/platform/components/operator/templates/_helpers.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ Generate docker config json for registry credentials
8585
*/}}
8686
{{- define "dynamo-operator.dockerconfig" -}}
8787
{{- $server := .Values.dynamo.dockerRegistry.server -}}
88+
{{- if or (eq $server "docker.io") (hasPrefix "docker.io/" $server) -}}
89+
{{- $server = "https://index.docker.io/v1/" -}}
90+
{{- end -}}
8891
{{- $username := .Values.dynamo.dockerRegistry.username -}}
8992
{{- $password := .Values.dynamo.dockerRegistry.password -}}
9093
{{- if .Values.dynamo.dockerRegistry.passwordExistingSecretName -}}

deploy/cloud/operator/internal/controller/dynamocomponent_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,6 @@ func (r *DynamoComponentReconciler) getDockerRegistry(ctx context.Context, Dynam
663663
dynamoRepositoryName = dockerRegistryConfig.DynamoComponentsRepositoryName
664664
}
665665
dynamoRepositoryURI := fmt.Sprintf("%s/%s", strings.TrimRight(dockerRegistryConfig.Server, "/"), dynamoRepositoryName)
666-
if strings.Contains(dockerRegistryConfig.Server, "docker.io") {
667-
dynamoRepositoryURI = fmt.Sprintf("docker.io/%s", dynamoRepositoryName)
668-
}
669666

670667
if DynamoComponent != nil && DynamoComponent.Spec.DockerConfigJSONSecretName != "" {
671668
dockerRegistryConfig.SecretName = DynamoComponent.Spec.DockerConfigJSONSecretName

0 commit comments

Comments
 (0)