Skip to content

Commit 245f045

Browse files
committed
Feature: Updates project to latest operator-sdk version
Also updates the kubebuilder plugin to `go/v4` and updates files to use the new project structure: - Moves controller from `controllers` to `internal/controller` - Moves modules from `pkg/modules` to `internal/modules` - Moves `main.go` to `cmd/main.go` This new version also removes support for `kube-rbac-proxy` and updates multiple Kustomize manifests. Also upgrades golang version to `v1.22.0` Signed-off-by: Alejandro Macedo <[email protected]>
1 parent 9abecb3 commit 245f045

File tree

94 files changed

+1319
-1478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1319
-1478
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
22
# Ignore build and test binaries.
33
bin/
4-
testbin/

.github/workflows/build-latest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup go
1313
uses: actions/setup-go@v5
1414
with:
15-
go-version: '=1.20.14'
15+
go-version: '=1.22.0'
1616
- name: Create image name with tag
1717
run: echo "IMG=ghcr.io/whitestack/node-config-operator:latest" >> $GITHUB_ENV
1818
- name: Set up Docker Buildx

.github/workflows/build-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup go
1313
uses: actions/setup-go@v5
1414
with:
15-
go-version: '=1.20.14'
15+
go-version: '=1.22.0'
1616
- name: Create image name with tag
1717
run: echo "IMG=ghcr.io/whitestack/node-config-operator:${GITHUB_REF_NAME}" >> $GITHUB_ENV
1818
- name: Set up Docker Buildx

.gitignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
21
# Binaries for programs and plugins
32
*.exe
43
*.exe~
54
*.dll
65
*.so
76
*.dylib
8-
bin
9-
testbin/*
7+
bin/*
108
Dockerfile.cross
119

12-
# Test binary, build with `go test -c`
10+
# Test binary, built with `go test -c`
1311
*.test
1412

1513
# Output of the go coverage tool, specifically when used with LiteIDE
1614
*.out
1715

18-
# Kubernetes Generated files - skip generated files, except for vendored files
16+
# Go workspace file
17+
go.work
1918

19+
# Kubernetes Generated files - skip generated files, except for vendored files
2020
!vendor/**/zz_generated.*
2121

2222
# editor and IDE paraphernalia
2323
.idea
24+
.vscode
2425
*.swp
2526
*.swo
2627
*~
2728

2829
.envrc
29-
.mise.toml
3030
tests/.kube/
3131
tests/minikube-*

.golangci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
run:
2+
timeout: 5m
3+
allow-parallel-runners: true
4+
5+
issues:
6+
# don't skip warning about doc comments
7+
# don't exclude the default set of lint
8+
exclude-use-default: false
9+
# restore some of the defaults
10+
# (fill in the rest as needed)
11+
exclude-rules:
12+
- path: "api/*"
13+
linters:
14+
- lll
15+
- path: "internal/*"
16+
linters:
17+
- dupl
18+
- lll
19+
linters:
20+
disable-all: true
21+
enable:
22+
- dupl
23+
- errcheck
24+
- exportloopref
25+
- ginkgolinter
26+
- goconst
27+
- gocyclo
28+
- gofmt
29+
- goimports
30+
- gosimple
31+
- govet
32+
- ineffassign
33+
- lll
34+
- misspell
35+
- nakedret
36+
- prealloc
37+
- revive
38+
- staticcheck
39+
- typecheck
40+
- unconvert
41+
- unparam
42+
- unused
43+
44+
linters-settings:
45+
revive:
46+
rules:
47+
- name: comment-spacings

.mise.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tools]
2+
go = "1.22.0"

Dockerfile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.20 AS builder
2+
FROM golang:1.22 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

@@ -12,20 +12,17 @@ COPY go.sum go.sum
1212
RUN go mod download
1313

1414
# Copy the go source
15-
COPY main.go main.go
15+
COPY cmd/main.go cmd/main.go
1616
COPY api/ api/
17-
COPY controllers/ controllers/
18-
COPY pkg/ pkg/
17+
COPY internal/ internal/
1918

2019
# Build
2120
# the GOARCH has not a default value to allow the binary be built according to the host where the command
2221
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
2322
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
2423
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
25-
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go
24+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
2625

27-
# Use distroless as minimal base image to package the manager binary
28-
# Refer to https://github.com/GoogleContainerTools/distroless for more details
2926
FROM ubuntu:22.04
3027
RUN apt-get update && \
3128
apt-get install -y systemd kmod && \

0 commit comments

Comments
 (0)