Add Google Container Registry to KubernetesCluster
Allow access to Google Container Registry using json key as a password for docker login. The key is scoped to a specific Google Cloud Platform Console project and its resources. Add new field for key. Partially implements: blueprint k8s-google-registry-support Change-Id: Ica71d1a48ac7fb75a71497fcbe318d1b9e4e8192
This commit is contained in:
parent
84e7e83cb6
commit
d082560c46
@ -53,6 +53,9 @@ Properties:
|
|||||||
dockerMirror:
|
dockerMirror:
|
||||||
Contract: $.string()
|
Contract: $.string()
|
||||||
|
|
||||||
|
gcloudKey:
|
||||||
|
Contract: $.string()
|
||||||
|
|
||||||
serviceEndpoints:
|
serviceEndpoints:
|
||||||
Contract:
|
Contract:
|
||||||
- port: $.int().notNull().check($ > 0)
|
- port: $.int().notNull().check($ > 0)
|
||||||
|
@ -85,7 +85,8 @@ Methods:
|
|||||||
ip => $.getIp(),
|
ip => $.getIp(),
|
||||||
masterIp => $._cluster.masterNode.getIp(),
|
masterIp => $._cluster.masterNode.getIp(),
|
||||||
dockerRegistry => $._cluster.dockerRegistry,
|
dockerRegistry => $._cluster.dockerRegistry,
|
||||||
dockerMirror => $._cluster.dockerMirror
|
dockerMirror => $._cluster.dockerMirror,
|
||||||
|
gcloudKey => $._cluster.gcloudKey
|
||||||
))
|
))
|
||||||
- $.instance.agent.call($template, $resources)
|
- $.instance.agent.call($template, $resources)
|
||||||
- $.setAttr(nodeConfigured, true)
|
- $.setAttr(nodeConfigured, true)
|
||||||
|
@ -20,12 +20,15 @@ Parameters:
|
|||||||
masterIp: $masterIp
|
masterIp: $masterIp
|
||||||
dockerRegistry: $dockerRegistry
|
dockerRegistry: $dockerRegistry
|
||||||
dockerMirror: $dockerMirror
|
dockerMirror: $dockerMirror
|
||||||
|
gcloudKey: $gcloudKey
|
||||||
|
|
||||||
Body: |
|
Body: |
|
||||||
if args.dockerRegistry:
|
if args.dockerRegistry:
|
||||||
setupRegistry(args.dockerRegistry)
|
setupRegistry(args.dockerRegistry)
|
||||||
if args.dockerMirror:
|
if args.dockerMirror:
|
||||||
setupMirror(args.dockerMirror)
|
setupMirror(args.dockerMirror)
|
||||||
|
if args.gcloudKey:
|
||||||
|
loginToGoogleRegistry("'{0}'".format(args.gcloudKey))
|
||||||
restartDocker()
|
restartDocker()
|
||||||
setup('{0} {1} {2}'.format(args.name, args.ip, args.masterIp))
|
setup('{0} {1} {2}'.format(args.name, args.ip, args.masterIp))
|
||||||
|
|
||||||
@ -64,6 +67,15 @@ Scripts:
|
|||||||
captureStdout: true
|
captureStdout: true
|
||||||
captureStderr: true
|
captureStderr: true
|
||||||
|
|
||||||
|
loginToGoogleRegistry:
|
||||||
|
Type: Application
|
||||||
|
Version: 1.0.0
|
||||||
|
EntryPoint: loginToGoogleRegistry.sh
|
||||||
|
Files: []
|
||||||
|
Options:
|
||||||
|
captureStdout: true
|
||||||
|
captureStderr: true
|
||||||
|
|
||||||
restartDocker:
|
restartDocker:
|
||||||
Type: Application
|
Type: Application
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker login -e unused@arg.com -u _json_key -p "$1" https://gcr.io
|
@ -64,6 +64,7 @@ Application:
|
|||||||
gatewayNodes: repeat($gatewayNode, $.appConfiguration.maxGatewayCount)
|
gatewayNodes: repeat($gatewayNode, $.appConfiguration.maxGatewayCount)
|
||||||
dockerRegistry: $.appConfiguration.dockerRegistry
|
dockerRegistry: $.appConfiguration.dockerRegistry
|
||||||
dockerMirror: $.appConfiguration.dockerMirror
|
dockerMirror: $.appConfiguration.dockerMirror
|
||||||
|
gcloudKey: $.appConfiguration.gcloudKey
|
||||||
|
|
||||||
|
|
||||||
Forms:
|
Forms:
|
||||||
@ -175,6 +176,16 @@ Forms:
|
|||||||
URL of Docker registry mirror to use.
|
URL of Docker registry mirror to use.
|
||||||
Leave empty to not use one.
|
Leave empty to not use one.
|
||||||
required: false
|
required: false
|
||||||
|
- name: gcloudKey
|
||||||
|
type: string
|
||||||
|
label: Google registry key
|
||||||
|
regexpValidator: '^{(\s*"(\\(["\\\/bfnrt]|u[a-fA-F0-9]{4})|[^"\\\0-\x1F\x7F]+)*"\s*:\s*"(\\(["\\\/bfnrt]|u[a-fA-F0-9]{4})|[^"\\\0-\x1F\x7F]+)*"\s*(,|\s*}$))*$'
|
||||||
|
errorMessages:
|
||||||
|
invalid: Text should be a valid JSON.
|
||||||
|
description: >-
|
||||||
|
Contents of JSON key file.
|
||||||
|
Used to authenticate to the Google Container Registry
|
||||||
|
required: false
|
||||||
|
|
||||||
- instanceConfiguration:
|
- instanceConfiguration:
|
||||||
fields:
|
fields:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user