From f2855617e57dacdebf60c8b3a4121794d78fafd8 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Fri, 8 May 2020 10:56:53 -0400 Subject: [PATCH] Streamline dev deployment --- .gitignore | 1 + Makefile | 13 +++++++++++++ README.md | 16 +++------------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index cad32d17c..733329f73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Binaries for programs and plugins registration +dev-kubeconfig *.exe *.dll *.so diff --git a/Makefile b/Makefile index 393802013..9d78805d2 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \ ) IMAGE_REGISTRY?=quay.io +KUBECONFIG ?= ./.kubeconfig $(call add-bindata,spokecluster,./pkg/hub/spokecluster/manifests/...,bindata,bindata,./pkg/hub/spokecluster/bindata/bindata.go) # This will call a macro called "build-image" which will generate image specific targets based on the parameters: @@ -29,9 +30,21 @@ clean: deploy-hub: kustomize build deploy/hub | kubectl apply -f - +cluster-ip: + CLUSTER_IP?=$(shell kubectl get svc kubernetes -n default -o jsonpath="{.spec.clusterIP}") + +bootstrap-secret: cluster-ip + cp $(KUBECONFIG) dev-kubeconfig + kubectl config set clusters.kind-kind.server https://$(CLUSTER_IP) --kubeconfig dev-kubeconfig + kubectl create secret generic bootstrap-secret --from-file=kubeconfig=dev-kubeconfig -n open-cluster-management + deploy-spoke: kustomize build deploy/spoke | kubectl apply -f - +# 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 bootstrap-secret deploy-spoke + GO_TEST_PACKAGES :=./pkg/... ./cmd/... include ./test/integration-test.mk diff --git a/README.md b/README.md index b34a04bab..0b2ec9652 100644 --- a/README.md +++ b/README.md @@ -24,24 +24,14 @@ You can reach the maintainers of this project at: Check the [Development Doc](docs/development.md) for how to contribute to the repo. ## How to Deploy + ### Deploy Hub + 1. Run `make deploy-hub` ### Deploy Spoke -1. Create a bootstrap kubeconfig secret in the namespace of `open-cluster-management`. -Ensure the server field in kubeconfig is accesible from cluster. - In a kind environment where hub and spoke component is deployed in one cluster, default kubernetes cluster ip can be used. - - ```sh - cp ~/.kube/config //kubeconfig - clusterIP=$(kubectl get svc kubernetes -n default -o jsonpath="{.spec.clusterIP}") - kubectl config set clusters.kind-kind.server https://$clusterIP --kubeconfig //kubeconfig - ``` - Then run the following command - ```sh - kubectl create secret generic bootstrap-secret --from-file=kubeconfig=//kubeconfig -n open-cluster-management - ``` +1. Run `make bootstrap-secret` 2. Run `make deploy-spoke` ## Security Response