This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from storey247/ds/f-fixmakefile
updated to new kind and fixes to makefile
- Loading branch information
Showing
2 changed files
with
28 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,12 @@ CRD_OPTIONS ?= "crd:trivialVersions=true" | |
# Prometheus helm installation name | ||
PROMETHEUS_NAME ?= "prom-azure-databricks-operator" | ||
|
||
# Default kind cluster name | ||
KIND_CLUSTER_NAME ?= "azure-databricks-operator" | ||
|
||
# Default namespace for the installation | ||
OPERATOR_NAMESPACE ?= "azure-databricks-operator-system" | ||
|
||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) | ||
ifeq (,$(shell go env GOBIN)) | ||
GOBIN=$(shell go env GOPATH)/bin | ||
|
@@ -61,21 +67,20 @@ uninstall: manifests | |
|
||
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config | ||
deploy: manifests | ||
ifeq (,$(shell kubectl get namespace azure-databricks-operator-system)) | ||
@echo "creating azure-databricks-operator-system namespace" | ||
kubectl create namespace azure-databricks-operator-system | ||
ifeq (0, $(shell kubectl get namespaces 2>&1 | grep ${OPERATOR_NAMESPACE} | wc -l)) | ||
@echo "creating ${OPERATOR_NAMESPACE} namespace" | ||
kubectl create namespace ${OPERATOR_NAMESPACE} | ||
make create-dbrickssettings-secret | ||
else | ||
@echo "azure-databricks-operator-system namespace exists" | ||
endif | ||
ifeq (,$(shell kubectl get secret dbrickssettings --namespace azure-databricks-operator-system)) | ||
@echo "${OPERATOR_NAMESPACE} namespace exists" | ||
ifeq (0, $(shell kubectl get secrets --namespace ${OPERATOR_NAMESPACE} | grep dbrickssettings | wc -l)) | ||
@echo "creating dbrickssettings secret" | ||
kubectl --namespace azure-databricks-operator-system \ | ||
create secret generic dbrickssettings \ | ||
--from-literal=DatabricksHost="${DATABRICKS_HOST}" \ | ||
--from-literal=DatabricksToken="${DATABRICKS_TOKEN}" | ||
create-dbrickssettings-secret | ||
else | ||
@echo "dbrickssettings secret exists" | ||
endif | ||
endif | ||
|
||
cd config/manager && kustomize edit set image controller=${IMG} | ||
kustomize build config/default | kubectl apply -f - | ||
kustomize build config/default > operatorsetup.yaml | ||
|
@@ -84,6 +89,12 @@ endif | |
|
||
|
||
|
||
create-dbrickssettings-secret: | ||
kubectl --namespace ${OPERATOR_NAMESPACE} \ | ||
create secret generic dbrickssettings \ | ||
--from-literal=DatabricksHost="${DATABRICKS_HOST}" \ | ||
--from-literal=DatabricksToken="${DATABRICKS_TOKEN}" | ||
|
||
# Generate manifests e.g. CRD, RBAC etc. | ||
manifests: controller-gen | ||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases | ||
|
@@ -131,31 +142,18 @@ CONTROLLER_GEN=$(shell which controller-gen) | |
endif | ||
|
||
create-kindcluster: | ||
ifeq (,$(shell kind get clusters)) | ||
ifeq (0, $(shell kind get clusters | grep ${KIND_CLUSTER_NAME} | wc -l)) | ||
@echo "no kind cluster" | ||
else | ||
@echo "kind cluster is running, deleting the current cluster" | ||
kind delete cluster | ||
kind delete cluster --name ${KIND_CLUSTER_NAME} | ||
endif | ||
@echo "creating kind cluster" | ||
kind create cluster | ||
kind create cluster --name ${KIND_CLUSTER_NAME} | ||
|
||
set-kindcluster: install-kind | ||
ifeq (${shell kind get kubeconfig-path --name="kind"},${KUBECONFIG}) | ||
@echo "kubeconfig-path points to kind path" | ||
else | ||
@echo "please run below command in your shell and then re-run make set-kindcluster" | ||
@echo "\e[31mexport KUBECONFIG=$(shell kind get kubeconfig-path --name="kind")\e[0m" | ||
@exit 111 | ||
endif | ||
make create-kindcluster | ||
|
||
@echo "getting value of KUBECONFIG" | ||
@echo ${KUBECONFIG} | ||
@echo "getting value of kind kubeconfig-path" | ||
|
||
kubectl cluster-info | ||
|
||
@echo "deploying controller to cluster" | ||
make deploy-kindcluster | ||
make install | ||
|
@@ -166,7 +164,7 @@ deploy-kindcluster: | |
#create image and load it into cluster | ||
$(eval newimage := "docker.io/controllertest:$(timestamp)") | ||
IMG=$(newimage) make docker-build | ||
kind load docker-image $(newimage) --loglevel "debug" | ||
kind load docker-image $(newimage) --loglevel "debug" --name ${KIND_CLUSTER_NAME} | ||
|
||
#deploy operator | ||
IMG=$(newimage) make deploy | ||
|
@@ -176,11 +174,12 @@ deploy-kindcluster: | |
install-kind: | ||
ifeq (,$(shell which kind)) | ||
@echo "installing kind" | ||
GO111MODULE="on" go get sigs.k8s.io/[email protected] | ||
curl -Lo ./kind "https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64" | ||
chmod +x ./kind | ||
mv ./kind /usr/local/bin/kind | ||
else | ||
@echo "kind has been installed" | ||
endif | ||
|
||
install-kubebuilder: | ||
ifeq (,$(shell which kubebuilder)) | ||
@echo "installing kubebuilder" | ||
|