@@ -2,19 +2,6 @@ IMG ?= linode/linode-cloud-controller-manager:canary
22RELEASE_DIR ?= release
33PLATFORM ?= linux/amd64
44
5- # Use CACHE_BIN for tools that cannot use devbox and LOCALBIN for tools that can use either method
6- CACHE_BIN ?= $(CURDIR ) /bin
7- LOCALBIN ?= $(CACHE_BIN )
8-
9- DEVBOX_BIN ?= $(DEVBOX_PACKAGES_DIR ) /bin
10- HELM ?= $(LOCALBIN ) /helm
11- HELM_VERSION ?= v3.16.3
12- CLUSTERCTL ?= $(CACHE_BIN ) /clusterctl
13- CLUSTERCTL_VERSION ?= v1.8.5
14-
15- GOLANGCI_LINT ?= $(LOCALBIN ) /golangci-lint
16- GOLANGCI_LINT_NILAWAY ?= $(CACHE_BIN ) /golangci-lint-nilaway
17-
185# ####################################################################
196# Dev Setup
207# ####################################################################
@@ -38,9 +25,6 @@ CAAPH_VERSION ?= "v0.2.1"
3825# renovate: datasource=github-tags depName=linode/cluster-api-provider-linode
3926CAPL_VERSION ?= "v0.8.5"
4027
41- # renovate: datasource=github-tags depName=golangci/golangci-lint
42- GOLANGCI_LINT_VERSION ?= "v2.11.4"
43-
4428CONTROLPLANE_NODES ?= 1
4529WORKER_NODES ?= 1
4630LINODE_FIREWALL_ENABLED ?= true
@@ -52,17 +36,6 @@ SUBNET_KUBECONFIG_PATH ?= $(CURDIR)/subnet-testing-kubeconfig.yaml
5236MGMT_KUBECONFIG_PATH ?= $(CURDIR ) /mgmt-cluster-kubeconfig.yaml
5337IPV6_KUBECONFIG_PATH ?= $(CURDIR ) /ipv6-kubeconfig.yaml
5438
55- # if the $DEVBOX_PACKAGES_DIR env variable exists that means we are within a devbox shell and can safely
56- # use devbox's bin for our tools
57- ifdef DEVBOX_PACKAGES_DIR
58- LOCALBIN = $(DEVBOX_BIN)
59- endif
60-
61- export PATH := $(CACHE_BIN ) :$(PATH )
62- TOOL_DIRS := $(sort $(LOCALBIN ) $(CACHE_BIN ) )
63- $(TOOL_DIRS ) :
64- mkdir -p $@
65-
6639export GO111MODULE =on
6740
6841.PHONY : all
7447 @rm -rf ./.tmp
7548 @rm -rf dist/*
7649 @rm -rf $(RELEASE_DIR )
77- @rm -rf $( LOCALBIN )
50+ @rm -rf ./bin
7851
7952.PHONY : codegen
8053codegen :
@@ -85,12 +58,8 @@ vet: fmt
8558 go vet ./...
8659
8760.PHONY : lint
88- lint : golangci-lint
89- $(GOLANGCI_LINT ) run -c .golangci.yml --fix
90-
91- .PHONY : lint
92- nilcheck : golangci-lint-nilaway # # Run nilaway against code.
93- $(GOLANGCI_LINT_NILAWAY ) run -c .golangci-nilaway.yml
61+ lint :
62+ golangci-lint run -c .golangci.yml --fix
9463
9564.PHONY : gosec
9665gosec : # # Run gosec against code.
@@ -180,27 +149,27 @@ capl-ipv6-cluster: generate-capl-ipv6-cluster-manifests
180149 $(MAKE ) create-capl-cluster
181150
182151.PHONY : generate-capl-cluster-manifests
183- generate-capl-cluster-manifests : clusterctl
152+ generate-capl-cluster-manifests :
184153 # Create the CAPL cluster manifests without any CSI driver stuff
185- LINODE_FIREWALL_ENABLED=$(LINODE_FIREWALL_ENABLED ) LINODE_OS=$(LINODE_OS ) VPC_NAME=$(VPC_NAME ) $( CLUSTERCTL ) generate cluster $(CLUSTER_NAME ) \
154+ LINODE_FIREWALL_ENABLED=$(LINODE_FIREWALL_ENABLED ) LINODE_OS=$(LINODE_OS ) VPC_NAME=$(VPC_NAME ) clusterctl generate cluster $(CLUSTER_NAME ) \
186155 --kubernetes-version $(K8S_VERSION ) --infrastructure linode-linode:$(CAPL_VERSION ) \
187156 --control-plane-machine-count $(CONTROLPLANE_NODES ) --worker-machine-count $(WORKER_NODES ) > $(MANIFEST_NAME ) .yaml
188157 IMG=$(IMG ) SUBNET_NAME=$(SUBNET_NAME ) ./hack/patch-capl-manifest.sh $(MANIFEST_NAME ) .yaml
189158
190159.PHONY : generate-capl-ipv6-cluster-manifests
191- generate-capl-ipv6-cluster-manifests : clusterctl
192- LINODE_FIREWALL_ENABLED=$(LINODE_FIREWALL_ENABLED ) LINODE_OS=$(LINODE_OS ) VPC_NAME=$(IPV6_CLUSTER_NAME ) $( CLUSTERCTL ) generate cluster $(IPV6_CLUSTER_NAME ) \
160+ generate-capl-ipv6-cluster-manifests :
161+ LINODE_FIREWALL_ENABLED=$(LINODE_FIREWALL_ENABLED ) LINODE_OS=$(LINODE_OS ) VPC_NAME=$(IPV6_CLUSTER_NAME ) clusterctl generate cluster $(IPV6_CLUSTER_NAME ) \
193162 --kubernetes-version $(K8S_VERSION ) --infrastructure linode-linode:$(CAPL_VERSION ) \
194163 --control-plane-machine-count $(CONTROLPLANE_NODES ) --worker-machine-count $(WORKER_NODES ) --flavor kubeadm-dual-stack > $(IPV6_MANIFEST_NAME ) .yaml
195164 IMG=$(IMG ) ./hack/patch-capl-manifest.sh $(IPV6_MANIFEST_NAME ) .yaml
196165
197166.PHONY : create-capl-cluster
198- create-capl-cluster : clusterctl
167+ create-capl-cluster :
199168 # Create a CAPL cluster with updated CCM and wait for it to be ready
200169 kubectl apply -f $(MANIFEST_NAME ) .yaml
201170 kubectl wait --for=condition=ControlPlaneReady cluster/$(CLUSTER_NAME ) --timeout=600s || (kubectl get cluster -o yaml; kubectl get linodecluster -o yaml; kubectl get linodemachines -o yaml; kubectl logs -n capl-system deployments/capl-controller-manager --tail=50)
202171 kubectl wait --for=condition=NodeHealthy=true machines -l cluster.x-k8s.io/cluster-name=$(CLUSTER_NAME ) --timeout=900s
203- $( CLUSTERCTL ) get kubeconfig $(CLUSTER_NAME ) > $(KUBECONFIG_PATH )
172+ clusterctl get kubeconfig $(CLUSTER_NAME ) > $(KUBECONFIG_PATH )
204173 KUBECONFIG=$(KUBECONFIG_PATH ) kubectl wait --for=condition=Ready nodes --all --timeout=600s
205174 # Remove all taints from control plane node so that pods scheduled on it by tests can run (without this, some tests fail)
206175 KUBECONFIG=$(KUBECONFIG_PATH ) kubectl taint nodes -l node-role.kubernetes.io/control-plane node-role.kubernetes.io/control-plane-
@@ -214,10 +183,10 @@ patch-linode-ccm:
214183 KUBECONFIG=$(KUBECONFIG_PATH ) kubectl -n kube-system get daemonset/ccm-linode -o yaml
215184
216185.PHONY : mgmt-cluster
217- mgmt-cluster : clusterctl
186+ mgmt-cluster :
218187 # Create a mgmt cluster
219188 ctlptl apply -f e2e/setup/ctlptl-config.yaml
220- $( CLUSTERCTL ) init \
189+ clusterctl init \
221190 --wait-providers \
222191 --wait-provider-timeout 600 \
223192 --core cluster-api:$(CAPI_VERSION ) \
@@ -283,60 +252,15 @@ e2e-test-subnet:
283252 SECOND_CONFIG=$(SUBNET_KUBECONFIG_PATH ) \
284253 chainsaw test e2e/subnet-test $(E2E_FLAGS )
285254
286- # ####################################################################
287- # OS / ARCH
288- # ####################################################################
289-
290- # Set the host's OS. Only linux and darwin supported for now
291- HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
292- ifeq ($(filter darwin linux,$(HOSTOS ) ) ,)
293- $(error build only supported on linux and darwin host currently)
294- endif
295- ARCH =$(shell uname -m)
296- ARCH_SHORT =$(ARCH )
297- ifeq ($(ARCH_SHORT ) ,x86_64)
298- ARCH_SHORT := amd64
299- else ifeq ($(ARCH_SHORT),aarch64)
300- ARCH_SHORT := arm64
301- endif
302-
303- .PHONY : helm
304- helm : $(HELM ) # # Download helm locally if necessary
305- $(HELM ) : $(LOCALBIN )
306- @curl -fsSL https://get.helm.sh/helm-$(HELM_VERSION ) -$(HOSTOS ) -$(ARCH_SHORT ) .tar.gz | tar -xz
307- @mv $(HOSTOS ) -$(ARCH_SHORT ) /helm $(HELM )
308- @rm -rf helm.tgz $(HOSTOS ) -$(ARCH_SHORT )
309-
310255.PHONY : helm-lint
311- helm-lint : helm
256+ helm-lint :
312257# Verify lint works when region and apiToken are passed, and when it is passed as reference.
313- @$(HELM) lint deploy/chart --set apiToken="apiToken",region="us-east"
314- @$(HELM) lint deploy/chart --set secretRef.apiTokenRef="apiToken",secretRef.name="api",secretRef.regionRef="us-east"
258+ @helm lint deploy/chart --set apiToken="apiToken",region="us-east"
259+ @helm lint deploy/chart --set secretRef.apiTokenRef="apiToken",secretRef.name="api",secretRef.regionRef="us-east"
315260
316261.PHONY : helm-template
317- helm-template : helm
262+ helm-template :
318263# Verify template works when region and apiToken are passed, and when it is passed as reference.
319- @$(HELM) template foo deploy/chart --set apiToken="apiToken",region="us-east" > /dev/null
320- @$(HELM) template foo deploy/chart --set secretRef.apiTokenRef="apiToken",secretRef.name="api",secretRef.regionRef="us-east" > /dev/null
321-
322- .PHONY : kubectl
323- kubectl : $(KUBECTL ) # # Download kubectl locally if necessary.
324- $(KUBECTL ) : $(LOCALBIN )
325- curl -fsSL https://dl.k8s.io/release/$(KUBECTL_VERSION ) /bin/$(HOSTOS ) /$(ARCH_SHORT ) /kubectl -o $(KUBECTL )
326- chmod +x $(KUBECTL )
327-
328- .PHONY : clusterctl
329- clusterctl : $(CLUSTERCTL ) # # Download clusterctl locally if necessary.
330- $(CLUSTERCTL ) : $(CACHE_BIN )
331- curl -fsSL https://github.com/kubernetes-sigs/cluster-api/releases/download/$(CLUSTERCTL_VERSION ) /clusterctl-$(HOSTOS ) -$(ARCH_SHORT ) -o $(CLUSTERCTL )
332- chmod +x $(CLUSTERCTL )
333-
334- .phony : golangci-lint-nilaway
335- golangci-lint-nilaway : $(GOLANGCI_LINT_NILAWAY )
336- $(GOLANGCI_LINT_NILAWAY ) : $(GOLANGCI_LINT ) # Build golangci-lint-nilaway from custom configuration.
337- $(GOLANGCI_LINT ) custom
338-
339- .phony : golangci-lint
340- golangci-lint : $(GOLANGCI_LINT )
341- $(GOLANGCI_LINT ) : # Build golangci-lint from tools folder.
342- GOBIN=$(LOCALBIN ) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION )
264+ @helm template foo deploy/chart --set apiToken="apiToken",region="us-east" > /dev/null
265+ @helm template foo deploy/chart --set secretRef.apiTokenRef="apiToken",secretRef.name="api",secretRef.regionRef="us-east" > /dev/null
266+
0 commit comments