k8s.io/kubernetes@v1.29.3/test/images/sample-apiserver/Makefile (about)

     1  # Copyright 2020 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  OS ?= linux
    16  ARCH ?= amd64
    17  TARGET ?= $(CURDIR)
    18  GOARM = 7
    19  GOLANG_VERSION ?= latest
    20  SRC_DIR = $(notdir $(shell pwd))
    21  KUBE_CROSS_VERSION ?= $(shell cat ../../../build/build-image/cross/VERSION)
    22  export
    23  
    24  # Build v1.27.1 to ensure the current release supports a prior version of the sample apiserver
    25  # Get without building to populate module cache
    26  # Then, get with OS/ARCH-specific env to build
    27  bin:
    28  	docker run --rm -i -v "${TARGET}:${TARGET}:Z" registry.k8s.io/build-image/kube-cross:${KUBE_CROSS_VERSION} \
    29  		/bin/bash -c "\
    30  			mkdir -p /go/src /go/bin && \
    31  			git clone https://github.com/kubernetes/sample-apiserver /go/src/k8s.io/sample-apiserver && \
    32  			cd /go/src/k8s.io/sample-apiserver && \
    33  			git checkout tags/v0.27.1 && \
    34  			go mod tidy && \
    35  			GO111MODULE=on CGO_ENABLED=0 GOARM=${GOARM} GOOS=${OS} GOARCH=${ARCH} go install . && \
    36  			find /go/bin -name sample-apiserver* -exec cp {} ${TARGET}/sample-apiserver \;"
    37  			# for arm, go install uses /go/bin/linux_arm, so just find the file and copy it to the
    38  			# root so we can copy it out from this throw away container image from a standard location.
    39  			# Windows executables have .exe extension, which is why we're searching sample-apiserver*
    40  
    41  .PHONY: bin