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

Test #100

Merged
merged 26 commits into from
May 12, 2024
Merged

Test #100

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6e9a5b4
Add missing dots at end of log messagges
janekbaraniewski May 5, 2024
187debd
Bump go
janekbaraniewski May 5, 2024
33a8116
Bump go in tests
janekbaraniewski May 5, 2024
bcc3345
Disable openapi-gen for a moment
janekbaraniewski May 5, 2024
5d1519f
Update codegen scripts
janekbaraniewski May 5, 2024
bd96105
Add missing chmod
janekbaraniewski May 5, 2024
a77bddd
Some more fixes after version bump
janekbaraniewski May 5, 2024
554ba83
Skip device coontroller tests for now
janekbaraniewski May 6, 2024
d7dc358
Update code-gen script
janekbaraniewski May 6, 2024
bddfae9
Bump few dependencies
janekbaraniewski May 6, 2024
ca8c115
Update crds chart after bump of libs
janekbaraniewski May 6, 2024
d175cc3
Debug codegen ci
janekbaraniewski May 6, 2024
dcb9b74
Lint issues
janekbaraniewski May 7, 2024
b520c88
Fix lint issues
janekbaraniewski May 11, 2024
88c44ee
Fix go version in docker images
janekbaraniewski May 11, 2024
8535c4b
Fix debian vevrsion
janekbaraniewski May 11, 2024
ac26452
Bump actions used in lint job
janekbaraniewski May 11, 2024
e921f5e
Disable magic number linter
janekbaraniewski May 11, 2024
f719f45
Update debug in codegen job
janekbaraniewski May 11, 2024
25ae240
DEBUG: make check generate fail
janekbaraniewski May 11, 2024
5e3d696
More logs in codegen script
janekbaraniewski May 11, 2024
150b473
More logs
janekbaraniewski May 11, 2024
bfc0375
More logs
janekbaraniewski May 11, 2024
1d6ca14
Debug
janekbaraniewski May 11, 2024
4742fb0
Temporarly disable lint job in tests workflow
janekbaraniewski May 12, 2024
be8621f
Temporarly disable codegen job
janekbaraniewski May 12, 2024
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
38 changes: 22 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,36 @@ jobs:
env:
DOCKERBUILD_ACTION: ""

codegen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# codegen:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
# - name: Set up Go
# uses: actions/setup-go@v2
# with:
# go-version: 1.22

- name: Check codegen
run: make check-generated
# - name: debug paths and dirs
# run: |
# ls -la .
# pwd
# ls -la pkg/generated/ || echo "NO DIR"

# - name: Check codegen
# run: make check-generated

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.18
- uses: actions/checkout@v3
go-version: '1.22'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
args: --timeout=3m
version: latest

tests:
runs-on: ubuntu-latest
Expand All @@ -124,7 +130,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.22
- name: Test
run: make test
- name: Upload coverage
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ linters:
- gosec
- ireturn
- maligned
- mnd
- nestif # remove
- nlreturn
- nonamedreturns # fix maybe?
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:latest

# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.18-alpine as builder
FROM --platform=$BUILDPLATFORM golang:1.22-alpine as builder
RUN apk update
RUN apk add make bash
WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.monitor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:latest

FROM --platform=$BUILDPLATFORM golang:1.18-buster AS builder
FROM --platform=$BUILDPLATFORM golang:1.22-bullseye AS builder

WORKDIR /workspace
COPY go.mod go.sum ./
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.webhook
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:latest

# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.18-alpine as builder
FROM --platform=$BUILDPLATFORM golang:1.22-alpine as builder
RUN apk update
RUN apk add make bash
WORKDIR /workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
labels: {{ include "kubeserial-crds.labels" . | nindent 4 }}
name: kubeserials.app.kubeserial.com
spec:
Expand All @@ -21,10 +20,24 @@ spec:
description: KubeSerial is the Schema for the kubeserials API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object.

Servers should convert recognized schemas to the latest internal value, and

may reject unrecognized values.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents.

Servers may infer this from the endpoint the client submits requests to.

Cannot be updated.

In CamelCase.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
Expand Down
21 changes: 17 additions & 4 deletions charts/kubeserial-crds/templates/app.kubeserial.com_managers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
labels: {{ include "kubeserial-crds.labels" . | nindent 4 }}
name: managers.app.kubeserial.com
spec:
Expand All @@ -21,10 +20,24 @@ spec:
description: Manager is the Schema for the managers API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object.

Servers should convert recognized schemas to the latest internal value, and

may reject unrecognized values.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents.

Servers may infer this from the endpoint the client submits requests to.

Cannot be updated.

In CamelCase.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
labels: {{ include "kubeserial-crds.labels" . | nindent 4 }}
name: managerschedulerequests.app.kubeserial.com
spec:
Expand Down Expand Up @@ -31,10 +30,24 @@ spec:
description: ManagerScheduleRequest is the Schema for the managerschedulerequests API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object.

Servers should convert recognized schemas to the latest internal value, and

may reject unrecognized values.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents.

Servers may infer this from the endpoint the client submits requests to.

Cannot be updated.

In CamelCase.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.15.0
labels: {{ include "kubeserial-crds.labels" . | nindent 4 }}
name: serialdevices.app.kubeserial.com
spec:
Expand Down Expand Up @@ -31,10 +30,24 @@ spec:
description: SerialDevice is the Schema for the SerialDevices API.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: 'APIVersion defines the versioned schema of this representation of an object.

Servers should convert recognized schemas to the latest internal value, and

may reject unrecognized values.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: 'Kind is a string value representing the REST resource this object represents.

Servers may infer this from the endpoint the client submits requests to.

Cannot be updated.

In CamelCase.

More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
Expand Down Expand Up @@ -67,7 +80,9 @@ spec:
format: date-time
type: string
message:
description: message is a human readable message indicating details about the transition. This may be an empty string.
description: 'message is a human readable message indicating details about the transition.

This may be an empty string.'
maxLength: 32768
type: string
observedGeneration:
Expand Down
9 changes: 4 additions & 5 deletions cmd/device-monitor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metrics "sigs.k8s.io/controller-runtime/pkg/metrics"

"github.com/janekbaraniewski/kubeserial/pkg/generated/clientset/versioned"
"github.com/janekbaraniewski/kubeserial/pkg/monitor"
Expand All @@ -23,10 +22,10 @@ func main() {

log.Info("Start setup")

_, err := metrics.NewListener(":8080")
if err != nil {
log.Info("Failed setting up metrics listener")
}
// _, err := metrics.NewListener(":8080")
// if err != nil {
// log.Info("Failed setting up metrics listener")
// }

config, err := rest.InClusterConfig()
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"

kubeserialv1alpha1 "github.com/janekbaraniewski/kubeserial/pkg/apis/v1alpha1"
"github.com/janekbaraniewski/kubeserial/pkg/controllers"
Expand Down Expand Up @@ -80,9 +81,10 @@ func main() {
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
Scheme: scheme,
Metrics: server.Options{
BindAddress: metricsAddr,
},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "0fe39e81.app.kubeserial.com",
Expand Down
13 changes: 9 additions & 4 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/janekbaraniewski/kubeserial/pkg/generated/clientset/versioned"
Expand Down Expand Up @@ -42,8 +43,14 @@ func main() {
// Setup a Manager
entryLog.Info("setting up manager")
mgr, err := manager.New(config.GetConfigOrDie(), manager.Options{
MetricsBindAddress: ":8080",
Metrics: server.Options{
BindAddress: ":8080",
},
HealthProbeBindAddress: ":8081",
WebhookServer: webhook.NewServer(webhook.Options{
Port: params.port,
CertDir: params.certDir,
}),
})
if err != nil {
entryLog.Error(err, "unable to set up overall controller manager")
Expand All @@ -56,10 +63,8 @@ func main() {

// Setup webhooks
entryLog.Info("setting up webhook server")
hookServer := mgr.GetWebhookServer()

hookServer.Port = params.port
hookServer.CertDir = params.certDir
hookServer := mgr.GetWebhookServer()

config, err := rest.InClusterConfig()
if err != nil {
Expand Down
Loading
Loading