Skip to content

Commit

Permalink
Separate tools from go.mod dependencies
Browse files Browse the repository at this point in the history
To remove them from the main go.mod file, which would introduce unnecessary 
dependency for other modules importing K8up code.

Renovate should still make PRs for those tools.

Signed-off-by: Chris <github.account@chrigel.net>
  • Loading branch information
ccremer committed May 31, 2022
1 parent 1e2127d commit da13c4d
Show file tree
Hide file tree
Showing 14 changed files with 1,117 additions and 303 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Run linters
run: make generate lint
run: make lint
26 changes: 12 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MAKEFLAGS += --no-builtin-variables
.DEFAULT_GOAL := help

PROJECT_ROOT_DIR = .
include Makefile.vars.mk
include Makefile.vars.mk tools/tools.mk
include Makefile.restic-integration.mk

e2e_make := $(MAKE) -C e2e
Expand Down Expand Up @@ -40,9 +40,9 @@ integration-test: export BACKUP_DIR = $(backup_dir)
integration-test: export RESTORE_DIR = $(restore_dir)
integration-test: export STATS_URL = $(stats_url)
# }
integration-test: generate $(integrationtest_dir_created) restic-integration-test-setup ## Run integration tests with envtest
$(setup-envtest) use '$(ENVTEST_K8S_VERSION)!'
export KUBEBUILDER_ASSETS="$$($(setup-envtest) use -i -p path '$(ENVTEST_K8S_VERSION)!')"; \
integration-test: generate $(integrationtest_dir_created) restic-integration-test-setup $(SETUP_ENVTEST_BIN) ## Run integration tests with envtest
$(SETUP_ENVTEST_BIN) $(ENVTEST_ADDITIONAL_FLAGS) use '$(ENVTEST_K8S_VERSION)!'
export KUBEBUILDER_ASSETS="$$($(SETUP_ENVTEST_BIN) $(ENVTEST_ADDITIONAL_FLAGS) use -i -p path '$(ENVTEST_K8S_VERSION)!')"; \
env | grep KUBEBUILDER; \
go test -tags=integration -coverprofile cover.out ./...

Expand All @@ -65,15 +65,15 @@ run-restic: CMD := restic
run-restic: run ## Run the restic module. Use ARGS to pass arguments to the command, e.g. `make run-restic ARGS="--debug" CMD_ARGS="--check"`

.PHONY: install
install: generate ## Install CRDs into a cluster
install: $(KUSTOMIZE) generate ## Install CRDs into a cluster
$(KUSTOMIZE) build $(CRD_ROOT_DIR)/v1 | kubectl apply $(KIND_KUBECTL_ARGS) -f -

.PHONY: uninstall
uninstall: generate ## Uninstall CRDs from a cluster
uninstall: $(KUSTOMIZE) generate ## Uninstall CRDs from a cluster
$(KUSTOMIZE) build $(CRD_ROOT_DIR)/v1 | kubectl delete -f -

.PHONY: deploy
deploy: generate ## Deploy controller in the configured Kubernetes cluster in ~/.kube/config
deploy: $(KUSTOMIZE) generate ## 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 -

Expand All @@ -83,11 +83,9 @@ generate: ## Generate manifests e.g. CRD, RBAC etc.
go run sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
# Generate CRDs
go run sigs.k8s.io/controller-tools/cmd/controller-gen rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=$(CRD_ROOT_DIR)/v1/base crd:crdVersions=v1
# Generate API reference documentation
go run github.com/elastic/crd-ref-docs --source-path=api/v1 --config=docs/api-gen-config.yaml --renderer=asciidoctor --templates-dir=docs/api-templates --output-path=$(CRD_DOCS_REF_PATH)

.PHONY: crd
crd: generate ## Generate CRD to file
crd: $(KUSTOMIZE) generate ## Generate CRD to file
$(KUSTOMIZE) build $(CRD_ROOT_DIR)/v1 > $(CRD_FILE)

.PHONY: fmt
Expand All @@ -99,7 +97,7 @@ vet: ## Run go vet against code
go vet ./...

.PHONY: lint
lint: fmt vet docs-update-usage ## Invokes the fmt and vet targets
lint: generate fmt vet docs-generate ## Invokes the fmt and vet targets
@echo 'Check for uncommitted changes ...'
git diff --exit-code

Expand Down Expand Up @@ -140,9 +138,9 @@ $(BIN_FILENAME):

$(integrationtest_dir_created):
mkdir -p $(integrationtest_dir)
# a marker file must be created, because the date of the
# directory may update when content in it is created/updated,
# which would cause a rebuild / re-initialization of dependants
# a marker file must be created, because the date of the
# directory may update when content in it is created/updated,
# which would cause a rebuild / re-initialization of dependants
@touch $(integrationtest_dir_created)

###
Expand Down
5 changes: 1 addition & 4 deletions Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ SAMPLES_ROOT_DIR ?= config/samples
minio_sentinel = $(e2etest_dir)/minio_sentinel

KIND_NODE_VERSION ?= v1.23.1
KIND ?= go run sigs.k8s.io/kind
KIND_KUBECONFIG ?= $(e2etest_dir)/kind-kubeconfig-$(KIND_NODE_VERSION)
KIND_CLUSTER ?= k8up-$(KIND_NODE_VERSION)
KIND_KUBECTL_ARGS ?= --validate=true
Expand All @@ -34,13 +33,11 @@ K8UP_E2E_IMG = $(E2E_REPO)/k8up:$(E2E_TAG)

BATS_FILES ?= .

KUSTOMIZE ?= go run sigs.k8s.io/kustomize/kustomize/v4

# Image URL to use all building/pushing image targets
K8UP_GHCR_IMG ?= ghcr.io/k8up-io/k8up:$(IMG_TAG)
K8UP_QUAY_IMG ?= quay.io/k8up-io/k8up:$(IMG_TAG)

# Operator Integration Test
ENVTEST_ADDITIONAL_FLAGS ?= --bin-dir "$(integrationtest_dir)"
INTEGRATION_TEST_DEBUG_OUTPUT ?= false
setup-envtest ?= go run sigs.k8s.io/controller-runtime/tools/setup-envtest $(ENVTEST_ADDITIONAL_FLAGS)
setup-envtest ?= $(SETUP_ENVTEST_BIN) $(ENVTEST_ADDITIONAL_FLAGS)
7 changes: 7 additions & 0 deletions docs/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ docs-update-usage: ## Generates dumps from `k8up --help`, which are then include
go run $(K8UP_MAIN_GO) restic --help > "$(docs_usage_dir)/restic.txt"
go run $(K8UP_MAIN_GO) operator --help > "$(docs_usage_dir)/operator.txt"

.PHONY: docs-generate-api
docs-generate-api: $(CRD_REF_DOCS_BIN) ## Generates API reference documentation
$(CRD_REF_DOCS_BIN) --source-path=api/v1 --config=docs/api-gen-config.yaml --renderer=asciidoctor --templates-dir=docs/api-templates --output-path=$(CRD_DOCS_REF_PATH)

.PHONY: docs-generate
docs-generate: docs-update-usage docs-generate-api

# This will clean the Antora Artifacts, not the npm artifacts
.PHONY: docs-clean
docs-clean: ## Cleans Antora artifacts
Expand Down
4 changes: 2 additions & 2 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MAKEFLAGS += --no-builtin-variables
.SECONDARY:

PROJECT_ROOT_DIR = ..
include ../Makefile.vars.mk
include ../Makefile.vars.mk ../tools/tools.mk
include kind.mk

uname_s := $(shell uname -s)
Expand Down Expand Up @@ -58,7 +58,7 @@ $(e2etest_dir_created):
# a marker file must be created, because the date of the
# directory may update when content in it is created/updated,
# which would cause a rebuild / re-initialization of dependants
@touch $(e2etest_dir_created)
@touch $@

$(bats):
@npm install
6 changes: 3 additions & 3 deletions e2e/kind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ kind-setup: $(kind_marker) $(e2etest_dir_created) ## Creates the kind cluster

.PHONY: kind-clean
kind-clean: export KUBECONFIG = $(KIND_KUBECONFIG)
kind-clean: ## Remove the kind Cluster
kind-clean: $(KIND) ## Remove the kind Cluster
@$(KIND) delete cluster --name $(KIND_CLUSTER) || true
@rm $(KIND) $(kind_marker) $(KIND_KUBECONFIG) || true
@rm -rf $(KIND) $(kind_marker) $(KIND_KUBECONFIG)

###
### Artifacts
###

$(KIND_KUBECONFIG): export KUBECONFIG = $(KIND_KUBECONFIG)
$(KIND_KUBECONFIG):
$(KIND_KUBECONFIG): $(KIND)
@mkdir -p debug/data/pvc-subject
$(KIND) create cluster \
--name $(KIND_CLUSTER) \
Expand Down
2 changes: 1 addition & 1 deletion e2e/lib/k8up.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ clear_pv_data() {
}

kustomize() {
go run sigs.k8s.io/kustomize/kustomize/v4 "${@}"
../.e2e-test/kustomize "${@}"
}

restic() {
Expand Down
29 changes: 0 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module github.com/k8up-io/k8up/v2
go 1.17

require (
// When updating crd-ref-docs, verify that there were no changes from Elastic to hostile licenses.
github.com/elastic/crd-ref-docs v0.0.8
github.com/firepear/qsplit/v2 v2.5.0
github.com/go-logr/logr v1.2.3
github.com/go-logr/zapr v1.2.3
Expand All @@ -21,23 +19,14 @@ require (
k8s.io/client-go v0.24.0
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
sigs.k8s.io/controller-runtime v0.11.2
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20220508024717-51159d338306
sigs.k8s.io/controller-tools v0.9.0
sigs.k8s.io/kind v0.14.0
sigs.k8s.io/kustomize/kustomize/v4 v4.5.4
)

require (
cloud.google.com/go v0.84.0 // indirect
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/antzucaro/matchr v0.0.0-20210222213004-b04723ef80f0 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand All @@ -46,24 +35,19 @@ require (
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fatih/color v1.12.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/gobuffalo/flect v0.2.5 // indirect
github.com/goccy/go-yaml v1.1.5 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/huandu/xstrings v1.2.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -73,21 +57,14 @@ require (
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/minio/md5-simd v1.1.0 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/olekukonko/tablewriter v0.0.4 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
Expand All @@ -96,11 +73,8 @@ require (
github.com/rs/xid v1.2.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cobra v1.4.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
Expand All @@ -125,9 +99,6 @@ require (
k8s.io/klog/v2 v2.60.1 // indirect
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/kustomize/api v0.11.4 // indirect
sigs.k8s.io/kustomize/cmd/config v0.10.6 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit da13c4d

Please sign in to comment.