Skip to content

Commit

Permalink
Support Kubernetes 1.28 (#285)
Browse files Browse the repository at this point in the history
* Support Kubernetes 1.28

Signed-off-by: terashima <[email protected]>

---------

Signed-off-by: terashima <[email protected]>
  • Loading branch information
terassyi authored May 1, 2024
1 parent 7db1096 commit 5faaa12
Show file tree
Hide file tree
Showing 26 changed files with 248 additions and 259 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ jobs:
name: End-to-end Test
strategy:
matrix:
kindest-node: ["1.25.9", "1.26.4", "1.27.1"]
kindest-node: ["1.26.14", "1.27.11", "1.28.7"]
ip-version: ["ipv4", "ipv6"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.go-version }}
- run: make image
Expand All @@ -67,7 +67,7 @@ jobs:
- run: make logs
working-directory: v2/e2e
if: always()
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: logs-${{ matrix.ip-version }}-${{ matrix.kindest-node }}.tar.gz
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@v4
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.go-version }}
- name: Set up QEMU
Expand All @@ -26,7 +26,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Cache tools
id: cache-tools
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
v2/bin
Expand Down
4 changes: 2 additions & 2 deletions v2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

IMAGE_TAG := latest
CONTROLLER_RUNTIME_VERSION := $(shell awk '/sigs\.k8s\.io\/controller-runtime/ {print substr($$2, 2)}' go.mod)
CONTROLLER_TOOLS_VERSION=0.14.0
CONTROLLER_TOOLS_VERSION=0.15.0
PROTOC_VERSION=26.0
PROTOC_GEN_GO_VERSION := $(shell awk '/google.golang.org\/protobuf/ {print substr($$2, 2)}' go.mod)
PROTOC_GEN_GO_GRPC_VERSON=1.3.0
Expand Down Expand Up @@ -70,7 +70,7 @@ check-generate:
$(MAKE) generate
$(MAKE) manifests
go mod tidy
git diff --exit-code --name-only
git diff --exit-code

# Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
Expand Down
16 changes: 10 additions & 6 deletions v2/api/v2/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
Expand Down Expand Up @@ -75,12 +77,14 @@ var _ = BeforeSuite(func() {
// start webhook server using Manager
webhookInstallOptions := &testEnv.WebhookInstallOptions
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
Host: webhookInstallOptions.LocalServingHost,
Port: webhookInstallOptions.LocalServingPort,
CertDir: webhookInstallOptions.LocalServingCertDir,
LeaderElection: false,
MetricsBindAddress: "0",
Scheme: scheme,
WebhookServer: webhook.NewServer(webhook.Options{
Host: webhookInstallOptions.LocalServingHost,
Port: webhookInstallOptions.LocalServingPort,
CertDir: webhookInstallOptions.LocalServingCertDir,
}),
LeaderElection: false,
Metrics: server.Options{BindAddress: "0"},
})
Expect(err).NotTo(HaveOccurred())

Expand Down
16 changes: 11 additions & 5 deletions v2/cmd/coil-controller/sub/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package sub

import (
"fmt"
v2 "github.com/cybozu-go/coil/v2"
"net"
"os"
"strconv"
"time"

v2 "github.com/cybozu-go/coil/v2"
coilv2 "github.com/cybozu-go/coil/v2/api/v2"
"github.com/cybozu-go/coil/v2/controllers"
"github.com/cybozu-go/coil/v2/pkg/constants"
Expand All @@ -21,6 +21,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"
)

const (
Expand Down Expand Up @@ -57,12 +59,16 @@ func subMain() error {
LeaderElection: true,
LeaderElectionID: "coil-leader",
LeaderElectionNamespace: "kube-system", // coil should run in kube-system
MetricsBindAddress: config.metricsAddr,
Metrics: metricsserver.Options{
BindAddress: config.metricsAddr,
},
GracefulShutdownTimeout: &timeout,
HealthProbeBindAddress: config.healthAddr,
Host: host,
Port: port,
CertDir: config.certDir,
WebhookServer: webhook.NewServer(webhook.Options{
Host: host,
Port: port,
CertDir: config.certDir,
}),
})
if err != nil {
return err
Expand Down
11 changes: 7 additions & 4 deletions v2/cmd/coil-egress/sub/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package sub
import (
"errors"
"fmt"
v2 "github.com/cybozu-go/coil/v2"
"net"
"os"
"strings"
"time"

v2 "github.com/cybozu-go/coil/v2"
"github.com/cybozu-go/coil/v2/controllers"
"github.com/cybozu-go/coil/v2/pkg/constants"
"github.com/cybozu-go/coil/v2/pkg/founat"
Expand All @@ -18,6 +18,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)

const (
Expand Down Expand Up @@ -69,9 +70,11 @@ func subMain() error {

timeout := gracefulTimeout
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
LeaderElection: false,
MetricsBindAddress: config.metricsAddr,
Scheme: scheme,
LeaderElection: false,
Metrics: metricsserver.Options{
BindAddress: config.metricsAddr,
},
GracefulShutdownTimeout: &timeout,
HealthProbeBindAddress: config.healthAddr,
})
Expand Down
11 changes: 7 additions & 4 deletions v2/cmd/coil-router/sub/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package sub
import (
"errors"
"fmt"
v2 "github.com/cybozu-go/coil/v2"
"os"
"time"

v2 "github.com/cybozu-go/coil/v2"
coilv2 "github.com/cybozu-go/coil/v2/api/v2"
"github.com/cybozu-go/coil/v2/controllers"
"github.com/cybozu-go/coil/v2/pkg/constants"
Expand All @@ -18,6 +18,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)

const (
Expand Down Expand Up @@ -46,9 +47,11 @@ func subMain() error {

timeout := gracefulTimeout
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
LeaderElection: false,
MetricsBindAddress: config.metricsAddr,
Scheme: scheme,
LeaderElection: false,
Metrics: metricsserver.Options{
BindAddress: config.metricsAddr,
},
GracefulShutdownTimeout: &timeout,
HealthProbeBindAddress: config.healthAddr,
})
Expand Down
11 changes: 7 additions & 4 deletions v2/cmd/coild/sub/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"context"
"errors"
"fmt"
v2 "github.com/cybozu-go/coil/v2"
"net"
"os"
"time"

v2 "github.com/cybozu-go/coil/v2"
coilv2 "github.com/cybozu-go/coil/v2/api/v2"
"github.com/cybozu-go/coil/v2/controllers"
"github.com/cybozu-go/coil/v2/pkg/constants"
Expand All @@ -23,6 +23,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)

const (
Expand Down Expand Up @@ -56,9 +57,11 @@ func subMain() error {

timeout := gracefulTimeout
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
LeaderElection: false,
MetricsBindAddress: config.metricsAddr,
Scheme: scheme,
LeaderElection: false,
Metrics: metricsserver.Options{
BindAddress: config.metricsAddr,
},
GracefulShutdownTimeout: &timeout,
HealthProbeBindAddress: config.healthAddr,
})
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.14.0
controller-gen.kubebuilder.io/version: v0.15.0
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.14.0
controller-gen.kubebuilder.io/version: v0.15.0
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.14.0
controller-gen.kubebuilder.io/version: v0.15.0
name: blockrequests.coil.cybozu.com
spec:
group: coil.cybozu.com
Expand Down
Loading

0 comments on commit 5faaa12

Please sign in to comment.