Merge pull request #50831 from Random-Liu/instance-metadata-from-flag

Automatic merge from submit-queue (batch tested with PRs 50693, 50831, 47506, 49119, 50871)

Add instance metadata from flag even when using image config.

Also add instance metadata from flag even when we are using image config.

* Sometimes we need to dynamically generate instance metadata, it's troublesome to put them into image config.
* Sometimes we want to apply instance metadata to all images, it's duplicated to add them to each image in the image config.

/assign @yguo0905 Could you help me review this?
pull/6/head
Kubernetes Submit Queue 2017-08-21 14:29:57 -07:00 committed by GitHub
commit 0867802bbc
1 changed files with 5 additions and 1 deletions

View File

@ -208,11 +208,15 @@ func main() {
images = []string{imageConfig.Image}
}
for _, image := range images {
metadata := imageConfig.Metadata
if len(strings.TrimSpace(*instanceMetadata)) > 0 {
metadata += "," + *instanceMetadata
}
gceImage := internalGCEImage{
image: image,
imageDesc: imageConfig.ImageDesc,
project: imageConfig.Project,
metadata: getImageMetadata(imageConfig.Metadata),
metadata: getImageMetadata(metadata),
machine: imageConfig.Machine,
tests: imageConfig.Tests,
resources: imageConfig.Resources,