chore(ci): stripping binaries and avoiding cgo (#861)

* chore(docs): aligning to latest capi cp provider docs

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* chore(ci): stripping binaries and avoiding cgo

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* chore(gh): upgrading to ubuntu-latest for e2e

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* chore(test): printing debug messages for node join in e2e

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* fix(ci): ignoring file existing error

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

* fix(ci): enabling br_netfilter as github action step

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>

---------

Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>
This commit is contained in:
Dario Tranchitella
2025-07-03 09:09:49 +02:00
committed by GitHub
parent d6a94dfa5e
commit 678aca6229
4 changed files with 50 additions and 21 deletions

View File

@@ -33,7 +33,7 @@ on:
jobs:
kind:
name: Kubernetes
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
@@ -46,5 +46,6 @@ jobs:
sudo apt-get update
sudo apt-get install -y golang-cfssl
sudo swapoff -a
sudo modprobe br_netfilter
- name: e2e testing
run: make e2e

View File

@@ -73,47 +73,47 @@ help: ## Display this help.
.PHONY: ko
ko: $(KO) ## Download ko locally if necessary.
$(KO): $(LOCALBIN)
test -s $(LOCALBIN)/ko || GOBIN=$(LOCALBIN) go install github.com/google/ko@v0.14.1
test -s $(LOCALBIN)/ko || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" github.com/google/ko@v0.14.1
.PHONY: yq
yq: $(YQ) ## Download yq locally if necessary.
$(YQ): $(LOCALBIN)
test -s $(LOCALBIN)/yq || GOBIN=$(LOCALBIN) go install github.com/mikefarah/yq/v4@v4.44.2
test -s $(LOCALBIN)/yq || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" github.com/mikefarah/yq/v4@v4.44.2
.PHONY: helm
helm: $(HELM) ## Download helm locally if necessary.
$(HELM): $(LOCALBIN)
test -s $(LOCALBIN)/helm || GOBIN=$(LOCALBIN) go install helm.sh/helm/v3/cmd/helm@v3.9.0
test -s $(LOCALBIN)/helm || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" helm.sh/helm/v3/cmd/helm@v3.9.0
.PHONY: ginkgo
ginkgo: $(GINKGO) ## Download ginkgo locally if necessary.
$(GINKGO): $(LOCALBIN)
test -s $(LOCALBIN)/ginkgo || GOBIN=$(LOCALBIN) go install github.com/onsi/ginkgo/v2/ginkgo
test -s $(LOCALBIN)/ginkgo || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" github.com/onsi/ginkgo/v2/ginkgo
.PHONY: kind
kind: $(KIND) ## Download kind locally if necessary.
$(KIND): $(LOCALBIN)
test -s $(LOCALBIN)/kind || GOBIN=$(LOCALBIN) go install sigs.k8s.io/kind/cmd/kind@v0.14.0
test -s $(LOCALBIN)/kind || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" sigs.k8s.io/kind/cmd/kind@v0.14.0
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.1
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.1
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.2
.PHONY: apidocs-gen
apidocs-gen: $(APIDOCS_GEN) ## Download crdoc locally if necessary.
$(APIDOCS_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/crdoc || GOBIN=$(LOCALBIN) go install fybrik.io/crdoc@latest
test -s $(LOCALBIN)/crdoc || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" fybrik.io/crdoc@latest
.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@$(ENVTEST_VERSION)
test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) CGO_ENABLED=0 go install -ldflags="-s -w" sigs.k8s.io/controller-runtime/tools/setup-envtest@$(ENVTEST_VERSION)
##@ Development

View File

@@ -168,7 +168,7 @@ Available only if Kamaji is running using Kine as backing storage.<br/>
<td>
Configure the Kubelet options, such as the preferred address types, or the expected cgroupfs.<br/>
<br/>
<i>Default</i>: map[cgroupfs:systemd preferredAddressTypes:[Hostname InternalIP ExternalIP]]<br/>
<i>Default</i>: map[cgroupfs:systemd preferredAddressTypes:[InternalIP ExternalIP Hostname]]<br/>
</td>
<td>false</td>
</tr><tr>
@@ -13384,7 +13384,7 @@ Available only if Kamaji is running using Kine as backing storage.<br/>
<td>
Configure the Kubelet options, such as the preferred address types, or the expected cgroupfs.<br/>
<br/>
<i>Default</i>: map[cgroupfs:systemd preferredAddressTypes:[Hostname InternalIP ExternalIP]]<br/>
<i>Default</i>: map[cgroupfs:systemd preferredAddressTypes:[InternalIP ExternalIP Hostname]]<br/>
</td>
<td>false</td>
</tr><tr>

View File

@@ -7,7 +7,9 @@ import (
"bytes"
"context"
"fmt"
"io"
"os"
"strconv"
"strings"
"time"
@@ -137,23 +139,49 @@ var _ = Describe("starting a kind worker with kubeadm", func() {
})
By("enabling br_netfilter", func() {
exitCode, _, err := workerContainer.Exec(ctx, []string{"modprobe", "br_netfilter"})
exitCode, stdout, err := workerContainer.Exec(ctx, []string{"modprobe", "br_netfilter"})
Expect(exitCode).To(Equal(0))
Expect(err).ToNot(HaveOccurred())
out, _ := io.ReadAll(stdout)
if len(out) > 0 {
_, _ = fmt.Fprintln(GinkgoWriter, "modprobe failed: "+string(out))
}
if exitCode != 0 {
_, _ = fmt.Fprintln(GinkgoWriter, "modprobe exit code: "+strconv.FormatUint(uint64(exitCode), 10))
}
if err != nil {
_, _ = fmt.Fprintln(GinkgoWriter, "modprobe error: "+err.Error())
}
})
By("disabling swapp", func() {
exitCode, _, err := workerContainer.Exec(ctx, []string{"swapoff", "-a"})
By("disabling swap", func() {
exitCode, stdout, err := workerContainer.Exec(ctx, []string{"swapoff", "-a"})
Expect(exitCode).To(Equal(0))
Expect(err).ToNot(HaveOccurred())
out, _ := io.ReadAll(stdout)
if len(out) > 0 {
_, _ = fmt.Fprintln(GinkgoWriter, "swapoff failed: "+string(out))
}
if exitCode != 0 {
_, _ = fmt.Fprintln(GinkgoWriter, "swapoff exit code: "+strconv.FormatUint(uint64(exitCode), 10))
}
if err != nil {
_, _ = fmt.Fprintln(GinkgoWriter, "swapoff error: "+err.Error())
}
})
By("executing the command in the worker node", func() {
cmds := append(strings.Split(strings.TrimSpace(joinCommandBuffer.String()), " "), "--ignore-preflight-errors=SystemVerification")
cmds := append(strings.Split(strings.TrimSpace(joinCommandBuffer.String()), " "), "--ignore-preflight-errors=SystemVerification,FileExisting")
exitCode, stdout, err := workerContainer.Exec(ctx, cmds)
out, _ := io.ReadAll(stdout)
if len(out) > 0 {
_, _ = fmt.Fprintln(GinkgoWriter, "executing failed: "+string(out))
}
exitCode, _, err := workerContainer.Exec(ctx, cmds)
Expect(exitCode).To(Equal(0))
Expect(err).ToNot(HaveOccurred())
})