mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-14 05:07:48 +00:00
Merge pull request #103 from pdettori/kind-updates
Enable support for "getting started" with kind on OS X
This commit is contained in:
24
Makefile
24
Makefile
@@ -39,7 +39,8 @@ KUBECONFIG?=./.kubeconfig
|
||||
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 +101,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,22 +121,23 @@ 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/)
|
||||
|
||||
bootstrap-secret: cluster-ip
|
||||
cp $(KUBECONFIG) dev-kubeconfig
|
||||
$(KUBECTL) config use-context $(KLUSTERLET_KUBECONFIG_CONTEXT)
|
||||
$(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) config set clusters.kind-$(MANAGED_CLUSTER).server https://$(CLUSTER_IP) --kubeconfig dev-kubeconfig
|
||||
$(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
|
||||
|
||||
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 +161,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
|
||||
|
||||
10
README.md
10
README.md
@@ -11,9 +11,13 @@ Check the [CONTRIBUTING Doc](CONTRIBUTING.md) for how to contribute to the repo.
|
||||
## Deploy all-in-one deployment on kind
|
||||
|
||||
1. Create a kind cluster
|
||||
2. Deploy all compoenent on the kind cluster
|
||||
```
|
||||
export KIND_CLUSTER={kind cluster name}
|
||||
kind create cluster --name cluster1
|
||||
kind get kubeconfig --name cluster1 > ./.kubeconfig
|
||||
```
|
||||
2. Deploy all components on the kind cluster
|
||||
```
|
||||
export MANAGED_CLUSTER=cluster1
|
||||
make deploy
|
||||
```
|
||||
3. To clean the environment, run `make clean-deploy`
|
||||
@@ -35,7 +39,7 @@ Check the [CONTRIBUTING Doc](CONTRIBUTING.md) for how to contribute to the repo.
|
||||
|
||||
## What is next
|
||||
|
||||
After a successfull deployment, a `certificatesigningrequest` and a `managedcluster` will
|
||||
After a successful deployment, a `certificatesigningrequest` and a `managedcluster` will
|
||||
be created on the hub.
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user