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: dockerRegistry:
Contract: $.string() Contract: $.string()
dockerMirror:
Contract: $.string()
serviceEndpoints: serviceEndpoints:
Contract: Contract:
- port: $.int().notNull().check($ > 0) - port: $.int().notNull().check($ > 0)

View File

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

View File

@ -19,10 +19,14 @@ Parameters:
ip: $ip ip: $ip
masterIp: $masterIp masterIp: $masterIp
dockerRegistry: $dockerRegistry dockerRegistry: $dockerRegistry
dockerMirror: $dockerMirror
Body: | Body: |
if args.dockerRegistry: if args.dockerRegistry:
setupRegistry(args.dockerRegistry) setupRegistry(args.dockerRegistry)
if args.dockerMirror:
setupMirror(args.dockerMirror)
restartDocker()
setup('{0} {1} {2}'.format(args.name, args.ip, args.masterIp)) setup('{0} {1} {2}'.format(args.name, args.ip, args.masterIp))
Scripts: Scripts:
@ -50,3 +54,20 @@ Scripts:
Options: Options:
captureStdout: true captureStdout: true
captureStderr: 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 #!/bin/bash
source /etc/default/docker source /etc/default/docker
DOCKER_OPTS+=" --registry-mirror=$1" DOCKER_OPTS+=" --insecure-registry $1"
echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker
service docker restart

View File

@ -63,6 +63,7 @@ Application:
gatewayCount: $.appConfiguration.gatewayCount gatewayCount: $.appConfiguration.gatewayCount
gatewayNodes: repeat($gatewayNode, $.appConfiguration.maxGatewayCount) gatewayNodes: repeat($gatewayNode, $.appConfiguration.maxGatewayCount)
dockerRegistry: $.appConfiguration.dockerRegistry dockerRegistry: $.appConfiguration.dockerRegistry
dockerMirror: $.appConfiguration.dockerMirror
Forms: Forms:
@ -164,9 +165,16 @@ Forms:
type: string type: string
label: Custom Docker registry URL label: Custom Docker registry URL
description: >- 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. Leave empty to use Docker default.
required: false 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: - instanceConfiguration:
fields: fields: