Skip to content

Commit

Permalink
Merge pull request #1669 from Nordix/mquhuy/deploy-cli
Browse files Browse the repository at this point in the history
✨ Add Golang-based deploy-cli
  • Loading branch information
metal3-io-bot authored Sep 16, 2024
2 parents c3faa68 + e286246 commit 9a31187
Show file tree
Hide file tree
Showing 14 changed files with 1,034 additions and 55 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ KUSTOMIZE = tools/bin/kustomize
CONTROLLER_GEN = tools/bin/controller-gen
GINKGO = tools/bin/ginkgo
GINKGO_VER = v2.17.1
DEPLOY_CLI = tools/bin/deploy-cli

# See pkg/version.go for details
SOURCE_GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
Expand Down Expand Up @@ -63,7 +64,6 @@ GOLANGCI_LINT_VER := v1.56.2
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN))
GOLANGCI_LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint


# to set multiple ginkgo skip flags, if any
ifneq ($(strip $(GINKGO_SKIP)),)
_SKIP_ARGS := $(foreach arg,$(strip $(GINKGO_SKIP)),-skip="$(arg)")
Expand Down Expand Up @@ -193,6 +193,10 @@ $(CONTROLLER_GEN): hack/tools/go.mod
$(KUSTOMIZE): hack/tools/go.mod
cd hack/tools; go build -o $(abspath $@) sigs.k8s.io/kustomize/kustomize/v5

.PHONY: deploy-cli
deploy-cli:
cd hack/tools/deploy-cli; go build -o $(abspath $(DEPLOY_CLI))

.PHONY: build-e2e
build-e2e:
cd test; go build ./...
Expand Down
26 changes: 26 additions & 0 deletions config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
This folder contains kustomizations for the Baremetal Operator. They have
traditionally been used through the [deploy.sh](../tools/deploy.sh) script,
which takes care of generating the necessary config for basic-auth and TLS.

Experimentally, instead of `deploy.sh`, you can use the new golang-based
[deploy-cli](../hack/tools/deploy-cli) library,
which, at the moment, handles everything `deploy.sh` does. You can either:

- Run the package with `go run`. From the root of BMO repository:

```shell
cd hack/tools/deploy-cli
go run *.go
```

- Otherwise, build the package to a static binary:

```shell
make deploy-cli
```

And run the binary with:

```shell
./tools/bin/deploy-cli -h
```

To check which options are available, run the script/binary with `-h`.

However, a more GitOps friendly way would be to create your own static overlay.
Check the `overlays/e2e` for an example that is used in the e2e tests.
In the CI system we generate the necessary credentials before starting the test
Expand Down
1 change: 1 addition & 0 deletions hack/tools/deploy-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deploy-cli
Loading

0 comments on commit 9a31187

Please sign in to comment.