Merge "Add custom docker registry to KubernetesCluster"

This commit is contained in:
Jenkins 2015-11-09 17:51:25 +00:00 committed by Gerrit Code Review
commit 84e7e83cb6
7 changed files with 45 additions and 6 deletions

View File

@ -50,6 +50,9 @@ Properties:
dockerRegistry:
Contract: $.string()
dockerMirror:
Contract: $.string()
serviceEndpoints:
Contract:
- port: $.int().notNull().check($ > 0)

View File

@ -84,7 +84,8 @@ Methods:
name => $.instance.name,
ip => $.getIp(),
masterIp => $._cluster.masterNode.getIp(),
dockerRegistry => $._cluster.dockerRegistry
dockerRegistry => $._cluster.dockerRegistry,
dockerMirror => $._cluster.dockerMirror
))
- $.instance.agent.call($template, $resources)
- $.setAttr(nodeConfigured, true)

View File

@ -19,10 +19,14 @@ Parameters:
ip: $ip
masterIp: $masterIp
dockerRegistry: $dockerRegistry
dockerMirror: $dockerMirror
Body: |
if args.dockerRegistry:
setupRegistry(args.dockerRegistry)
if args.dockerMirror:
setupMirror(args.dockerMirror)
restartDocker()
setup('{0} {1} {2}'.format(args.name, args.ip, args.masterIp))
Scripts:
@ -50,3 +54,20 @@ Scripts:
Options:
captureStdout: true
captureStderr: true
setupMirror:
Type: Application
Version: 1.0.0
EntryPoint: setupDockerMirror.sh
Files: []
Options:
captureStdout: true
captureStderr: true
restartDocker:
Type: Application
Version: 1.0.0
EntryPoint: restartDocker.sh
Options:
captureStdout: false
captureStderr: false

View File

@ -0,0 +1,3 @@
#!/bin/bash
service docker restart

View File

@ -0,0 +1,5 @@
#!/bin/bash
source /etc/default/docker
DOCKER_OPTS+=" --registry-mirror=$1"
echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker

View File

@ -1,7 +1,5 @@
#!/bin/bash
source /etc/default/docker
DOCKER_OPTS+=" --registry-mirror=$1"
echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker
service docker restart
DOCKER_OPTS+=" --insecure-registry $1"
echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker

View File

@ -63,6 +63,7 @@ Application:
gatewayCount: $.appConfiguration.gatewayCount
gatewayNodes: repeat($gatewayNode, $.appConfiguration.maxGatewayCount)
dockerRegistry: $.appConfiguration.dockerRegistry
dockerMirror: $.appConfiguration.dockerMirror
Forms:
@ -164,9 +165,16 @@ Forms:
type: string
label: Custom Docker registry URL
description: >-
URL of docker repository mirror to use.
Host IP or domain name of custom Docker registry to use.
Leave empty to use Docker default.
required: false
- name: dockerMirror
type: string
label: Docker registry mirror URL
description: >-
URL of Docker registry mirror to use.
Leave empty to not use one.
required: false
- instanceConfiguration:
fields: