diff --git a/tools/registry/deploy-registry.sh b/tools/registry/deploy-registry.sh index a0091425..fa743bbe 100755 --- a/tools/registry/deploy-registry.sh +++ b/tools/registry/deploy-registry.sh @@ -42,22 +42,16 @@ function kube_cmd { } function await_readiness { - pod_name=$1; - get_pod="kube_cmd get pod $pod_name -o template --template " + rc_name=$1; + template="{{.status.readyReplicas}}/{{.spec.replicas}}" + get_rc="kube_cmd get rc $rc_name -o template --template " - echo "Waiting for $pod_name pod readiness" + echo "Waiting for $rc_name readiness" - template="{{.status.phase}}" - while [ $($get_pod $template) != "Running" ]; do + while $get_rc $template | egrep -v '^(.*)/\1$' > /dev/null; do sleep 3 done - echo "The $pod_name pod is running" - - template="{{range.status.containerStatuses}}{{.ready}}{{end}}" - while [ $($get_pod $template) != "true" ]; do - sleep 3 - done - echo "The $pod_name pod state is ready" + echo "The $rc_name is ready" } if [ -z $NODE ]; then @@ -68,14 +62,14 @@ fi kubectl label node $NODE app=ccp-registry --overwrite function deploy_registry { - kube_cmd apply -f $WORKDIR/registry-pod.yaml + kube_cmd apply -f $WORKDIR/registry-rc.yaml kube_cmd apply -f $WORKDIR/registry-service.yaml await_readiness registry kube_cmd get service registry } function deploy_registry_ui { - cat $WORKDIR/registry-ui-pod.yaml | envsubst | kube_cmd apply -f - + cat $WORKDIR/registry-ui-rc.yaml | envsubst | kube_cmd apply -f - kube_cmd apply -f $WORKDIR/registry-ui-service.yaml await_readiness registry-ui kube_cmd get service registry-ui diff --git a/tools/registry/registry-pod.yaml b/tools/registry/registry-pod.yaml deleted file mode 100644 index 90b14baf..00000000 --- a/tools/registry/registry-pod.yaml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: registry - labels: - app: registry -spec: - containers: - - name: registry - image: registry:2 - imagePullPolicy: Always - ports: - - containerPort: 5000 - hostPort: 5000 - volumeMounts: - - mountPath: /var/lib/registry - name: registry-volume - readinessProbe: - httpGet: - path: /v2/_catalog - port: 5000 - initialDelaySeconds: 3 - timeoutSeconds: 1 - env: - - name: REGISTRY_STORAGE_DELETE_ENABLED - value: "true" - nodeSelector: - app: ccp-registry - volumes: - - name: registry-volume - hostPath: - path: /var/lib/ccp-registry diff --git a/tools/registry/registry-rc.yaml b/tools/registry/registry-rc.yaml new file mode 100644 index 00000000..f5c37f3f --- /dev/null +++ b/tools/registry/registry-rc.yaml @@ -0,0 +1,39 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: registry + labels: + app: registry +spec: + replicas: 1 + template: + metadata: + name: registry + labels: + app: registry + spec: + containers: + - name: registry + image: registry:2 + imagePullPolicy: Always + ports: + - containerPort: 5000 + hostPort: 5000 + volumeMounts: + - mountPath: /var/lib/registry + name: registry-volume + readinessProbe: + httpGet: + path: /v2/_catalog + port: 5000 + initialDelaySeconds: 3 + timeoutSeconds: 1 + env: + - name: REGISTRY_STORAGE_DELETE_ENABLED + value: "true" + nodeSelector: + app: ccp-registry + volumes: + - name: registry-volume + hostPath: + path: /var/lib/ccp-registry diff --git a/tools/registry/registry-ui-pod.yaml b/tools/registry/registry-ui-pod.yaml deleted file mode 100644 index 2c044a90..00000000 --- a/tools/registry/registry-ui-pod.yaml +++ /dev/null @@ -1,30 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: registry-ui - labels: - app: registry-ui -spec: - containers: - - name: registry-ui - image: parabuzzle/docker-registry-ui:latest - imagePullPolicy: Always - ports: - - containerPort: 80 - readinessProbe: - httpGet: - path: / - port: 80 - initialDelaySeconds: 3 - timeoutSeconds: 1 - env: - - name: REGISTRY_ALLOW_DELETE - value: "true" - - name: REGISTRY_HOST - value: "registry.${NAMESPACE}" - - name: REGISTRY_PROTO - value: "http" - - name: REGISTRY_PORT - value: "5000" - nodeSelector: - app: ccp-registry diff --git a/tools/registry/registry-ui-rc.yaml b/tools/registry/registry-ui-rc.yaml new file mode 100644 index 00000000..63b9c36b --- /dev/null +++ b/tools/registry/registry-ui-rc.yaml @@ -0,0 +1,37 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: registry-ui + labels: + app: registry-ui +spec: + replicas: 1 + template: + metadata: + name: registry-ui + labels: + app: registry-ui + spec: + containers: + - name: registry-ui + image: parabuzzle/docker-registry-ui:latest + imagePullPolicy: Always + ports: + - containerPort: 80 + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 3 + timeoutSeconds: 1 + env: + - name: REGISTRY_ALLOW_DELETE + value: "true" + - name: REGISTRY_HOST + value: "registry.${NAMESPACE}" + - name: REGISTRY_PROTO + value: "http" + - name: REGISTRY_PORT + value: "5000" + nodeSelector: + app: ccp-registry