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

add or change k8s v1.27 #54

Merged
merged 40 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c7f0443
add or change k8s v1.27
takara9 Oct 20, 2023
f61f0ec
upgrade CONTROLLER_TOOLS_VERSION v0.12.0 -> v0.12.1
takara9 Oct 20, 2023
3efd7f5
update annotation 0.12.1 nyamber.cybozu.io_autovirtualdcs.yaml and ny…
takara9 Oct 20, 2023
0424399
change tmp to PD
takara9 Oct 20, 2023
7f183bc
revert CONTROLLER_TOOLS_VERSION v0.12.1
takara9 Oct 20, 2023
f7bf4ae
revert zz_generated.deepcopy.go
takara9 Oct 20, 2023
c681042
Change ENVTEST_K8S_VERSION by ./bin/setup-envtest list
takara9 Oct 20, 2023
2d7c351
Add comment Makefile, change kustomize ver 5.2.0
takara9 Oct 20, 2023
2d8ae7c
add comment Makefile to avoid pitfalls
takara9 Oct 20, 2023
b23904e
add extra coment at Makefile
takara9 Oct 20, 2023
cb80938
update e2e-test for k8s 1.27
takara9 Oct 20, 2023
2d0b16b
change kustomize v5.2.0 -> v5.2.1
takara9 Oct 20, 2023
f69f84d
update go.mod
takara9 Oct 23, 2023
3ad82fc
fix typo
takara9 Oct 23, 2023
8417447
update go.mod and go.sum
takara9 Oct 23, 2023
821a3bf
fix typo
takara9 Oct 23, 2023
790611c
Change golang ver 1.21 in Dockerfile. It same go version in go.mod
takara9 Oct 23, 2023
26a81d4
Change for PD
takara9 Oct 23, 2023
b817882
Change for PD
takara9 Oct 23, 2023
c08d750
revert go.mod and go.sum
takara9 Oct 23, 2023
9bc0229
update for api change
takara9 Oct 23, 2023
35866f7
update for newer controller-runtime
takara9 Oct 24, 2023
2545a60
change controller-gen.kubebuilder.io/version 0.12.1 -> 0.13.0
takara9 Oct 24, 2023
07d1901
update for 'k8s.io/utils/pointer' is deprecated
takara9 Oct 24, 2023
1284127
update for PD
takara9 Oct 24, 2023
617facc
update BindAddre for PD
takara9 Oct 24, 2023
722a8df
change BindAddres
takara9 Oct 24, 2023
82cee6b
update BindAddress
takara9 Oct 24, 2023
058c097
set 0 BindAddress
takara9 Oct 24, 2023
90a6ae8
update job test numbers
takara9 Oct 24, 2023
4db43e3
test8 extend time 1 -> 5 sec
takara9 Oct 24, 2023
fad5877
fix typo in changing
takara9 Oct 24, 2023
19e7b2e
update using a self-signed certificate will be used
takara9 Oct 24, 2023
76ae05b
config webhook server
takara9 Oct 24, 2023
0daf80b
change timeout 180 -> 500
takara9 Oct 24, 2023
0345803
change for PD
takara9 Oct 24, 2023
91a7aff
change for PD2
takara9 Oct 24, 2023
1327298
change webhook and metrics server
takara9 Oct 24, 2023
457af57
update some version
takara9 Oct 24, 2023
282affa
Update cmd/nyamber-controller/main.go
takara9 Oct 26, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: End-to-End Tests
strategy:
matrix:
k8s-version: ["1.24.12", "1.25.8", "1.26.3"]
k8s-version: ["1.25.8", "1.26.3", "1.27.3"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand Down
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.20-jammy as builder
FROM quay.io/cybozu/golang:1.21-jammy as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.runner
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ RUN --mount=type=cache,target=/go/pkg/mod \
FROM quay.io/cybozu/ubuntu:22.04
LABEL org.opencontainers.image.source https://github.com/cybozu-go/nyamber

ENV GO_VERSION=1.20.4
ENV PLACEMAT_VERSION=2.4.2
ENV GO_VERSION=1.21.3
ENV PLACEMAT_VERSION=2.4.3

ENV HOME=/home/nyamber
ENV GOPATH=${HOME}/go
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ STATICCHECK = $(LOCALBIN)/staticcheck
CRD_TO_MARKDOWN ?= $(LOCALBIN)/crd-to-markdown

## Tool Versions
CONTROLLER_TOOLS_VERSION ?= v0.12.0
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.26.1
KUSTOMIZE_VERSION ?= v5.0.3
CONTROLLER_TOOLS_VERSION ?= v0.13.0

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
# the kubebuilder version of the ready-to-use can get by "./bin/setup-envtest list" command.
ENVTEST_K8S_VERSION = 1.27.1

# KUSTOMIZE_VERSION can be found at https://github.com/kubernetes-sigs/kustomize/releases
KUSTOMIZE_VERSION ?= v5.2.1

# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
Expand Down Expand Up @@ -73,6 +77,10 @@ fmt: ## Run go fmt against code.
vet: ## Run go vet against code.
go vet ./...

# Generate manifests and code, and check if diff exists. When there are diffrences stop CI.
# To avoid CI stopping, edit anotation "controller-gen.kubebuilder.io/version:" in
# existing "nyamber.cybozu.io_virtualdcs.yaml" and "nyamber.cybozu.io_virtualdcs.yaml".
# both version must equal CONTROLLER_TOOLS_VERSION in Makefile.
.PHONY: check-generate
check-generate: ## Generate manifests and code, and check if diff exists.
$(MAKE) manifests
Expand All @@ -91,7 +99,6 @@ apidoc: $(wildcard api/*/*_types.go)
$(CRD_TO_MARKDOWN) -f api/v1beta1/autovirtualdc_types.go -n AutoVirtualDC > docs/crd_autovirtualdc.md

##@ Build

.PHONY: build
build: ## Build manager binary.
go build -o bin/manager main.go
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Nyamber is a custom controller to create Neco environment
- Create dctest pods on the specified schedule

## Supported Software
- Kubernetes: 1.24, 1.25, 1.26
- Kubernetes: 1.25, 1.26, 1.27

## Documentation

Expand Down
1 change: 0 additions & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions aqua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ registries:
name: local
path: registry.yaml
packages:
- name: kubernetes/kubectl@v1.26.4
- name: kubernetes-sigs/kubebuilder@v3.10.0
- name: kubernetes-sigs/kustomize@kustomize/v5.0.3
- name: kubernetes-sigs/kind@v0.18.0
- name: tilt-dev/tilt@v0.32.3
- name: tilt-dev/ctlptl@v0.8.18
- name: mikefarah/yq@v4.33.3
- name: kubernetes/kubectl@v1.27.7
- name: kubernetes-sigs/kubebuilder@v3.12.0
- name: kubernetes-sigs/kustomize@kustomize/v5.2.1
- name: kubernetes-sigs/kind@v0.20.0
- name: tilt-dev/tilt@v0.33.6
- name: tilt-dev/ctlptl@v0.8.22
- name: mikefarah/yq@v4.35.2
- name: clamoriniere/crd-to-markdown@v0.0.3
registry: local
2 changes: 1 addition & 1 deletion cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ apiVersion: ctlptl.dev/v1alpha1
kind: Cluster
name: kind-nyamber-dev
product: kind
kubernetesVersion: v1.26.3
kubernetesVersion: v1.27.3
registry: nyamber-registry
9 changes: 7 additions & 2 deletions cmd/nyamber-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ 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"
"sigs.k8s.io/controller-runtime/pkg/webhook"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -73,10 +75,13 @@ func main() {

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

webHookServer := webhook.NewServer(webhook.Options{
Port: 9443,
})
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
WebhookServer: webHookServer,
Metrics: metricsserver.Options{BindAddress: metricsAddr},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "f8a5f6ae.nyamber.cybozu.io",
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/nyamber.cybozu.io_autovirtualdcs.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.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: autovirtualdcs.nyamber.cybozu.io
spec:
group: nyamber.cybozu.io
Expand Down Expand Up @@ -125,7 +125,7 @@ spec:
compute resources required. If Requests is omitted for
a container, it defaults to Limits if that is explicitly
specified, otherwise to an implementation-defined value.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
Requests cannot exceed Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
skipNecoApps:
Expand Down
5 changes: 3 additions & 2 deletions config/crd/bases/nyamber.cybozu.io_virtualdcs.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.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: virtualdcs.nyamber.cybozu.io
spec:
group: nyamber.cybozu.io
Expand Down Expand Up @@ -104,7 +104,8 @@ spec:
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
skipNecoApps:
Expand Down
13 changes: 7 additions & 6 deletions controllers/autovirtualdc_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/clock/testing"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)

type MockClock struct {
Expand All @@ -35,9 +36,9 @@ var _ = Describe("AutoVirtualDC controller", func() {
time.Sleep(100 * time.Millisecond)

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
LeaderElection: false,
MetricsBindAddress: "0",
Scheme: scheme,
LeaderElection: false,
Metrics: metricsserver.Options{BindAddress: "0"},
})
Expect(err).NotTo(HaveOccurred())

Expand Down Expand Up @@ -112,8 +113,8 @@ var _ = Describe("AutoVirtualDC controller", func() {
APIVersion: "nyamber.cybozu.io/v1beta1",
UID: avdc.UID,
Name: avdc.Name,
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To[bool](true),
BlockOwnerDeletion: ptr.To[bool](true),
}
Expect(vdc.ObjectMeta.OwnerReferences).To(ContainElement(expectedOwnerReference))
})
Expand Down
7 changes: 3 additions & 4 deletions controllers/virtualdc_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"
"sigs.k8s.io/yaml"
)

Expand Down Expand Up @@ -446,7 +445,7 @@ func (r *VirtualDCReconciler) deleteService(ctx context.Context, vdc *nyamberv1b

// SetupWithManager sets up the controller with the Manager.
func (r *VirtualDCReconciler) SetupWithManager(mgr ctrl.Manager) error {
vdcHandler := func(o client.Object) []reconcile.Request {
vdcHandler := func(c context.Context, o client.Object) []reconcile.Request {
owner := o.GetLabels()[constants.LabelKeyOwnerNamespace]
if owner == "" {
return nil
Expand All @@ -456,8 +455,8 @@ func (r *VirtualDCReconciler) SetupWithManager(mgr ctrl.Manager) error {

return ctrl.NewControllerManagedBy(mgr).
For(&nyamberv1beta1.VirtualDC{}).
Watches(&source.Kind{Type: &corev1.Pod{}}, handler.EnqueueRequestsFromMapFunc(vdcHandler)).
Watches(&source.Kind{Type: &corev1.Service{}}, handler.EnqueueRequestsFromMapFunc(vdcHandler)).
Watches(&corev1.Pod{}, handler.EnqueueRequestsFromMapFunc(vdcHandler)).
Watches(&corev1.Service{}, handler.EnqueueRequestsFromMapFunc(vdcHandler)).
Complete(r)
}

Expand Down
9 changes: 5 additions & 4 deletions controllers/virtualdc_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)

type mockJobProcessManager struct {
Expand Down Expand Up @@ -69,9 +70,9 @@ var _ = Describe("VirtualDC controller", func() {
time.Sleep(100 * time.Millisecond)

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
LeaderElection: false,
MetricsBindAddress: "0",
Scheme: scheme,
LeaderElection: false,
Metrics: metricsserver.Options{BindAddress: "0"},
})
Expect(err).NotTo(HaveOccurred())

Expand Down Expand Up @@ -497,6 +498,7 @@ kind: Pod`
})

It("should recreate the service resource when the service resource is deleted", func() {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this empty line intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not, I will delete this line.

By("creating a VirtualDC resource")
vdc := &nyamberv1beta1.VirtualDC{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -514,7 +516,6 @@ kind: Pod`
}).Should(Succeed())

uid := svc.GetUID()

err = k8sClient.Delete(ctx, svc)
Expect(err).NotTo(HaveOccurred())
Eventually(func() error {
Expand Down
4 changes: 2 additions & 2 deletions e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NOTE: kind version is specified at aqua.yaml
E2ETEST_K8S_VERSION := 1.26.3
CERT_MANAGER_VERSION := 1.11.2
E2ETEST_K8S_VERSION := 1.27.3
CERT_MANAGER_VERSION := 1.13.1

PROJECT_DIR := $(CURDIR)/../
BIN_DIR := $(PROJECT_DIR)/bin
Expand Down
Loading