Skip to content

Instantly share code, notes, and snippets.

@miminar
Last active December 11, 2017 14:50
Show Gist options
  • Save miminar/7b9a92d6c33f875993bbbe8dc66ecd96 to your computer and use it in GitHub Desktop.
Save miminar/7b9a92d6c33f875993bbbe8dc66ecd96 to your computer and use it in GitHub Desktop.
Re-deploy docker-registry as insecure

Re-deploy docker-registry in the same namespace as insecure

Motivation

Debug networking.

Prerequisites

  • docker-registry deployed in the current namespace
  • jq binary installed and present in PATH

Steps

filter='(.spec.template.spec.containers[0] |= ((.livenessProbe.httpGet.scheme |= "HTTP") |'
filter+=' (.readinessProbe.httpGet.scheme |= "HTTP"))) |'
filter+=' del(.status) | .metadata |= {"name": "\(.name)-tmp", "labels": {"docker-registry":"secondary"}}'
oc get -o json dc/docker-registry | \
    oc env -f - -o json REGISTRY_HTTP_TLS_CERTIFICATE- REGISTRY_HTTP_TLS_KEY- | \
    jq "${filter}" | oc create -f -
oc expose dc/docker-registry-tmp
# wait until deployed
oc rollout status dc/docker-registry-tmp
# verify it's accessible:
hostport="$(oc get -o jsonpath=$'{.spec.clusterIP}:{.spec.ports[0].port}\n' svc/docker-registry-tmp)"
curl "http://${hostport}/v2/"
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment