k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/cluster/addons/addon-manager/Makefile (about) 1 # Copyright 2016 The Kubernetes Authors. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 IMAGE=gcr.io/k8s-staging-addon-manager/kube-addon-manager 16 ARCH?=amd64 17 TEMP_DIR:=$(shell mktemp -d) 18 VERSION=v9.1.7 19 KUBECTL_VERSION?=v1.27.1 20 21 BASEIMAGE=registry.k8s.io/debian-base-$(ARCH):v1.0.1 22 23 SUDO=$(if $(filter 0,$(shell id -u)),,sudo) 24 25 .PHONY: build push 26 27 all: build 28 29 build: 30 cp ./* $(TEMP_DIR) 31 curl -sSL --retry 5 https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/$(ARCH)/kubectl > $(TEMP_DIR)/kubectl 32 chmod a+rx $(TEMP_DIR)/kube-addons.sh $(TEMP_DIR)/kube-addons-main.sh $(TEMP_DIR)/kubectl 33 34 ifneq ($(ARCH),amd64) 35 # Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel 36 $(SUDO) ../../../third_party/multiarch/qemu-user-static/register/register.sh --reset 37 endif 38 39 docker build --pull -t $(IMAGE)-$(ARCH):$(VERSION) $(TEMP_DIR) --build-arg BASEIMAGE=$(BASEIMAGE) 40 41 push: build 42 docker push $(IMAGE)-$(ARCH):$(VERSION) 43 ifeq ($(ARCH),amd64) 44 # Backward compatibility. TODO: deprecate this image tag 45 docker rmi $(IMAGE):$(VERSION) 2>/dev/null || true 46 docker tag $(IMAGE)-$(ARCH):$(VERSION) $(IMAGE):$(VERSION) 47 docker push $(IMAGE):$(VERSION) 48 endif 49 50 test: 51 cp ./* $(TEMP_DIR) 52 curl -sSL --retry 5 https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/$(ARCH)/kubectl > $(TEMP_DIR)/kubectl 53 chmod a+rx $(TEMP_DIR)/kube-addons.sh $(TEMP_DIR)/kube-addons-test.sh $(TEMP_DIR)/kubectl 54 cd $(TEMP_DIR) && KUBECTL_BIN=$(TEMP_DIR)/kubectl ./kube-addons-test.sh 55 56 clean: 57 docker rmi -f $(IMAGE)-$(ARCH):$(VERSION)