Skip to content

Commit

Permalink
Update for Kubernetes 1.25
Browse files Browse the repository at this point in the history
Signed-off-by: Xabier Larrakoetxea <me@slok.dev>
  • Loading branch information
slok committed Oct 23, 2022
1 parent 4a75de8 commit 964d404
Show file tree
Hide file tree
Showing 29 changed files with 936 additions and 844 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: Check
runs-on: ubuntu-latest
# Execute the checks inside the container instead the VM.
container: golangci/golangci-lint:v1.42.1-alpine
container: golangci/golangci-lint:v1.50.0-alpine
steps:
- uses: actions/checkout@v3
- run: ./hack/scripts/check.sh
Expand All @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version-file: go.mod
- run: make ci-unit-test

integration-test:
Expand All @@ -28,17 +28,15 @@ jobs:
needs: [check, unit-test]
strategy:
matrix:
kubernetes: [1.20.15, 1.21.12, 1.22.9, 1.23.6, 1.24.0]
env:
KIND_VERSION: v0.14.0
kubernetes: [1.21.14, 1.22.15, 1.23.12, 1.24.6, 1.25.2]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
go-version-file: go.mod
- name: Execute tests
env:
KIND_VERSION: v0.14.0
KIND_VERSION: v0.16.0
run: |
# Get dependencies.
echo "Getting dependencies..."
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
## [unreleased]

- Update Kubernetes libraries for 1.23.
- Update Kubernetes libraries for 1.25.

## [2.2.0] - 2021-08-30

- Update Kubernetes libraries for 1.24.

## [2.1.0] - 2021-10-07

- Update Kubernetes libraries for 1.22.

## [2.0.0] - 2021-07-24
## [2.0.0] - 2020-07-24

NOTE: Breaking release in controllers.

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Kooper [![Build Status][travis-image]][travis-url] [![Go Report Card][goreport-image]][goreport-url] [![GoDoc][godoc-image]][godoc-url]
# Kooper

[![CI](https://github.com/spotahome/kooper/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/spotahome/kooper/actions/workflows/ci.yaml)
[![Go Report Card](https://goreportcard.com/badge/github.com/spotahome/kooper)](https://goreportcard.com/report/github.com/spotahome/kooper)
[![Apache 2 licensed](https://img.shields.io/badge/license-Apache2-blue.svg)](https://raw.githubusercontent.com/spotahome/kooper/master/LICENSE)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/spotahome/kooper)](https://github.com/spotahome/kooper/releases/latest)
![Kubernetes release](https://img.shields.io/badge/Kubernetes-v1.25-green?logo=Kubernetes&style=flat&color=326CE5&logoColor=white)

Kooper is a Go library to create simple and flexible Kubernetes [controllers]/operators, in a fast, decoupled and easy way.

Expand Down
17 changes: 16 additions & 1 deletion controller/controllermock/handler.go

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

2 changes: 1 addition & 1 deletion controller/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Handler interface {
Handle(context.Context, runtime.Object) error
}

//go:generate mockery -case underscore -output controllermock -outpkg controllermock -name Handler
//go:generate mockery --case underscore --output controllermock --outpkg controllermock --name Handler

// HandlerFunc knows how to handle resource adds.
type HandlerFunc func(context.Context, runtime.Object) error
Expand Down
60 changes: 30 additions & 30 deletions doc.go
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
// Package kooper is a Go library to create simple and flexible Kubernetes controllers/operators easily.
// Is as simple as this:
//
// // Create our retriever so the controller knows how to get/listen for pod events.
// retr := controller.MustRetrieverFromListerWatcher(&cache.ListWatch{
// ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
// return k8scli.CoreV1().Pods("").List(options)
// },
// WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
// return k8scli.CoreV1().Pods("").Watch(options)
// },
// })
// // Create our retriever so the controller knows how to get/listen for pod events.
// retr := controller.MustRetrieverFromListerWatcher(&cache.ListWatch{
// ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
// return k8scli.CoreV1().Pods("").List(options)
// },
// WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
// return k8scli.CoreV1().Pods("").Watch(options)
// },
// })
//
// // Our domain logic that will print all pod events.
// hand := controller.HandlerFunc(func(_ context.Context, obj runtime.Object) error {
// pod := obj.(*corev1.Pod)
// logger.Infof("Pod event: %s/%s", pod.Namespace, pod.Name)
// return nil
// })
// // Our domain logic that will print all pod events.
// hand := controller.HandlerFunc(func(_ context.Context, obj runtime.Object) error {
// pod := obj.(*corev1.Pod)
// logger.Infof("Pod event: %s/%s", pod.Namespace, pod.Name)
// return nil
// })
//
// // Create the controller with custom configuration.
// cfg := &controller.Config{
// Name: "example-controller",
// Handler: hand,
// Retriever: retr,
// Logger: logger,
// }
// ctrl, err := controller.New(cfg)
// if err != nil {
// return fmt.Errorf("could not create controller: %w", err)
// }
// // Create the controller with custom configuration.
// cfg := &controller.Config{
// Name: "example-controller",
// Handler: hand,
// Retriever: retr,
// Logger: logger,
// }
// ctrl, err := controller.New(cfg)
// if err != nil {
// return fmt.Errorf("could not create controller: %w", err)
// }
//
// // Start our controller.
// ctx, cancel := context.WithCancel(context.Background())
// defer cancel()
// ctrl.Run(ctx)
// // Start our controller.
// ctx, cancel := context.WithCancel(context.Background())
// defer cancel()
// ctrl.Run(ctx)
package kooper
6 changes: 3 additions & 3 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.18.4
FROM golang:1.19.2

ARG GOLANGCI_LINT_VERSION="1.42.1"
ARG MOCKERY_VERSION="2.9.2"
ARG GOLANGCI_LINT_VERSION="1.50.0"
ARG MOCKERY_VERSION="2.14.0"
ARG ostype=Linux

RUN apt-get update && apt-get install -y \
Expand Down
4 changes: 2 additions & 2 deletions examples/pod-terminator-operator/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

CODE_GENERATOR_IMAGE := quay.io/slok/kube-code-generator:v1.17.3
CRD_GENERATOR_IMAGE := quay.io/slok/kube-code-generator:latest
CODE_GENERATOR_IMAGE := quay.io/slok/kube-code-generator:v1.25.0
CRD_GENERATOR_IMAGE := quay.io/slok/kube-code-generator:v1.25.0
DIRECTORY := $(PWD)
ROOT_DIRECTORY := $(DIRECTORY)/../..
CODE_GENERATOR_PACKAGE := github.com/spotahome/kooper/examples/pod-terminator-operator/v2
Expand Down

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

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

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

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

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

Loading

0 comments on commit 964d404

Please sign in to comment.