Skip to content

Commit

Permalink
Merge pull request #57 from cybozu-go/k8s-1.24
Browse files Browse the repository at this point in the history
Support Kubernetes 1.24
  • Loading branch information
masa213f authored Jul 25, 2022
2 parents 8086cc8 + ef064bb commit fd6475e
Show file tree
Hide file tree
Showing 26 changed files with 312 additions and 213 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ on:
branches:
- 'main'
env:
go-version: 1.17
go-version: 1.18
cache-version: 1
jobs:
build:
name: Build binaries
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
- run: make release-build
test:
name: Small tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
- run: make test
Expand All @@ -32,11 +32,11 @@ jobs:
name: End-to-End Tests
strategy:
matrix:
k8s-version: ["1.20.7", "1.21.2", "1.22.4"]
k8s-version: ["1.22.9", "1.23.6", "1.24.0"]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
- run: make start KUBERNETES_VERSION=${{ matrix.k8s-version }}
Expand All @@ -46,7 +46,7 @@ jobs:
- run: make logs
working-directory: e2e
if: always()
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: always()
with:
name: logs-${{ matrix.k8s-version }}.tar.gz
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/helm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v3
with:
version: v3.6.3

Expand All @@ -32,7 +32,7 @@ jobs:
- name: Packaging the chart
run: helm package ./charts/accurate/

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: helm-charts
path: ./accurate-*.tgz
Expand All @@ -43,16 +43,16 @@ jobs:
runs-on: ubuntu-20.04
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: gh-pages

- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v3
with:
version: v3.6.3

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: helm-charts

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1
uses: helm/chart-testing-action@v2.2.1

- name: Run chart-testing (list-changed)
id: list-changed
Expand All @@ -35,7 +35,7 @@ jobs:
run: ct lint --config ct.yaml

- name: Create kind cluster
uses: helm/kind-action@v1.2.0
uses: helm/kind-action@v1.3.0
if: steps.list-changed.outputs.changed == 'true'
with:
node_image: kindest/node:v1.21.2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/mdbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
name: Build book
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: make book
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: book
path: docs/book
Expand All @@ -21,12 +21,12 @@ jobs:
runs-on: ubuntu-20.04
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: gh-pages
# ignore helm chart index file and chart archive file.
- run: ls | grep -v -E 'index.yaml|accurate-.*\.tgz' | xargs rm -rf
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: book
- run: git add .
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
tags:
- 'v*'
env:
go-version: 1.17
go-version: 1.18
jobs:
image:
name: Push Container Image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build images
run: |
docker build -t accurate:dev .
Expand All @@ -26,18 +26,19 @@ jobs:
needs: image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
- name: GoReleaser
uses: goreleaser/goreleaser-action@v2
# v3.0.0 https://github.com/goreleaser/goreleaser-action/releases/tag/v3.0.0
uses: goreleaser/goreleaser-action@68acf3b1adf004ac9c2f0a4259e85c5f66e99bef
with:
distribution: goreleaser
version: v0.180.3
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update new version in krew-index
# v0.0.40 https://github.com/rajatjindal/krew-release-bot/releases/tag/v0.0.40
uses: rajatjindal/krew-release-bot@56925b62bacc2c652114d66a8256faaf0bf89fa9
# v0.0.43 https://github.com/rajatjindal/krew-release-bot/releases/tag/v0.0.43
uses: rajatjindal/krew-release-bot@92da038bbf995803124a8e50ebd438b2f37bbbb0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM quay.io/cybozu/golang:1.17-focal as builder
FROM quay.io/cybozu/golang:1.18-focal as builder

COPY ./ .
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o accurate-controller ./cmd/accurate-controller
Expand Down
24 changes: 9 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Tool versions
CTRL_TOOLS_VERSION=0.7.0
CTRL_TOOLS_VERSION=0.9.2
CTRL_RUNTIME_VERSION := $(shell awk '/sigs.k8s.io\/controller-runtime/ {print substr($$2, 2)}' go.mod)
KUSTOMIZE_VERSION = 4.4.1
YQ_VERSION = 4.17.2
HELM_VERSION = 3.7.1
KUSTOMIZE_VERSION = 4.5.5
YQ_VERSION = 4.26.1
HELM_VERSION = 3.9.1
CRD_TO_MARKDOWN_VERSION = 0.0.3
MDBOOK_VERSION = 0.4.14
GORELEASER_VERSION = 1.1.0
MDBOOK_VERSION = 0.4.20
GORELEASER_VERSION = 1.10.2

# Test tools
BIN_DIR := $(shell pwd)/bin
STATICCHECK := $(BIN_DIR)/staticcheck
NILERR := $(BIN_DIR)/nilerr
SUDO = sudo

# Set the shell used to bash for better error handling.
Expand Down Expand Up @@ -74,9 +73,9 @@ check-generate:
.PHONY: envtest
envtest: setup-envtest
source <($(SETUP_ENVTEST) use -p env); \
TEST_CONFIG=1 go test -v -count 1 -race ./pkg/config -ginkgo.progress -ginkgo.v -ginkgo.failFast
TEST_CONFIG=1 go test -v -count 1 -race ./pkg/config -ginkgo.progress -ginkgo.v -ginkgo.fail-fast
source <($(SETUP_ENVTEST) use -p env); \
go test -v -count 1 -race ./controllers -ginkgo.progress -ginkgo.v -ginkgo.failFast
go test -v -count 1 -race ./controllers -ginkgo.progress -ginkgo.v -ginkgo.fail-fast
source <($(SETUP_ENVTEST) use -p env); \
go test -v -count 1 -race ./hooks -ginkgo.progress -ginkgo.v

Expand All @@ -87,7 +86,6 @@ test: test-tools
go vet ./...
test -z $$(gofmt -s -l . | tee /dev/stderr)
$(STATICCHECK) ./...
$(NILERR) ./...

##@ Build

Expand Down Expand Up @@ -171,12 +169,8 @@ GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
endef

.PHONY: test-tools
test-tools: $(STATICCHECK) $(NILERR)
test-tools: $(STATICCHECK)

$(STATICCHECK):
mkdir -p $(BIN_DIR)
GOBIN=$(BIN_DIR) go install honnef.co/go/tools/cmd/staticcheck@latest

$(NILERR):
mkdir -p $(BIN_DIR)
GOBIN=$(BIN_DIR) go install github.com/gostaticanalysis/nilerr/cmd/nilerr@latest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.9.2
labels:
app.kubernetes.io/name: accurate
name: subnamespaces.accurate.cybozu.com
Expand Down
9 changes: 1 addition & 8 deletions config/crd/bases/accurate.cybozu.com_subnamespaces.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: subnamespaces.accurate.cybozu.com
spec:
Expand Down Expand Up @@ -57,9 +56,3 @@ spec:
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
1 change: 0 additions & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
2 changes: 0 additions & 2 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
Expand Down Expand Up @@ -26,7 +25,6 @@ webhooks:
resources:
- subnamespaces
sideEffects: None

---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
Expand Down
2 changes: 1 addition & 1 deletion controllers/namespace_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/cybozu-go/accurate/pkg/cluster"
"github.com/cybozu-go/accurate/pkg/constants"
"github.com/cybozu-go/accurate/pkg/indexing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down
2 changes: 1 addition & 1 deletion controllers/propagate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/cybozu-go/accurate/pkg/constants"
"github.com/cybozu-go/accurate/pkg/indexing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down
2 changes: 1 addition & 1 deletion controllers/subnamespace_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

accuratev1 "github.com/cybozu-go/accurate/api/v1"
"github.com/cybozu-go/accurate/pkg/constants"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down
4 changes: 2 additions & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"go.uber.org/zap/zapcore"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -109,7 +109,7 @@ var _ = BeforeSuite(func() {
err = k8sClient.Create(context.Background(), ns)
Expect(err).NotTo(HaveOccurred())

}, 60)
})

var _ = AfterSuite(func() {
By("tearing down the test environment")
Expand Down
10 changes: 5 additions & 5 deletions e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
KIND_VERSION = 0.11.1
KUBERNETES_VERSION = 1.22.4
CERT_MANAGER_VERSION = 1.6.1
SEALED_SECRETS_VERSION = 0.17.2
KIND_VERSION = 0.14.0
KUBERNETES_VERSION = 1.24.0
CERT_MANAGER_VERSION = 1.8.2
SEALED_SECRETS_VERSION = 0.18.1

KIND := $(dir $(shell pwd))/bin/kind
KUBECTL := $(dir $(shell pwd))/bin/kubectl
Expand Down Expand Up @@ -43,7 +43,7 @@ start: $(KIND) $(KUBECTL) $(HELM) $(KUBESEAL) $(KUBECTL_ACCURATE)
.PHONY: test
test:
env PATH=$$(pwd)/../bin:$$PATH RUN_E2E=1 \
go test -v -race . -ginkgo.progress -ginkgo.v -ginkgo.failFast
go test -v -race . -ginkgo.progress -ginkgo.v -ginkgo.fail-fast

.PHONY: logs
logs:
Expand Down
Loading

0 comments on commit fd6475e

Please sign in to comment.