@@ -16,28 +16,6 @@ ifneq ($(KIND),"")
16
16
CONFIG = kind
17
17
endif
18
18
19
- # The GCP project ID useful to have when performing operations that require one
20
- # (e.g. release). If you don't have gcloud, all other operations in this
21
- # makefile should still succeed.
22
- #
23
- # We use simple expansion to prevent this from being called every time we need
24
- # the project ID. gcloud prints some noise to stderr, hence the redirect.
25
- PROJECT_ID := ${shell gcloud config get-value project 2>/dev/null}
26
-
27
- # The registry is the location of the image to be built, if any:
28
- #
29
- # * If you are building locally (e.g. 'make deploy'), this is where the image
30
- # will be pushed after it is built, and what the manifest files will use.
31
- # * If you are releasing HNC, this is where the *temporary* image will be
32
- # built. The *final* image will be in HNC_RELEASE_REGISTRY.
33
- #
34
- # By default, we use the Container Registry in the current GCP project, but you
35
- # can set it to anything, UNLESS you are calling 'make release' since the image
36
- # needs to be built in the same project as the GCB instance that builds it.
37
- ifdef PROJECT_ID
38
- HNC_REGISTRY ?= gcr.io/${PROJECT_ID}
39
- endif
40
-
41
19
# The image name is the *base* name - excluding the registry and the tag.
42
20
HNC_IMG_NAME ?= hnc-manager
43
21
@@ -375,88 +353,10 @@ endif
375
353
@sleep 3
376
354
377
355
# ##################### RELEASE ACTIONS #########################
378
- # Build the container image by Cloud Build and build YAMLs locally
379
- HNC_RELEASE_REGISTRY ?= gcr.io/k8s-staging-multitenancy
380
- HNC_RELEASE_IMG = ${HNC_RELEASE_REGISTRY}/${HNC_IMG_NAME}:${HNC_IMG_TAG}
381
- # Override this to release from a different Git repo
382
- HNC_RELEASE_REPO_OWNER ?= kubernetes-sigs
383
-
384
- HNC_GCB_SUBS := _HNC_REGISTRY=${HNC_RELEASE_REGISTRY}
385
- HNC_GCB_SUBS := ${HNC_GCB_SUBS},_HNC_IMG_NAME=${HNC_IMG_NAME}
386
- HNC_GCB_SUBS := ${HNC_GCB_SUBS},_HNC_IMG_TAG=${HNC_IMG_TAG}
387
- HNC_GCB_SUBS := ${HNC_GCB_SUBS},_HNC_USER=${HNC_USER}
388
- HNC_GCB_SUBS := ${HNC_GCB_SUBS},_HNC_PERSONAL_ACCESS_TOKEN=${HNC_PAT}
389
- HNC_GCB_SUBS := ${HNC_GCB_SUBS},_HNC_RELEASE_ID=${HNC_RELEASE_ID}
390
- HNC_GCB_SUBS := ${HNC_GCB_SUBS},_HNC_REPO_OWNER=${HNC_RELEASE_REPO_OWNER}
391
- release : check-release-env
392
- @echo " *********************************************"
393
- @echo " *********************************************"
394
- @echo " Releasing ${HNC_RELEASE_IMG} "
395
- @echo " ... override with HNC_RELEASE_REGISTRY, HNC_IMG_NAME and"
396
- @echo " ... HNC_IMG_TAG."
397
- @echo " Pulling from Github hierarchical-namespaces repo owned by ${HNC_RELEASE_REPO_OWNER} "
398
- @echo " ... override with HNC_RELEASE_REPO_OWNER"
399
- @echo " GCP project: ${PROJECT_ID} (obtained from gcloud)"
400
- @echo " Temporary build image (must be in ${PROJECT_ID} ): ${HNC_IMG} "
401
- @echo " Any existing images with the same tag will be overwritten!"
402
- @echo " "
403
- ifeq (${HNC_FORCE_RELEASE}, true)
404
- @echo "HNC_FORCE_RELEASE IS ENABLED. YOU WILL PROBABLY BE OVERWRITING"
405
- @echo "AN EXISTING RELEASE. ARE YOU REALLY SURE ABOUT THIS????"
406
- @sleep 1
407
- @echo ""
408
- endif
409
- @echo "YOU HAVE FIVE SECONDS TO CANCEL"
410
- @echo "*********************************************"
411
- @echo "*********************************************"
412
- @sleep 5
413
- @echo
414
- @echo "*********************************************"
415
- @echo "*********************************************"
416
- @echo "Starting build."
417
- @echo "*********************************************"
418
- @echo "*********************************************"
419
- gcloud builds submit --config cloudbuild.yaml --no-source --substitutions=${HNC_GCB_SUBS} --timeout=60m
420
- @echo "*********************************************"
421
- @echo "*********************************************"
422
- @echo "Pushing ${HNC_IMG} to ${HNC_RELEASE_IMG}"
423
- @echo "*********************************************"
424
- @echo "*********************************************"
425
- @docker pull ${HNC_IMG}
426
- @docker tag ${HNC_IMG} ${HNC_RELEASE_IMG}
427
- @docker push ${HNC_RELEASE_IMG}
428
-
429
- # Set up error checking variables
430
- ERR_MSG =Ensure that HNC_IMG_TAG (eg v0.1.0), HNC_USER (your Github username), HNC_PAT (Github personal access token) and HNC_RELEASE_ID (Github numeric ID) are set
431
- # During a release, We don't want to overwrite an existing docker image and tag
432
- # so we query the repository to see if the image already exists. This can be
433
- # overridden by setting HNC_FORCE_RELEASE=true
434
- ifeq ($(HNC_FORCE_RELEASE ) , true)
435
- COULDNT_READ_RELEASE_IMG=1
436
- else
437
- COULDNT_READ_RELEASE_IMG=$(shell gcloud container images describe $(HNC_RELEASE_IMG) > /dev/null 2>&1; echo $$?)
438
- endif
439
-
440
- # Actual error checking:
441
- check-release-env :
442
- ifndef HNC_IMG_TAG
443
- $(error HNC_IMG_TAG is undefined, should be vX.X.X; ${ERR_MSG})
444
- endif
445
- ifndef HNC_USER
446
- $(error HNC_USER is undefined; ${ERR_MSG})
447
- endif
448
- ifndef HNC_PAT
449
- $(error HNC_PAT is undefined; ${ERR_MSG})
450
- endif
451
- ifndef HNC_RELEASE_ID
452
- $(error HNC_RELEASE_ID is undefined; ${ERR_MSG})
453
- endif
454
- ifeq ($(COULDNT_READ_RELEASE_IMG ) , 0)
455
- $(error The image ${HNC_RELEASE_IMG} already exists. Force and overwrite this image by using HNC_FORCE_RELEASE=true)
456
- endif
457
356
458
357
# Generate the Krew manifest and put it in manifests/. Note that 'manifests' must exist because
459
358
# krew-build calls krew-tar calls build calls manifests.
359
+ HNC_RELEASE_REPO_OWNER ?= pfnet
460
360
krew-build : krew-tar
461
361
cp hack/krew-kubectl-hns.yaml manifests/krew-kubectl-hns.yaml
462
362
sed -i ' s/HNC_KREW_TAR_SHA256/${HNC_KREW_TAR_SHA256}/' manifests/krew-kubectl-hns.yaml
0 commit comments