Skip to content

Instantly share code, notes, and snippets.

@Miciah
Created January 21, 2016 18:48
Show Gist options
  • Save Miciah/0ac4a9837c3d12ae8aae to your computer and use it in GitHub Desktop.
Save Miciah/0ac4a9837c3d12ae8aae to your computer and use it in GitHub Desktop.
# Based on <https://github.com/openshift/openshift-ansible/tree/master/playbooks/adhoc/s3_registry>.
# Deploy the image registry:
oadm registry --config=/openshift.local.config/master/admin.kubeconfig --credentials=/openshift.local.config/master/openshift-registry.kubeconfig
# Scale the image registry down:
oc scale --replicas=0 dc/docker-registry
# Write out configuration:
cat > /root/config.yml <<EOF
version: 0.1
log:
level: debug
http:
addr: :5000
storage:
cache:
layerinfo: inmemory
s3:
accesskey: ${AWS_CONF[AWSAccessKeyId]}
secretkey: ${AWS_CONF[AWSSecretKey]}
region: $REGION
bucket: $BUCKET
encrypt: true
secure: true
v4auth: true
rootdirectory: /registry
middleware:
repository:
- name: openshift
EOF
# Add a secret containing the image-registry configuration:
oc secrets new dockerregistry /root/config.yml
# Add a secrets volume with the new secret to the image registry:
oc volume dc/docker-registry --add --name=dockersecrets -m /etc/registryconfig --type=secret --secret-name=dockerregistry
# Configure the image registry to use new configuration file:
oc env dc/docker-registry REGISTRY_CONFIGURATION_PATH=/etc/registryconfig/config.yml
# Scale the image registry back up:
oc scale --replicas=1 dc/docker-registry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment