Skip to content

Commit

Permalink
chore: disable automatic k8s.io package updates (#94)
Browse files Browse the repository at this point in the history
as there are few more things to do when updating
k8s.io/controller-runtime (e.g. using the same version in kind cluster -
relevant when we start with integration tests) we will disable the dump
dependabot update PRs

Signed-off-by: Mario Constanti <[email protected]>
  • Loading branch information
bavarianbidi committed Mar 5, 2024
1 parent acb41e2 commit 7d8d7ae
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
17 changes: 15 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
ignore:
# Ignore k8s, controller-runtime and its transitives modules as they are upgraded manually.
# we also have to update local kind cluster configuration (hack/kind-with-registry.sh)
- dependency-name: "sigs.k8s.io/controller-runtime"
update-types:
["version-update:semver-major", "version-update:semver-minor"]
- dependency-name: "k8s.io/*"
update-types:
["version-update:semver-major", "version-update:semver-minor"]
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ SLICE ?= $(LOCALBIN)/kubectl-slice
NANCY ?= $(LOCALBIN)/nancy
GOVULNCHECK ?= $(LOCALBIN)/govulncheck
KBOM ?= $(LOCALBIN)/bom
KIND ?= $(LOCALBIN)/kind

## Tool Versions
KUSTOMIZE_VERSION ?= v5.0.1
Expand All @@ -182,6 +183,7 @@ MDTOC_VERSION ?= v1.1.0
SLICE_VERSION ?= v1.2.6
NANCY_VERSION ?= v1.0.42
KBOM_VERSION ?= v0.5.1
KIND_VERSION ?= v0.22.0

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
Expand Down Expand Up @@ -246,11 +248,17 @@ $(GOVULNCHECK): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install golang.org/x/vuln/cmd/govulncheck@latest

.PHONY: kbom
kbom: $(KBOM) ## Download nancy locally if necessary. If wrong version is installed, it will be overwritten.
kbom: $(KBOM) ## Download kbom locally if necessary. If wrong version is installed, it will be overwritten.
$(KBOM): $(LOCALBIN)
test -s $(LOCALBIN)/bom && $(LOCALBIN)/bom version | grep -q $(KBOM_VERSION) || \
GOBIN=$(LOCALBIN) go install sigs.k8s.io/bom/cmd/bom@$(KBOM_VERSION)

.PHONY: kind
kind: $(KIND) ## Download kind locally if necessary. If wrong version is installed, it will be overwritten.
$(KIND): $(LOCALBIN)
test -s $(LOCALBIN)/kind && $(LOCALBIN)/kind version | grep -q $(KIND_VERSION) || \
GOBIN=$(LOCALBIN) go install sigs.k8s.io/kind@$(KIND_VERSION)

##@ Lint / Verify
.PHONY: lint
lint: $(GOLANGCI_LINT) ## Run linting.
Expand Down
9 changes: 6 additions & 3 deletions hack/kind-with-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ if [[ "${TRACE-0}" == "1" ]]; then
fi

KIND_CLUSTER_NAME=${CAPI_KIND_CLUSTER_NAME:-"garm-operator"}
KIND_BINARY="bin/kind"
# available versions can be found at https://github.com/kubernetes-sigs/kind/releases
NODE_IMAGE="kindest/node:v1.28.7@sha256:9bc6c451a289cf96ad0bbaf33d416901de6fd632415b076ab05f5fa7e4f65c58"

# 1. If kind cluster already exists exit.
if [[ "$(kind get clusters)" =~ .*"${KIND_CLUSTER_NAME}".* ]]; then
if [[ "$(${KIND_BINARY} get clusters)" =~ .*"${KIND_CLUSTER_NAME}".* ]]; then
echo "kind cluster already exists, moving on"
exit 0
fi
Expand All @@ -42,7 +45,7 @@ fi
# https://github.com/kubernetes-sigs/kind/issues/2875
# https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration
# See: https://github.com/containerd/containerd/blob/main/docs/hosts.md
cat <<EOF | kind create cluster --name="$KIND_CLUSTER_NAME" --config=-
cat <<EOF | "${KIND_BINARY}" create cluster --name="${KIND_CLUSTER_NAME}" --image="${NODE_IMAGE}" --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
Expand All @@ -59,7 +62,7 @@ EOF
# We want a consistent name that works from both ends, so we tell containerd to
# alias localhost:${reg_port} to the registry container when pulling images
REGISTRY_DIR="/etc/containerd/certs.d/localhost:${reg_port}"
for node in $(kind get nodes --name "$KIND_CLUSTER_NAME"); do
for node in $(${KIND_BINARY} get nodes --name "${KIND_CLUSTER_NAME}"); do
docker exec "${node}" mkdir -p "${REGISTRY_DIR}"
cat <<EOF | docker exec -i "${node}" cp /dev/stdin "${REGISTRY_DIR}/hosts.toml"
[host."http://${reg_name}:5000"]
Expand Down

0 comments on commit 7d8d7ae

Please sign in to comment.