Skip to content

Instantly share code, notes, and snippets.

@cwilkers
Created February 27, 2020 14:23
Show Gist options
  • Save cwilkers/3585c0a619f8562aa22d7ff65c07bc38 to your computer and use it in GitHub Desktop.
Save cwilkers/3585c0a619f8562aa22d7ff65c07bc38 to your computer and use it in GitHub Desktop.
Fix for reaching image registry with unknown CA from devel ocp
#!/bin/bash
REGISTRY=registry-proxy.engineering.redhat.com
true | openssl s_client -showcerts -connect ${REGISTRY}:443 2>/dev/null | openssl x509 > ca.crt
oc create configmap registry-cas -n openshift-config --from-file=${REGISTRY}=ca.crt
oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-cas"}}}' --type=merge
oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"storage":{"emptyDir":{}}}}'
oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"managementState":"Managed"}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment