Skip to content

Commit

Permalink
Support k8s 1.27 and update dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Daichi Sakaue <[email protected]>
  • Loading branch information
yokaze committed Jul 31, 2023
1 parent e964dfd commit 31262e1
Show file tree
Hide file tree
Showing 21 changed files with 370 additions and 262 deletions.
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.11", "1.26.6", "1.27.3"]
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Version 2 is generally available (GA). It conforms to [CNI spec 0.4.0](https://

## Dependencies

- Kubernetes Version: 1.24, 1.25, 1.26
- Kubernetes Version: 1.25, 1.26, 1.27
- Other versions are likely to work, but not tested.

- (Optional) Routing software
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
17 changes: 9 additions & 8 deletions v2/api/v2/addresspool_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// SetupWebhookWithManager registers webhooks for AddressPool
Expand All @@ -33,26 +34,26 @@ func (r *AddressPool) Default() {
var _ webhook.Validator = &AddressPool{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *AddressPool) ValidateCreate() error {
func (r *AddressPool) ValidateCreate() (admission.Warnings, error) {
errs := r.Spec.validate()
if len(errs) == 0 {
return nil
return nil, nil
}

return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "AddressPool"}, r.Name, errs)
return nil, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "AddressPool"}, r.Name, errs)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *AddressPool) ValidateUpdate(old runtime.Object) error {
func (r *AddressPool) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
errs := r.Spec.validateUpdate(old.(*AddressPool).Spec)
if len(errs) == 0 {
return nil
return nil, nil
}

return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "AddressPool"}, r.Name, errs)
return nil, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "AddressPool"}, r.Name, errs)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *AddressPool) ValidateDelete() error {
return nil
func (r *AddressPool) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
17 changes: 9 additions & 8 deletions v2/api/v2/egress_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// SetupWebhookWithManager setups the webhook for Egress
Expand Down Expand Up @@ -43,26 +44,26 @@ func (r *Egress) Default() {
var _ webhook.Validator = &Egress{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Egress) ValidateCreate() error {
func (r *Egress) ValidateCreate() (admission.Warnings, error) {
errs := r.Spec.validate()
if len(errs) == 0 {
return nil
return nil, nil
}

return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "Egress"}, r.Name, errs)
return nil, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "Egress"}, r.Name, errs)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Egress) ValidateUpdate(old runtime.Object) error {
func (r *Egress) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
errs := r.Spec.validateUpdate(old.(*Egress).Spec)
if len(errs) == 0 {
return nil
return nil, nil
}

return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "Egress"}, r.Name, errs)
return nil, apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: "Egress"}, r.Name, errs)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *Egress) ValidateDelete() error {
return nil
func (r *Egress) ValidateDelete() (admission.Warnings, error) {
return nil, nil
}
3 changes: 2 additions & 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,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: addressblocks.coil.cybozu.com
spec:
group: coil.cybozu.com
Expand Down
3 changes: 2 additions & 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,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: addresspools.coil.cybozu.com
spec:
group: coil.cybozu.com
Expand Down
3 changes: 2 additions & 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,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.4
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: blockrequests.coil.cybozu.com
spec:
group: coil.cybozu.com
Expand Down
Loading

0 comments on commit 31262e1

Please sign in to comment.