-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup local registry for faster iteration on self-signer dev
- Loading branch information
1 parent
116b559
commit 65a993d
Showing
5 changed files
with
193 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
CLUSTER_NAME=local | ||
|
||
NETWORK_NAME=k3d-local | ||
|
||
if [ $# -eq 0 ] | ||
then | ||
echo "No arguments supplied: " | ||
echo " up: Start cluster." | ||
echo " --nodes x: The cluster should have x nodes (default 1)" | ||
echo " --version x: The version of Kubernetes (default 1.24.14)" | ||
echo " down: Delete cluster." | ||
|
||
exit 1 | ||
fi | ||
|
||
COMMAND="${1-}" | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
nodes=${environment:-1} | ||
version=${version:-1.24.14} | ||
|
||
while [ $# -gt 0 ]; do | ||
|
||
if [[ $1 == *"--"* ]]; then | ||
param="${1/--/}" | ||
declare $param="$2" | ||
# echo $1 $2 // Optional to see the parameter:value result | ||
fi | ||
|
||
shift | ||
done | ||
|
||
case $COMMAND in | ||
up) | ||
k3d cluster create ${CLUSTER_NAME} \ | ||
--network ${NETWORK_NAME} \ | ||
--registry-config "$SCRIPT_DIR/registries.yaml" \ | ||
--image rancher/k3s:v${version}-k3s1 \ | ||
--agents ${nodes} \ | ||
--k3s-node-label "topology.kubernetes.io/region=us-east-1@agent:0" \ | ||
--k3s-node-label "topology.kubernetes.io/region=us-east-1@server:0" | ||
;; | ||
down) | ||
k3d cluster delete ${CLUSTER_NAME} | ||
;; | ||
*) | ||
echo "Unknown command: $COMMAND" | ||
exit 1; | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
version: "3.3" | ||
|
||
# | ||
# Each proxy needs a 'dns' section added. When it wasn't there, the registries were unable to resolve | ||
# remote DNS names, only DNS names set up within the network of the docker-compose. Here the dns is pointed | ||
# at the Google DNS servers. | ||
# | ||
|
||
services: | ||
registry-localhost: | ||
image: "us-east1-docker.pkg.dev/crl-docker-sync/docker-io/library/registry:2" | ||
restart: "always" | ||
volumes: | ||
- "registry:/var/lib/registry" | ||
ports: | ||
- "5000:5000" | ||
|
||
registry-quayio: | ||
image: "us-east1-docker.pkg.dev/crl-docker-sync/docker-io/library/registry:2" | ||
restart: "always" | ||
dns: | ||
- 8.8.8.8 | ||
volumes: | ||
- "registry:/var/lib/registry" | ||
environment: | ||
REGISTRY_PROXY_REMOTEURL: "https://quay.io/repository" | ||
REGISTRY_COMPATIBILITY_SCHEMA1_ENABLED: "true" | ||
|
||
registry-dockerio: | ||
image: "us-east1-docker.pkg.dev/crl-docker-sync/docker-io/library/registry:2" | ||
restart: "always" | ||
dns: | ||
- 8.8.8.8 | ||
volumes: | ||
- "registry:/var/lib/registry" | ||
environment: | ||
REGISTRY_PROXY_REMOTEURL: "http://registry-1.docker.io" | ||
|
||
registry-us-gcr-io: | ||
image: "us-east1-docker.pkg.dev/crl-docker-sync/docker-io/library/registry:2" | ||
restart: "always" | ||
dns: | ||
- 8.8.8.8 | ||
volumes: | ||
- "registry:/var/lib/registry" | ||
environment: | ||
REGISTRY_PROXY_REMOTEURL: "https://us.gcr.io" | ||
|
||
us-docker-pkg-dev: | ||
image: "us-east1-docker.pkg.dev/crl-docker-sync/docker-io/library/registry:2" | ||
restart: "always" | ||
dns: | ||
- 8.8.8.8 | ||
volumes: | ||
- "registry:/var/lib/registry" | ||
environment: | ||
REGISTRY_PROXY_REMOTEURL: "https://us-docker.pkg.dev" | ||
|
||
volumes: | ||
registry: { } | ||
|
||
networks: | ||
default: | ||
external: true | ||
name: ${DOCKER_NETWORK_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
# Figure out, regardless of any symlinks, aliases, etc, where this script | ||
# is located. | ||
SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done | ||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | ||
|
||
|
||
COMMAND="${1-}" | ||
|
||
DOCKER_REGISTRY_PROJECT_NAME=${2:-k3d-local} | ||
|
||
# The name of the docker network. This must change if it changes in the docker-compose.yaml file. | ||
DOCKER_REGISTRY_NETWORK_NAME=${2:-k3d-local} | ||
|
||
|
||
case $COMMAND in | ||
up) | ||
docker network create --driver bridge ${DOCKER_REGISTRY_NETWORK_NAME} || true | ||
DOCKER_NETWORK_NAME=${DOCKER_REGISTRY_NETWORK_NAME} docker-compose -p ${DOCKER_REGISTRY_PROJECT_NAME} -f ${DIR}/docker-compose.yaml up -d | ||
;; | ||
down) | ||
DOCKER_NETWORK_NAME=${DOCKER_REGISTRY_NETWORK_NAME} docker-compose -p ${DOCKER_REGISTRY_PROJECT_NAME} -f ${DIR}/docker-compose.yaml down | ||
;; | ||
*) | ||
echo "Unknown command: $COMMAND" | ||
exit 1; | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
mirrors: | ||
"localhost:5000": | ||
endpoint: | ||
- "http://registry-localhost:5000" | ||
quay.io: | ||
endpoint: | ||
- "http://registry-quayio:5000" | ||
docker.io: | ||
endpoint: | ||
- "http://registry-dockerio:5000" | ||
us.gcr.io: | ||
endpoint: | ||
- "http://registry-us-gcr-io:5000" | ||
us-docker.pkg.dev: | ||
endpoint: | ||
- "http://us-docker-pkg-dev:5000" |