From b49b80b80c3bc67973e29923246bbff86b2620f2 Mon Sep 17 00:00:00 2001 From: Paolo Dettori Date: Sun, 21 Mar 2021 20:36:18 -0400 Subject: [PATCH] updated to use kind v. > v 0.7 Signed-off-by: Paolo Dettori --- Makefile | 23 +++++++++++-------- ...cluster-manager.clusterserviceversion.yaml | 2 +- .../klusterlet.clusterserviceversion.yaml | 2 +- .../klusterlet-registration-deployment.yaml | 2 +- .../klusterlet-work-deployment.yaml | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index dd1caed2c..1f39a4c30 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,8 @@ KLUSTERLET_KUBECONFIG_CONTEXT?=$(shell $(KUBECTL) config current-context) KLUSTERLET_KIND_KUBECONFIG?=$(HOME)/cluster1-kubeconfig HUB_KIND_KUBECONFIG?=$(HOME)/hub-kubeconfig KIND_CLUSTER?=kind +MANAGED_CLUSTER?=cluster1 +HUB_CLUSTER?=hub OPERATOR_SDK_ARCHOS:=x86_64-linux-gnu ifeq ($(GOHOSTOS),darwin) @@ -100,8 +102,9 @@ install-olm: ensure-operator-sdk $(KUBECTL) get ns open-cluster-management ; if [ $$? -ne 0 ] ; then $(KUBECTL) create ns open-cluster-management ; fi install-olm-kind: ensure-operator-sdk - $(KUBECTL) --kubeconfig=$(KLUSTERLET_KIND_KUBECONFIG) get crds | grep clusterserviceversion ; if [ $$? -ne 0 ] ; then $(OPERATOR_SDK) olm install --version $(OLM_VERSION); fi - $(KUBECTL) --kubeconfig=$(KLUSTERLET_KIND_KUBECONFIG) get ns open-cluster-management ; if [ $$? -ne 0 ] ; then $(KUBECTL) --kubeconfig=$(KLUSTERLET_KIND_KUBECONFIG) create ns open-cluster-management ; fi + $(KUBECTL) config use-context kind-$(MANAGED_CLUSTER) + $(KUBECTL) get crds | grep clusterserviceversion ; if [ $$? -ne 0 ] ; then $(OPERATOR_SDK) olm install --version $(OLM_VERSION); fi + $(KUBECTL) get ns open-cluster-management ; if [ $$? -ne 0 ] ; then $(KUBECTL) create ns open-cluster-management ; fi deploy-hub: deploy-hub-operator apply-hub-cr @@ -119,11 +122,11 @@ cluster-ip: CLUSTER_IP?=$(shell $(KUBECTL) get svc kubernetes -n default -o jsonpath="{.spec.clusterIP}") cluster-hub-ip-kind: - CLUSTER_IP_KIND?=$(shell $(KUBECTL) --kubeconfig=$(HUB_KIND_KUBECONFIG) config view | grep server | awk '{ print $2 }' | cut -f3 -d/ | cut -f1 -d:) + CLUSTER_IP_KIND?=$(shell $(KUBECTL) --kubeconfig $(HOME)/hub-kubeconfig config view | grep server | awk '{ print $2 }' | cut -f3 -d/ | cut -f1 -d:) bootstrap-secret: cluster-ip cp $(KUBECONFIG) dev-kubeconfig - $(KUBECTL) config use-context $(KLUSTERLET_KUBECONFIG_CONTEXT) + $(KUBECTL) config use-context kind-$(MANAGED_CLUSTER) $(KUBECTL) get ns open-cluster-management-agent; if [ $$? -ne 0 ] ; then $(KUBECTL) create ns open-cluster-management-agent; fi $(KUBECTL) config set clusters.kind-$(KIND_CLUSTER).server https://$(CLUSTER_IP) --kubeconfig dev-kubeconfig $(KUBECTL) delete secret bootstrap-hub-kubeconfig -n open-cluster-management-agent --ignore-not-found @@ -131,10 +134,11 @@ bootstrap-secret: cluster-ip bootstrap-secret-kind: cluster-hub-ip-kind cp $(HUB_KIND_KUBECONFIG) dev-kubeconfig - $(KUBECTL) --kubeconfig=$(KLUSTERLET_KIND_KUBECONFIG) get ns open-cluster-management-agent; if [ $$? -ne 0 ] ; then $(KUBECTL) --kubeconfig=$(KLUSTERLET_KIND_KUBECONFIG) create ns open-cluster-management-agent; fi - $(KUBECTL) --kubeconfig dev-kubeconfig config set clusters.kind-$(KIND_CLUSTER).server https://$(CLUSTER_IP_KIND) - $(KUBECTL) --kubeconfig=$(KLUSTERLET_KIND_KUBECONFIG) delete secret bootstrap-hub-kubeconfig -n open-cluster-management-agent --ignore-not-found - $(KUBECTL) --kubeconfig=$(KLUSTERLET_KIND_KUBECONFIG) create secret generic bootstrap-hub-kubeconfig --from-file=kubeconfig=dev-kubeconfig -n open-cluster-management-agent + $(KUBECTL) config use-context kind-$(MANAGED_CLUSTER) + $(KUBECTL) get ns open-cluster-management-agent; if [ $$? -ne 0 ] ; then $(KUBECTL) create ns open-cluster-management-agent; fi + $(KUBECTL) --kubeconfig dev-kubeconfig config set clusters.kind-$(HUB_CLUSTER).server https://$(CLUSTER_IP_KIND) + $(KUBECTL) delete secret bootstrap-hub-kubeconfig -n open-cluster-management-agent --ignore-not-found + $(KUBECTL) create secret generic bootstrap-hub-kubeconfig --from-file=kubeconfig=dev-kubeconfig -n open-cluster-management-agent # Registration e2e expects to read bootstrap secret from open-cluster-management/e2e-bootstrap-secret # TODO: think about how to factor this @@ -158,7 +162,8 @@ apply-spoke-cr: $(SED_CMD) -e "s,quay.io/open-cluster-management/registration,$(REGISTRATION_IMAGE)," -e "s,quay.io/open-cluster-management/work,$(WORK_IMAGE)," deploy/klusterlet/config/samples/operator_open-cluster-management_klusterlets.cr.yaml | $(KUBECTL) apply -f - apply-spoke-cr-kind: - $(KUBECTL) --kubeconfig=$(KLUSTERLET_KIND_KUBECONFIG) apply -f deploy/klusterlet/config/samples/operator_open-cluster-management_klusterlets.cr.yaml + $(KUBECTL) config use-context kind-$(MANAGED_CLUSTER) + $(KUBECTL) apply -f deploy/klusterlet/config/samples/operator_open-cluster-management_klusterlets.cr.yaml clean-spoke: ensure-operator-sdk $(KUBECTL) delete -f deploy/klusterlet/config/samples/operator_open-cluster-management_klusterlets.cr.yaml --ignore-not-found diff --git a/deploy/cluster-manager/olm-catalog/cluster-manager/manifests/cluster-manager.clusterserviceversion.yaml b/deploy/cluster-manager/olm-catalog/cluster-manager/manifests/cluster-manager.clusterserviceversion.yaml index ff9447829..f33a47f0d 100644 --- a/deploy/cluster-manager/olm-catalog/cluster-manager/manifests/cluster-manager.clusterserviceversion.yaml +++ b/deploy/cluster-manager/olm-catalog/cluster-manager/manifests/cluster-manager.clusterserviceversion.yaml @@ -204,7 +204,7 @@ spec: deployments: - name: cluster-manager spec: - replicas: 3 + replicas: 1 selector: matchLabels: app: cluster-manager diff --git a/deploy/klusterlet/olm-catalog/klusterlet/manifests/klusterlet.clusterserviceversion.yaml b/deploy/klusterlet/olm-catalog/klusterlet/manifests/klusterlet.clusterserviceversion.yaml index c35fb2b4b..436dde4f6 100644 --- a/deploy/klusterlet/olm-catalog/klusterlet/manifests/klusterlet.clusterserviceversion.yaml +++ b/deploy/klusterlet/olm-catalog/klusterlet/manifests/klusterlet.clusterserviceversion.yaml @@ -202,7 +202,7 @@ spec: deployments: - name: klusterlet spec: - replicas: 3 + replicas: 1 selector: matchLabels: app: klusterlet diff --git a/manifests/klusterlet/klusterlet-registration-deployment.yaml b/manifests/klusterlet/klusterlet-registration-deployment.yaml index 83c5b5610..0adf99e48 100644 --- a/manifests/klusterlet/klusterlet-registration-deployment.yaml +++ b/manifests/klusterlet/klusterlet-registration-deployment.yaml @@ -6,7 +6,7 @@ metadata: labels: app: klusterlet-registration-agent spec: - replicas: 3 + replicas: 1 selector: matchLabels: app: klusterlet-registration-agent diff --git a/manifests/klusterlet/klusterlet-work-deployment.yaml b/manifests/klusterlet/klusterlet-work-deployment.yaml index 40f016123..00e54b086 100644 --- a/manifests/klusterlet/klusterlet-work-deployment.yaml +++ b/manifests/klusterlet/klusterlet-work-deployment.yaml @@ -6,7 +6,7 @@ metadata: labels: app: klusterlet-manifestwork-agent spec: - replicas: 3 + replicas: 1 selector: matchLabels: app: klusterlet-manifestwork-agent