Skip to content

Commit

Permalink
Merge pull request #78 from vdice/update-docs-and-makefile
Browse files Browse the repository at this point in the history
ref(*): update docs and Makefile
  • Loading branch information
Vaughn Dice authored Jan 3, 2017
2 parents fe50d7a + f2bc3ae commit 86f06d7
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 153 deletions.
36 changes: 4 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Short name: Short name, following [a-zA-Z_], used all over the place.
# Some uses for short name:
# - Docker image name
# - Kubernetes service, rc, pod, secret, volume names
# - Kubernetes service, deployment, pod names
SHORT_NAME := registry

include includes.mk versioning.mk
Expand All @@ -25,11 +25,6 @@ ifeq ($(STORAGE_TYPE),)
STORAGE_TYPE = fs
endif

# Kubernetes-specific information for Secret, RC, Service, and Image.
SECRET := contrib/kubernetes/manifests/${SHORT_NAME}-${STORAGE_TYPE}-secret.yaml
RC := contrib/kubernetes/manifests/${SHORT_NAME}-rc.yaml
SVC := contrib/kubernetes/manifests/${SHORT_NAME}-service.yaml

all:
@echo "Use a Makefile to control top-level building of the project."

Expand All @@ -43,38 +38,15 @@ docker-build: check-docker build
docker build --rm -t ${IMAGE} rootfs
docker tag ${IMAGE} ${MUTABLE_IMAGE}

# Push to a registry that Kubernetes can access.
docker-push: check-docker
docker push ${IMAGE}

build-binary:
${DEV_ENV_CMD} go build -ldflags ${LDFLAGS} -o $(BINDIR)/${SHORT_NAME} main.go
$(call check-static-binary,$(BINDIR)/${SHORT_NAME})
${DEV_ENV_CMD} upx -9 --brute $(BINDIR)/${SHORT_NAME}

# Deploy is a Kubernetes-oriented target
deploy: kube-secret kube-service kube-rc

kube-secret: check-kubectl
kubectl create -f ${SECRET}

# Some things, like services, have to be deployed before pods. This is an
# example target. Others could perhaps include kube-volume, etc.
kube-service: check-kubectl
kubectl create -f ${SVC}

# When possible, we deploy with RCs.
kube-rc: check-kubectl
kubectl create -f ${RC}

kube-clean: check-kubectl
kubectl delete rc ${SHORT_NAME}

test: check-docker
contrib/ci/test.sh ${IMAGE}

update-manifests:
sed 's#\(image:\) .*#\1 $(IMAGE)#' contrib/kubernetes/manifests/${SHORT_NAME}-rc.yaml \
> ${RC}
deploy: check-kubectl docker-build docker-push
kubectl --namespace=deis patch deployment deis-$(SHORT_NAME) --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value":"$(IMAGE)"}]'

.PHONY: all build kube-up kube-down deploy
.PHONY: all build build-binary docker-build test deploy
46 changes: 3 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The registry is a [Docker registry](https://docs.docker.com/registry/) component

If you decide to use this component standalone, you can host your own Docker registry in your own Kubernetes cluster.

The Docker image that this repository builds is based on [Alpine Linux](http://www.alpinelinux.org/) and uses [the Deis fork](https://github.com/deis/distribution) of [the official Docker v2 registry code](https://github.com/docker/distribution).
The Docker image that this repository builds is based on [the official Docker v2 registry image](https://github.com/docker/distribution).

# Development

Expand Down Expand Up @@ -53,52 +53,12 @@ To build and push the image run:
$ make docker-build docker-push
```

Before deploying your custom image you must update the container image specification in the pod manifest. This file is found at `contrib/kubernetes/manifests/registry-rc.yaml`:
To deploy the image via patching the registry deployment run:

```yaml
- name: registry
image: quay.io/youruser/registry:git-f5c7dc3
env:
- name: REGISTRY_STORAGE_DELETE_ENABLED
value: "true"
```
By default registry uses the filesystem as the storage medium. To use a custom object store like s3, gcs or azure:
- First provide the details required for authenticating to object store in base64 format by updating the secret file which can be found at `contrib/kubernetes/manifests/registry-{STORAGE_TYPE}-secret.yaml`.
- Update the storage type and secret to be used in the pod manifest. This file is found at `contrib/kubernetes/manifests/registry-rc.yaml`:
```yaml
- name: REGISTRY_STORAGE
value: filesystem
- name: registry-creds
secret:
secretName: fs-keyfile
```
- Set the STORAGE_TYPE environment variable.
```
$ export STORAGE_TYPE = {s3/gcs/azure}
```

Once updated, deploy the registry to your kubernetes cluster with:

```
```console
$ make deploy
```

After a while, you should see one pod up with one running:

```
NAME READY STATUS RESTARTS AGE
registry-6wy8o 1/1 Running 0 32s
```

You can then interact with this pod as you would with any other Kubernetes pod:

```
$ kubectl logs -f registry-6wy8o
$ kubectl exec -it registry-6wy8o sh
```

## License

© 2014, 2015, 2016 Engine Yard, Inc.
Expand Down
9 changes: 0 additions & 9 deletions contrib/kubernetes/manifests/registry-azure-secret.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions contrib/kubernetes/manifests/registry-fs-secret.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions contrib/kubernetes/manifests/registry-gcs-secret.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions contrib/kubernetes/manifests/registry-rc.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions contrib/kubernetes/manifests/registry-s3-secret.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions contrib/kubernetes/manifests/registry-service.yaml

This file was deleted.

0 comments on commit 86f06d7

Please sign in to comment.