Skip to content

Commit fa3f317

Browse files
author
Lyubo Kamenov
authored
Upgrade kbuilder (#55)
* Upgrade to kubebuilder v4
1 parent 1f127a8 commit fa3f317

File tree

86 files changed

+2149
-1457
lines changed

Some content is hidden

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

86 files changed

+2149
-1457
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
cache-dependency-path: 'go.sum'
3131
- uses: golangci/golangci-lint-action@v6
3232
with:
33-
version: 'v1.61.0'
33+
version: 'v1.63.4'
3434
test:
3535
name: Test
3636
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ testbin/*
2424
*.swp
2525
*.swo
2626
*~
27+
.DS_Store

Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ RUN go mod download
1212
# Copy the go source
1313
COPY cmd/ cmd/
1414
COPY api/ api/
15-
COPY controllers/ controllers/
16-
COPY pkg/ pkg/
15+
COPY internal internal/
1716

1817
# Build
1918
ENV CGO_ENABLED=0
20-
RUN go build -a -o conduit-operator cmd/operator/main.go
19+
RUN go build -a -ldflags="-s -w" -o conduit-operator cmd/operator/main.go
2120

22-
# Use distroless as minimal base image to package the manager binary
23-
# Refer to https://github.com/GoogleContainerTools/distroless for more details
21+
# The delta in size between alpine and distroless is negligent.
22+
# Alpine is preferable as provides better access to tools inside the image, if needed.
2423
# FROM gcr.io/distroless/static:nonroot
2524

26-
FROM alpine:3.20
25+
FROM alpine:3.21
2726
WORKDIR /app
2827
COPY --from=builder /workspace/conduit-operator /app
2928
USER 65532:65532

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ NAME := conduit-operator
77

88
CERT_MANAGER := https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml
99

10-
# KUSTOMIZE_VERSION ?= v4.5.7
11-
KUSTOMIZE_VERSION ?= v5.4.3
12-
CTRL_GEN_VERSION ?= v0.16.3
10+
KUSTOMIZE_VERSION ?= v5.5.0
11+
CTRL_GEN_VERSION ?= v0.17.2
1312
KIND_VERSION ?= v0.24.0
14-
GOLINT_VERSION ?= v1.61.0
13+
GOLINT_VERSION ?= v1.63.4
1514

1615
.EXPORT_ALL_VARIABLES:
1716

@@ -83,7 +82,7 @@ manifests: bin/kustomize generate
8382
kustomize build config/rbac > charts/conduit-operator/templates/rbac.yaml
8483
# kustomize build config/manager > charts/conduit-operator/templates/deployment.yaml
8584
kustomize build config/certmanager > charts/conduit-operator/templates/certificate.yaml
86-
kustomize build config/webhook > charts/conduit-operator/templates/webhook.yaml
85+
bin/kustomize build config/webhook > charts/conduit-operator/templates/webhook.yaml
8786

8887
.PHONY: crds
8988
crds: bin/controller-gen
@@ -130,6 +129,7 @@ dev_delete:
130129
dev: crds manifests kind_setup kind_image_build helm_upgrade
131130
helm_upgrade:
132131
helm upgrade $(NAME) \
132+
--debug \
133133
--atomic \
134134
--create-namespace --namespace $(NAME) \
135135
--install \
@@ -141,4 +141,5 @@ helm_upgrade:
141141
--set "service.type=NodePort" \
142142
--set "image.tag=$(TAG)" \
143143
--set "image.pullPolicy=Never" \
144+
$(HELM_EXTRA_OPTS) \
144145
$(CURDIR)/charts/conduit-operator

PROJECT

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# Code generated by tool. DO NOT EDIT.
2+
# This file is used to track the info used to scaffold your project
3+
# and allow the plugins properly work.
4+
# More info: https://book.kubebuilder.io/reference/project-config.html
15
domain: conduit.io
26
layout:
3-
- go.kubebuilder.io/v3
7+
- go.kubebuilder.io/v4
48
projectName: conduit-operator
59
repo: github.com/conduitio/conduit-operator
610
resources:

api/v1alpha/conduit_conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package v1alpha
2+
3+
// Hub marks this type as a conversion hub.
4+
func (*Conduit) Hub() {}

api/v1alpha/conduit_types.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131
DeletedReason = "Deleted"
3232
)
3333

34-
var conduitConditions = NewConditionSet(
34+
var ConduitConditions = NewConditionSet(
3535
ConditionConduitReady,
3636
ConditionConduitConfigReady,
3737
ConditionConduitSecretReady,
@@ -125,24 +125,26 @@ type ConduitStatus struct {
125125
}
126126

127127
func (s *ConduitStatus) SetCondition(ct ConditionType, status corev1.ConditionStatus, reason string, message string) {
128-
s.Conditions = conduitConditions.SetCondition(s.Conditions, ct, status, reason, message)
128+
s.Conditions = ConduitConditions.SetCondition(s.Conditions, ct, status, reason, message)
129129
}
130130

131131
func (s *ConduitStatus) GetCondition(ct ConditionType) *Condition {
132-
return conduitConditions.GetCondition(s.Conditions, ct)
132+
return ConduitConditions.GetCondition(s.Conditions, ct)
133133
}
134134

135135
// ConditionChanged returns true when the expected condition status does not match current status
136136
func (s *ConduitStatus) ConditionChanged(ct ConditionType, expected corev1.ConditionStatus) bool {
137-
if cond := conduitConditions.GetCondition(s.Conditions, ct); cond != nil {
137+
if cond := ConduitConditions.GetCondition(s.Conditions, ct); cond != nil {
138138
return cond.Status != expected
139139
}
140140

141141
return false
142142
}
143143

144144
//+kubebuilder:object:root=true
145+
//+kubebuilder:storageversion
145146
//+kubebuilder:subresource:status
147+
//+kubebuilder:conversion:hub
146148

147149
// Conduit is the Schema for the conduits API
148150
type Conduit struct {

api/v1alpha/conduit_validator.go

Lines changed: 0 additions & 32 deletions
This file was deleted.

api/v1alpha/conduit_webhook.go

Lines changed: 0 additions & 218 deletions
This file was deleted.

0 commit comments

Comments
 (0)