Add Google Container Registry to DockerStandaloneHost
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: I904110522b482cce56a2fc14ae77eb50064b723f
This commit is contained in:
parent
84e7e83cb6
commit
2d2390cb72
@ -34,6 +34,9 @@ Properties:
|
||||
dockerMirror:
|
||||
Contract: $.string()
|
||||
|
||||
gcloudKey:
|
||||
Contract: $.string()
|
||||
|
||||
applicationEndpoints:
|
||||
Contract:
|
||||
- port: $.int().notNull().check($ > 0)
|
||||
@ -77,6 +80,13 @@ Methods:
|
||||
dockerMirror => $.dockerMirror
|
||||
))
|
||||
- $.instance.agent.call($template, $resources)
|
||||
- If: $.gcloudKey != null and $.gcloudKey != ''
|
||||
Then:
|
||||
- $._environment.reporter.report($this, 'Authenticating to Google Container Registry')
|
||||
- $template: $resources.yaml('LoginToGoogleRegistry.template').bind(dict(
|
||||
gcloudKey => $.gcloudKey
|
||||
))
|
||||
- $.instance.agent.call($template, $resources)
|
||||
- $._environment.reporter.report($this, 'Docker Server is up and running')
|
||||
- $.setAttr(deployed, true)
|
||||
|
||||
|
@ -0,0 +1,30 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
FormatVersion: 2.0.0
|
||||
Version: 1.0.0
|
||||
Name: Login to google registry
|
||||
|
||||
Parameters:
|
||||
gcloudKey: $gcloudKey
|
||||
|
||||
Body: |
|
||||
loginToGoogleRegistry("'{0}'".format(args.gcloudKey))
|
||||
|
||||
Scripts:
|
||||
loginToGoogleRegistry:
|
||||
Type: Application
|
||||
Version: 1.0.0
|
||||
EntryPoint: loginToGoogleRegistry.sh
|
||||
Options:
|
||||
captureStdout: true
|
||||
captureStderr: true
|
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
docker login -e unused@arg.com -u _json_key -p "$1" https://gcr.io
|
@ -18,6 +18,7 @@ Application:
|
||||
name: $.appConfiguration.name
|
||||
dockerRegistry: $.appConfiguration.dockerRegistry
|
||||
dockerMirror: $.appConfiguration.dockerMirror
|
||||
gcloudKey: $.appConfiguration.gcloudKey
|
||||
instance:
|
||||
?:
|
||||
type: io.murano.resources.LinuxMuranoInstance
|
||||
@ -62,6 +63,15 @@ Forms:
|
||||
description: >-
|
||||
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…
Reference in New Issue
Block a user