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:
|
||||
Contract: $.string()
|
||||
|
||||
gcloudKey:
|
||||
Contract: $.string()
|
||||
|
||||
serviceEndpoints:
|
||||
Contract:
|
||||
- port: $.int().notNull().check($ > 0)
|
||||
|
@ -85,7 +85,8 @@ Methods:
|
||||
ip => $.getIp(),
|
||||
masterIp => $._cluster.masterNode.getIp(),
|
||||
dockerRegistry => $._cluster.dockerRegistry,
|
||||
dockerMirror => $._cluster.dockerMirror
|
||||
dockerMirror => $._cluster.dockerMirror,
|
||||
gcloudKey => $._cluster.gcloudKey
|
||||
))
|
||||
- $.instance.agent.call($template, $resources)
|
||||
- $.setAttr(nodeConfigured, true)
|
||||
|
@ -20,12 +20,15 @@ Parameters:
|
||||
masterIp: $masterIp
|
||||
dockerRegistry: $dockerRegistry
|
||||
dockerMirror: $dockerMirror
|
||||
gcloudKey: $gcloudKey
|
||||
|
||||
Body: |
|
||||
if args.dockerRegistry:
|
||||
setupRegistry(args.dockerRegistry)
|
||||
if args.dockerMirror:
|
||||
setupMirror(args.dockerMirror)
|
||||
if args.gcloudKey:
|
||||
loginToGoogleRegistry("'{0}'".format(args.gcloudKey))
|
||||
restartDocker()
|
||||
setup('{0} {1} {2}'.format(args.name, args.ip, args.masterIp))
|
||||
|
||||
@ -64,6 +67,15 @@ Scripts:
|
||||
captureStdout: true
|
||||
captureStderr: true
|
||||
|
||||
loginToGoogleRegistry:
|
||||
Type: Application
|
||||
Version: 1.0.0
|
||||
EntryPoint: loginToGoogleRegistry.sh
|
||||
Files: []
|
||||
Options:
|
||||
captureStdout: true
|
||||
captureStderr: true
|
||||
|
||||
restartDocker:
|
||||
Type: Application
|
||||
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)
|
||||
dockerRegistry: $.appConfiguration.dockerRegistry
|
||||
dockerMirror: $.appConfiguration.dockerMirror
|
||||
gcloudKey: $.appConfiguration.gcloudKey
|
||||
|
||||
|
||||
Forms:
|
||||
@ -175,6 +176,16 @@ Forms:
|
||||
URL of Docker registry mirror to use.
|
||||
Leave empty to not use one.
|
||||
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:
|
||||
fields:
|
||||
|
Loading…
x
Reference in New Issue
Block a user