Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support k8s 1.27 and update dependencies #251

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.go-version }}
- name: Cache tools
Expand All @@ -39,12 +39,12 @@ jobs:
name: End-to-end Test
strategy:
matrix:
kindest-node: ["1.24.12", "1.25.8", "1.26.3"]
kindest-node: ["1.25.9", "1.26.4", "1.27.1"]
ip-version: ["ipv4", "ipv6"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.go-version }}
- run: make image
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.go-version }}
- name: Set up QEMU
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
id: set-tag
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT # Remove "v" prefix.
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: ./v2
platforms: linux/amd64,linux/arm64/v8
Expand Down
4 changes: 2 additions & 2 deletions v2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

IMAGE_TAG := latest
CONTROLLER_RUNTIME_VERSION := $(shell awk '/sigs\.k8s\.io\/controller-runtime/ {print substr($$2, 2)}' go.mod)
CONTROLLER_TOOLS_VERSION=0.11.4
PROTOC_VERSION=22.3
CONTROLLER_TOOLS_VERSION=0.12.1
PROTOC_VERSION=23.4
PROTOC_GEN_GO_VERSION := $(shell awk '/google.golang.org\/protobuf/ {print substr($$2, 2)}' go.mod)
PROTOC_GEN_GO_GRPC_VERSON=1.3.0
PROTOC_GEN_DOC_VERSION=1.5.1
Expand Down
2 changes: 1 addition & 1 deletion v2/config/crd/bases/coil.cybozu.com_addressblocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
controller-gen.kubebuilder.io/version: v0.12.1
name: addressblocks.coil.cybozu.com
spec:
group: coil.cybozu.com
Expand Down
2 changes: 1 addition & 1 deletion v2/config/crd/bases/coil.cybozu.com_addresspools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
controller-gen.kubebuilder.io/version: v0.12.1
name: addresspools.coil.cybozu.com
spec:
group: coil.cybozu.com
Expand Down
2 changes: 1 addition & 1 deletion v2/config/crd/bases/coil.cybozu.com_blockrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
controller-gen.kubebuilder.io/version: v0.12.1
name: blockrequests.coil.cybozu.com
spec:
group: coil.cybozu.com
Expand Down
2 changes: 1 addition & 1 deletion v2/config/crd/bases/coil.cybozu.com_egresses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
controller-gen.kubebuilder.io/version: v0.12.1
name: egresses.coil.cybozu.com
spec:
group: coil.cybozu.com
Expand Down
4 changes: 2 additions & 2 deletions v2/e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
KIND_VERSION=0.18.0
KUBERNETES_VERSION=1.26.3
KIND_VERSION=0.19.0
KUBERNETES_VERSION=1.27.1
KUSTOMIZE_VERSION = 5.0.1
BINDIR := $(abspath $(PWD)/../bin)

Expand Down
35 changes: 35 additions & 0 deletions v2/e2e/coil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"errors"
"fmt"
"os"
"os/exec"
"strings"
"time"

coilv2 "github.com/cybozu-go/coil/v2/api/v2"
Expand Down Expand Up @@ -308,6 +310,39 @@ var _ = Describe("Coil", func() {
go runOnNode("coil-control-plane", "/usr/local/bin/echotest")
time.Sleep(100 * time.Millisecond)

By("debug 1")
stdout := execSafe(nil, "sudo", "ip", "netns", "list-id")
fmt.Println(string(stdout))

By("debug 2")
stdout = execSafe(nil, "docker", "inspect", "--format={{.State.Pid}}", "coil-control-plane")
fmt.Println(string(stdout))

By("debug 3")
stdout = execSafe(nil, "sudo", "ip", "netns", "attach", "coil-control-plane", strings.TrimSpace(string(stdout)))
fmt.Println(string(stdout))

By("debug 4")
stdout = execSafe(nil, "sudo", "ip", "netns", "list")
fmt.Println(string(stdout))

By("debug 5")
stdout = execSafe(nil, "sudo", "ip", "netns", "exec", "coil-control-plane", "netstat", "-tln")

By("debug 6")
stdout = execSafe(stdout, "grep", "-w", "80")
fmt.Println(string(stdout))

By("debug 7")
stdout = execSafe(nil, "sudo", "ip", "netns", "exec", "coil-control-plane", "ip", "a", "show", "dummy-fake")
fmt.Println(string(stdout))

By("debug 100")
cmd := exec.Command(kubectlCmd, "exec", "nat-client", "--", "curl", "-svvv", fakeURL)
cmd.Stderr = os.Stderr
_, err = cmd.Output()
Expect(err).NotTo(HaveOccurred())

By("sending and receiving HTTP request from nat-client")
data := make([]byte, 1<<20) // 1 MiB
resp := kubectlSafe(data, "exec", "-i", "nat-client", "--", "curl", "-sf", "-T", "-", fakeURL)
Expand Down
11 changes: 11 additions & 0 deletions v2/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ func TestE2e(t *testing.T) {

var kubectlCmd = os.Getenv("KUBECTL")

func execSafe(input []byte, command string, args ...string) []byte {
cmd := exec.Command(command, args...)
if input != nil {
cmd.Stdin = bytes.NewReader(input)
}
cmd.Stderr = os.Stderr
stdout, err := cmd.Output()
ExpectWithOffset(1, err).ShouldNot(HaveOccurred())
return stdout
}

func kubectl(input []byte, args ...string) (stdout []byte, err error) {
if kubectlCmd == "" {
panic("KUBECTL environment variable must be set")
Expand Down
52 changes: 26 additions & 26 deletions v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ module github.com/cybozu-go/coil/v2
go 1.20

require (
github.com/bits-and-blooms/bitset v1.7.0
github.com/bits-and-blooms/bitset v1.8.0
github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.2.0
github.com/coreos/go-iptables v0.6.0
github.com/cybozu-go/netutil v1.4.4
github.com/cybozu-go/netutil v1.4.5
github.com/go-logr/logr v1.2.4
github.com/go-logr/zapr v1.2.3
github.com/go-logr/zapr v1.2.4
github.com/google/go-cmp v0.5.9
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/onsi/ginkgo/v2 v2.9.2
github.com/onsi/gomega v1.27.6
github.com/prometheus/client_golang v1.15.0
github.com/prometheus/client_model v0.3.0
github.com/prometheus/common v0.42.0
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.10
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/client_model v0.4.0
github.com/prometheus/common v0.44.0
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.15.0
github.com/spf13/viper v1.16.0
github.com/vishvananda/netlink v1.2.1-beta.2
go.uber.org/zap v1.24.0
golang.org/x/sys v0.7.0
google.golang.org/grpc v1.54.0
google.golang.org/protobuf v1.30.0
golang.org/x/sys v0.10.0
google.golang.org/grpc v1.57.0
google.golang.org/protobuf v1.31.0
k8s.io/api v0.26.4
k8s.io/apimachinery v0.26.4
k8s.io/client-go v0.26.4
Expand All @@ -49,7 +49,7 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/google/pprof v0.0.0-20230728192033-2ba5b33183c6 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
Expand All @@ -63,27 +63,27 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/safchain/ethtool v0.2.0 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/vishvananda/netns v0.0.3 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.7.0 // indirect
golang.org/x/tools v0.11.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731193218-e0aa005b6bdf // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading
Loading