diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesCluster.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesCluster.yaml index 39a066a..9b12bdc 100644 --- a/Kubernetes/KubernetesCluster/package/Classes/KubernetesCluster.yaml +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesCluster.yaml @@ -50,6 +50,9 @@ Properties: dockerRegistry: Contract: $.string() + dockerMirror: + Contract: $.string() + serviceEndpoints: Contract: - port: $.int().notNull().check($ > 0) diff --git a/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml index 33d23f7..d5b2e98 100644 --- a/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml +++ b/Kubernetes/KubernetesCluster/package/Classes/KubernetesMinionNode.yaml @@ -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) diff --git a/Kubernetes/KubernetesCluster/package/Resources/KubeMinionSetup.template b/Kubernetes/KubernetesCluster/package/Resources/KubeMinionSetup.template index 6fccb88..c45aedd 100644 --- a/Kubernetes/KubernetesCluster/package/Resources/KubeMinionSetup.template +++ b/Kubernetes/KubernetesCluster/package/Resources/KubeMinionSetup.template @@ -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 \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/restartDocker.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/restartDocker.sh new file mode 100644 index 0000000..006b9ec --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/restartDocker.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +service docker restart \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerMirror.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerMirror.sh new file mode 100644 index 0000000..c9f67dc --- /dev/null +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerMirror.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +source /etc/default/docker +DOCKER_OPTS+=" --registry-mirror=$1" +echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerRegistry.sh b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerRegistry.sh index bde5b5e..22432ef 100644 --- a/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerRegistry.sh +++ b/Kubernetes/KubernetesCluster/package/Resources/scripts/setupDockerRegistry.sh @@ -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 \ No newline at end of file +DOCKER_OPTS+=" --insecure-registry $1" +echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker \ No newline at end of file diff --git a/Kubernetes/KubernetesCluster/package/UI/ui.yaml b/Kubernetes/KubernetesCluster/package/UI/ui.yaml index 55b0bdf..014e4a5 100644 --- a/Kubernetes/KubernetesCluster/package/UI/ui.yaml +++ b/Kubernetes/KubernetesCluster/package/UI/ui.yaml @@ -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: