Merge pull request #30 from qiujian16/ensure-kustomize

Add ensure kustomize target
This commit is contained in:
OpenShift Merge Robot
2020-05-18 19:44:44 +02:00
committed by GitHub
3 changed files with 22 additions and 7 deletions

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@ integration.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
_output/

View File

@@ -3,8 +3,6 @@ WORKDIR /go/src/github.com/open-cluster-management/registration
COPY . .
ENV GO_PACKAGE github.com/open-cluster-management/registration
RUN curl -O -L https://github.com/kubernetes-sigs/kustomize/releases/download/v2.0.0/kustomize_2.0.0_linux_amd64; mv kustomize_2.0.0_linux_amd64 kustomize; chmod u+x kustomize; mv kustomize /usr/bin/kustomize
RUN make build --warn-undefined-variables
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1-398

View File

@@ -8,6 +8,7 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
targets/openshift/deps.mk \
targets/openshift/images.mk \
targets/openshift/bindata.mk \
lib/tmp.mk \
)
IMAGE_REGISTRY?=quay.io/open-cluster-management
@@ -15,6 +16,10 @@ IMAGE_TAG?=latest
IMAGE_NAME?=$(IMAGE_REGISTRY)/registration:$(IMAGE_TAG)
KUBECONFIG ?= ./.kubeconfig
KUBECTL?=kubectl
KUSTOMIZE?=$(PERMANENT_TMP_GOPATH)/bin/kustomize
KUSTOMIZE_VERSION?=v3.5.4
KUSTOMIZE_ARCHIVE_NAME?=kustomize_$(KUSTOMIZE_VERSION)_$(GOHOSTOS)_$(GOHOSTARCH).tar.gz
kustomize_dir:=$(dir $(KUSTOMIZE))
$(call add-bindata,spokecluster,./pkg/hub/spokecluster/manifests/...,bindata,bindata,./pkg/hub/spokecluster/bindata/bindata.go)
$(call add-bindata,spokecluster-e2e,./deploy/spoke/...,bindata,bindata,./test/e2e/bindata/bindata.go)
@@ -32,10 +37,10 @@ clean:
$(RM) ./registration
.PHONY: clean
deploy-hub:
deploy-hub: ensure-kustomize
cp deploy/hub/kustomization.yaml deploy/hub/kustomization.yaml.tmp
cd deploy/hub && kustomize edit set image quay.io/open-cluster-management/registration:latest=$(IMAGE_NAME)
kustomize build deploy/hub | kubectl apply -f -
$(KUSTOMIZE) build deploy/hub | kubectl apply -f -
mv deploy/hub/kustomization.yaml.tmp deploy/hub/kustomization.yaml
cluster-ip:
@@ -52,19 +57,30 @@ e2e-bootstrap-secret: cluster-ip
$(KUBECTL) delete secret e2e-bootstrap-secret -n open-cluster-management --ignore-not-found
$(KUBECTL) create secret generic e2e-bootstrap-secret --from-file=kubeconfig=e2e-kubeconfig -n open-cluster-management
deploy-spoke:
deploy-spoke: ensure-kustomize
cp deploy/spoke/kustomization.yaml deploy/spoke/kustomization.yaml.tmp
cd deploy/spoke && kustomize edit set image quay.io/open-cluster-management/registration:latest=$(IMAGE_NAME)
kustomize build deploy/spoke | kubectl apply -f -
$(KUSTOMIZE) build deploy/spoke | kubectl apply -f -
mv deploy/spoke/kustomization.yaml.tmp deploy/spoke/kustomization.yaml
deploy-all: deploy-hub bootstrap-secret deploy-spoke
# test-e2e target is currently a NOP that deploys the hub and self-joins the
# hosting cluster to itself as a spoke; it will be used to prototype e2e in ci.
test-e2e: deploy-hub e2e-bootstrap-secret
test-e2e: ensure-kustomize deploy-hub e2e-bootstrap-secret
go test ./test/e2e -v -ginkgo.v
ensure-kustomize:
ifeq "" "$(wildcard $(KUSTOMIZE))"
$(info Installing kustomize into '$(KUSTOMIZE)')
mkdir -p '$(kustomize_dir)'
curl -s -f -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F$(KUSTOMIZE_VERSION)/$(KUSTOMIZE_ARCHIVE_NAME) -o '$(kustomize_dir)$(KUSTOMIZE_ARCHIVE_NAME)'
tar -C '$(kustomize_dir)' -zvxf '$(kustomize_dir)$(KUSTOMIZE_ARCHIVE_NAME)'
chmod +x '$(KUSTOMIZE)';
else
$(info Using existing kustomize from "$(KUSTOMIZE)")
endif
GO_TEST_PACKAGES :=./pkg/... ./cmd/...
include ./test/integration-test.mk