mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 07:03:31 +00:00
allow kubectl to be built statically
* Package kubectl in a container * Add example with a pod using kubectl as a sidecar
This commit is contained in:
30
examples/kubectl-container/Makefile
Normal file
30
examples/kubectl-container/Makefile
Normal file
@@ -0,0 +1,30 @@
|
||||
# Use:
|
||||
#
|
||||
# `make kubectl` will build kubectl.
|
||||
# `make tag` will suggest a tag.
|
||||
# `make container` will build a container-- you must supply a tag.
|
||||
# `make push` will push the container-- you must supply a tag.
|
||||
|
||||
kubectl:
|
||||
KUBE_STATIC_OVERRIDES="kubectl" ../../hack/build-go.sh cmd/kubectl; cp ../../_output/local/bin/linux/amd64/kubectl .
|
||||
|
||||
.tag: kubectl
|
||||
./kubectl version -c | grep -o 'GitVersion:"[^"]*"' | cut -f 2 -d '"' > .tag
|
||||
|
||||
tag: .tag
|
||||
@echo "Suggest using TAG=$(shell cat .tag)"
|
||||
@echo "$$ make container TAG=$(shell cat .tag)"
|
||||
@echo "or"
|
||||
@echo "$$ make push TAG=$(shell cat .tag)"
|
||||
|
||||
container:
|
||||
$(if $(TAG),,$(error TAG is not defined. Use 'make tag' to see a suggestion))
|
||||
docker build -t gcr.io/google_containers/kubectl:$(TAG) .
|
||||
|
||||
push: container
|
||||
$(if $(TAG),,$(error TAG is not defined. Use 'make tag' to see a suggestion))
|
||||
gcloud preview docker push gcr.io/google_containers/kubectl:$(TAG)
|
||||
|
||||
clean:
|
||||
rm -f kubectl
|
||||
rm -f .tag
|
Reference in New Issue
Block a user