Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 10 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ COVER_PROFILE = cover.out
BIN_DIR := bin

CRD_OPTIONS ?= "crd:trivialVersions=false,allowDangerousTypes=true,crdVersions=v1"
CONTROLLER_TOOLS_VERSION=v0.4.1
CONTROLLER_GEN := $(BIN_DIR)/controller-gen
GOLANGCI_LINT := $(BIN_DIR)/golangci-lint
KUSTOMIZE := $(BIN_DIR)/kustomize
CONTROLLER_GEN ?= go run sigs.k8s.io/controller-tools/cmd/controller-gen
GOLANGCI_LINT ?= GOLANGCI_LINT_CACHE=$(GOLANGCI_LINT_CACHE) go run github.com/golangci/golangci-lint/cmd/golangci-lint
KUSTOMIZE ?= go run sigs.k8s.io/kustomize/kustomize/v3
Comment thread
asalkeld marked this conversation as resolved.

# See pkg/version.go for details
SOURCE_GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
Expand Down Expand Up @@ -53,15 +52,6 @@ help: ## Display this help

# Image URL to use all building/pushing image targets
IMG ?= baremetal-operator:latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

# 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
else
GOBIN=$(shell go env GOBIN)
endif

## --------------------------------------
## Test Targets
Expand Down Expand Up @@ -101,12 +91,9 @@ fmt: lint
vet: lint

.PHONY: lint
lint: $(GOLANGCI_LINT)
lint:
$(GOLANGCI_LINT) run

$(GOLANGCI_LINT):
./hack/install-golangci-lint.sh

.PHONY: manifest-lint
manifest-lint: ## Run manifest validation
./hack/manifestlint.sh
Expand Down Expand Up @@ -135,35 +122,27 @@ run-test-mode: generate fmt vet manifests ## Run against the configured Kubernet
go run -ldflags $(LDFLAGS) ./main.go -namespace=$(RUN_NAMESPACE) -dev -test-mode

.PHONY: install
install: $(KUSTOMIZE) manifests ## Install CRDs into a cluster
install: manifests ## Install CRDs into a cluster
$(KUSTOMIZE) build config/crd | kubectl apply -f -

.PHONY: uninstall
uninstall: $(KUSTOMIZE) manifests ## Uninstall CRDs from a cluster
uninstall: manifests ## Uninstall CRDs from a cluster
$(KUSTOMIZE) build config/crd | kubectl delete -f -

.PHONY: deploy
deploy: $(KUSTOMIZE) manifests ## Deploy controller in the configured Kubernetes cluster in ~/.kube/config
deploy: manifests ## Deploy controller in the configured Kubernetes cluster in ~/.kube/config
cd config/manager && kustomize edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -

.PHONY: manifests
manifests: $(CONTROLLER_GEN) $(KUSTOMIZE) ## Generate manifests e.g. CRD, RBAC etc.
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
manifests: ## Generate manifests e.g. CRD, RBAC etc.
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(KUSTOMIZE) build config/default > config/render/capm3.yaml

.PHONY: generate
generate: $(CONTROLLER_GEN) ## Generate code
generate: ## Generate code
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: $(KUSTOMIZE)
$(KUSTOMIZE):
./tools/install_kustomize.sh

# Build the version of controller-gen that we use
$(CONTROLLER_GEN):
./hack/install-controller-gen.sh $(CONTROLLER_TOOLS_VERSION) $$(pwd)/$(CONTROLLER_GEN)

## --------------------------------------
## Docker Targets
## --------------------------------------
Expand Down
27 changes: 0 additions & 27 deletions hack/install-controller-gen.sh

This file was deleted.

27 changes: 0 additions & 27 deletions hack/install-golangci-lint.sh

This file was deleted.

13 changes: 7 additions & 6 deletions tools/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ IRONIC_HOST_IP="${IRONIC_HOST_IP}"
MARIADB_HOST="${MARIADB_HOST:-"mariaDB"}"
MARIADB_HOST_IP="${MARIADB_HOST_IP:-"127.0.0.1"}"
KUBECTL_ARGS="${KUBECTL_ARGS:-""}"
KUSTOMIZE="go run sigs.k8s.io/kustomize/kustomize/v3"

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"

Expand Down Expand Up @@ -201,18 +202,18 @@ if [ "${DEPLOY_TLS}" == "true" ]; then
fi
fi

pushd "${SCRIPTDIR}"
make bin/kustomize
popd

if [ "${DEPLOY_BMO}" == "true" ]; then
pushd "${SCRIPTDIR}"
# shellcheck disable=SC2086
"${SCRIPTDIR}/bin/kustomize" build "${BMO_SCENARIO}" | kubectl apply ${KUBECTL_ARGS} -f -
${KUSTOMIZE} build "${BMO_SCENARIO}" | kubectl apply ${KUBECTL_ARGS} -f -
popd
fi

if [ "${DEPLOY_IRONIC}" == "true" ]; then
pushd "${SCRIPTDIR}"
# shellcheck disable=SC2086
"${SCRIPTDIR}/bin/kustomize" build "${IRONIC_SCENARIO}" | kubectl apply ${KUBECTL_ARGS} -f -
${KUSTOMIZE} build "${IRONIC_SCENARIO}" | kubectl apply ${KUBECTL_ARGS} -f -
popd
fi

if [ "${DEPLOY_BASIC_AUTH}" == "true" ]; then
Expand Down
26 changes: 0 additions & 26 deletions tools/install_kustomize.sh

This file was deleted.