Merge pull request #57723 from mkumatag/image_manifest

Automatic merge from submit-queue (batch tested with PRs 57322, 57723, 58706, 59004, 58857). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Make the pause image a manifest list

**What this PR does / why we need it**:
Build and push manifest for kubernetes images

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes https://github.com/kubernetes/kubernetes/issues/57869

**Special notes for your reviewer**:

**Release note**:

```
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2018-01-29 20:11:35 -08:00 committed by GitHub
commit b98c515819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 17 deletions

View File

@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: all push push-legacy container clean orphan
.PHONY: all push container clean orphan all-push push-manifest
include ../../hack/make-rules/Makefile.manifest
REGISTRY ?= gcr.io/google_containers
IMAGE = $(REGISTRY)/pause-$(ARCH)
LEGACY_AMD64_IMAGE = $(REGISTRY)/pause
IMAGE = $(REGISTRY)/pause
IMAGE_WITH_ARCH = $(IMAGE)-$(ARCH)
TAG = 3.1
REV = $(shell git describe --contains --always --match='v*')
@ -56,6 +58,11 @@ endif
# If you want to build AND push all containers, see the 'all-push' rule.
all: all-container
all-push: all-push-images push-manifest
push-manifest: manifest-tool
manifest-tool push from-args --platforms $(call join_platforms,$(ALL_ARCH)) --template $(IMAGE)-ARCH:$(TAG) --target $(IMAGE):$(TAG)
sub-container-%:
$(MAKE) ARCH=$* container
@ -64,7 +71,7 @@ sub-push-%:
all-container: $(addprefix sub-container-,$(ALL_ARCH))
all-push: $(addprefix sub-push-,$(ALL_ARCH))
all-push-images: $(addprefix sub-push-,$(ALL_ARCH))
build: bin/$(BIN)-$(ARCH)
@ -79,23 +86,12 @@ bin/$(BIN)-$(ARCH): $(SRCS)
container: .container-$(ARCH)
.container-$(ARCH): bin/$(BIN)-$(ARCH)
docker build --pull -t $(IMAGE):$(TAG) --build-arg ARCH=$(ARCH) .
ifeq ($(ARCH),amd64)
docker rmi $(LEGACY_AMD64_IMAGE):$(TAG) 2>/dev/null || true
docker tag $(IMAGE):$(TAG) $(LEGACY_AMD64_IMAGE):$(TAG)
endif
docker build --pull -t $(IMAGE_WITH_ARCH):$(TAG) --build-arg ARCH=$(ARCH) .
touch $@
push: .push-$(ARCH)
.push-$(ARCH): .container-$(ARCH)
gcloud docker -- push $(IMAGE):$(TAG)
touch $@
push-legacy: .push-legacy-$(ARCH)
.push-legacy-$(ARCH): .container-$(ARCH)
ifeq ($(ARCH),amd64)
gcloud docker -- push $(LEGACY_AMD64_IMAGE):$(TAG)
endif
gcloud docker -- push $(IMAGE_WITH_ARCH):$(TAG)
touch $@
# Useful for testing, not automatically included in container image

View File

@ -0,0 +1,30 @@
# Copyright 2018 The Kubernetes Authors.
#
# 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.
.PHONY: manifest-tool
MANIFEST_TOOL_DIR := $(shell mktemp -d)
export PATH := $(MANIFEST_TOOL_DIR):$(PATH)
MANIFEST_TOOL_VERSION := v0.7.0
space :=
space +=
comma := ,
prefix_linux = $(addprefix linux/,$(strip $1))
join_platforms = $(subst $(space),$(comma),$(call prefix_linux,$(strip $1)))
manifest-tool:
curl -sSL https://github.com/estesp/manifest-tool/releases/download/$(MANIFEST_TOOL_VERSION)/manifest-tool-linux-amd64 > $(MANIFEST_TOOL_DIR)/manifest-tool
chmod +x $(MANIFEST_TOOL_DIR)/manifest-tool