Skip to content

Commit 7cda609

Browse files
authored
fix: run on gce (#8)
* fix: run on gce * fix * fix
1 parent 8f5cbe2 commit 7cda609

File tree

4 files changed

+33
-14
lines changed

4 files changed

+33
-14
lines changed

Makefile

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3+
include hack/tools/Makefile.variables
34
include embedded-bins/Makefile.variables
45
include inttest/Makefile.variables
56

@@ -63,19 +64,17 @@ static/bin/k0s:
6364

6465
static/helm/000-admin-console-$(admin_console_version).tgz: helm
6566
@mkdir -p static/helm
66-
helm pull oci://registry.replicated.com/library/admin-console --version=$(admin_console_version)
67+
$(HELM) pull oci://registry.replicated.com/library/admin-console --version=$(admin_console_version)
6768
mv admin-console-$(admin_console_version).tgz static/helm/000-admin-console-$(admin_console_version).tgz
6869

69-
##@ Development
70+
HELM = $(BIN_DIR)/helm
71+
.PHONY: helm
72+
helm:
73+
@mkdir -p $(BIN_DIR)
74+
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | \
75+
DESIRED_VERSION=v$(helm_version) HELM_INSTALL_DIR=$(BIN_DIR) USE_SUDO=false bash
7076

71-
GOLANGCI_LINT = $(BIN_DIR)/golangci-lint
72-
.PHONY: golangci-lint
73-
golangci-lint:
74-
@[ -f $(GOLANGCI_LINT) ] || { \
75-
set -e ;\
76-
curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
77-
sh -s -- -b $(shell dirname $(GOLANGCI_LINT));\
78-
}
77+
##@ Development
7978

8079
.PHONY: lint
8180
lint: golangci-lint go.sum ## Run golangci-lint linter
@@ -97,11 +96,12 @@ $(smoketests): build
9796
.PHONY: smoketests
9897
smoketests: $(smoketests)
9998

100-
.PHONY: helm
101-
helm:
99+
GOLANGCI_LINT = $(BIN_DIR)/golangci-lint
100+
.PHONY: golangci-lint
101+
golangci-lint:
102102
@mkdir -p $(BIN_DIR)
103-
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | \
104-
DESIRED_VERSION=v$(helm_version) HELM_INSTALL_DIR=$(BIN_DIR) USE_SUDO=false bash
103+
curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
104+
sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v$(golangci-lint_version)
105105

106106
go.sum: go.mod
107107
$(GO) mod tidy && touch -c -- '$@'

hack/tools/Makefile.variables

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
golangci-lint_version = 1.52.2

inttest/footloose-alpine/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ RUN if [ "$TARGETARCH" != arm ]; then \
6262
&& chmod 755 /usr/local/bin/cri-dockerd; \
6363
fi
6464
ADD cri-dockerd.sh /etc/init.d/cri-dockerd
65+
66+
ADD docker-entrypoint.sh /entrypoint.sh
67+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
# kubelet uses /sys/class/dmi/id/product_name to check if is running on a GCE VM and then attempts to query the metadata server
4+
# this fails and kubelet fails to register the node
5+
fix_product_name() {
6+
if [ -f /sys/class/dmi/id/product_name ]; then
7+
mkdir -p /k0s
8+
echo 'k0svm' > /k0s/product_name
9+
mount -o ro,bind /k0s/product_name /sys/class/dmi/id/product_name
10+
fi
11+
}
12+
13+
fix_product_name
14+
15+
exec $@

0 commit comments

Comments
 (0)