Skip to content

Commit

Permalink
chore: disable automatic k8s package updates (#33)
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Constanti <[email protected]>
  • Loading branch information
bavarianbidi authored May 15, 2024
1 parent b74417a commit 246acd7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 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"]
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ GORELEASER ?= $(LOCALBIN)/goreleaser
MDTOC ?= $(LOCALBIN)/mdtoc
NANCY ?= $(LOCALBIN)/nancy
GOVULNCHECK ?= $(LOCALBIN)/govulncheck
KIND ?= $(LOCALBIN)/kind

## Tool Versions
GOLANGCI_LINT_VERSION ?= v1.53.3
GORELEASER_VERSION ?= v1.21.0
MDTOC_VERSION ?= v1.1.0
NANCY_VERSION ?= v1.0.42
KIND_VERSION ?= v0.22.0

##@ Build
.PHONY: all build copy run clean
Expand Down Expand Up @@ -119,12 +121,12 @@ prepare-operator: ## Prepare garm-operator for local development
envsubst > hack/local-development/kubernetes/garm-operator-all.yaml

.PHONY: kind-cluster
kind-cluster: ## Create a new kind cluster designed for local development
kind-cluster: $(KIND) ## Create a new kind cluster designed for local development
hack/scripts/kind-with-registry.sh

.PHONY: delete-kind-cluster
delete-kind-cluster:
kind delete cluster --name garm
$(KIND) delete cluster --name garm
docker kill kind-registry && docker rm kind-registry

.PHONY: tilt-up
Expand Down Expand Up @@ -205,6 +207,12 @@ $(GOVULNCHECK): $(LOCALBIN)
test -s $(LOCALBIN)/govulncheck || \
GOBIN=$(LOCALBIN) go install golang.org/x/vuln/cmd/govulncheck@latest

.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)

##@ Documentation
.PHONY: generate-doctoc
generate-doctoc: mdtoc ## Generate documentation table of contents
Expand Down
9 changes: 6 additions & 3 deletions hack/scripts/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=${GARM_KIND_CLUSTER_NAME:-"garm"}
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 @@ -41,7 +44,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
networking:
Expand All @@ -66,7 +69,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 246acd7

Please sign in to comment.