Skip to content

Commit

Permalink
Merge pull request #88 from controlplaneio-fluxcd/go-1.23
Browse files Browse the repository at this point in the history
Build with Go 1.23
  • Loading branch information
stefanprodan authored Aug 16, 2024
2 parents 4450aa5 + 7ad5d7b commit d39434d
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 81 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e-olm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
go-version: 1.23.x
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Setup Kubernetes
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
version: v0.23.0
version: v0.24.0
cluster_name: kind
- name: Setup QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
go-version: 1.23.x
cache-dependency-path: |
**/go.sum
**/go.mod
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 operator binary using the Docker's Debian image.
FROM --platform=${BUILDPLATFORM} golang:1.22 AS builder
FROM --platform=${BUILDPLATFORM} golang:1.23 AS builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /workspace
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk-$(OPERATOR_SDK_VERSION)

## Tool Versions
KUSTOMIZE_VERSION ?= v5.4.1
CONTROLLER_TOOLS_VERSION ?= v0.15.0
ENVTEST_VERSION ?= release-0.18
GOLANGCI_LINT_VERSION ?= v1.57.2
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.16.1
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.60.1
OPERATOR_SDK_VERSION ?= v1.34.2

.PHONY: operator-sdk
Expand Down
21 changes: 4 additions & 17 deletions config/crd/bases/fluxcd.controlplane.io_fluxinstances.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.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: fluxinstances.fluxcd.controlplane.io
spec:
group: fluxcd.controlplane.io
Expand Down Expand Up @@ -306,16 +306,8 @@ spec:
conditions:
description: Conditions contains the readiness conditions of the object.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
Expand Down Expand Up @@ -356,12 +348,7 @@ spec:
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand Down
21 changes: 4 additions & 17 deletions config/crd/bases/fluxcd.controlplane.io_fluxreports.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.15.0
controller-gen.kubebuilder.io/version: v0.16.1
name: fluxreports.fluxcd.controlplane.io
spec:
group: fluxcd.controlplane.io
Expand Down Expand Up @@ -189,16 +189,8 @@ spec:
conditions:
description: Conditions contains the readiness conditions of the object.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: |-
Expand Down Expand Up @@ -239,12 +231,7 @@ spec:
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand Down
27 changes: 2 additions & 25 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,6 @@ rules:
- fluxcd.controlplane.io
resources:
- fluxinstances
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- fluxcd.controlplane.io
resources:
- fluxinstances/finalizers
verbs:
- update
- apiGroups:
- fluxcd.controlplane.io
resources:
- fluxinstances/status
verbs:
- get
- patch
- update
- apiGroups:
- fluxcd.controlplane.io
resources:
- fluxreports
verbs:
- create
Expand All @@ -45,12 +20,14 @@ rules:
- apiGroups:
- fluxcd.controlplane.io
resources:
- fluxinstances/finalizers
- fluxreports/finalizers
verbs:
- update
- apiGroups:
- fluxcd.controlplane.io
resources:
- fluxinstances/status
- fluxreports/status
verbs:
- get
Expand Down
18 changes: 9 additions & 9 deletions internal/controller/fluxinstance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ func (r *FluxInstanceReconciler) Reconcile(ctx context.Context, req ctrl.Request
conditions.MarkUnknown(obj,
meta.ReadyCondition,
meta.ProgressingReason,
msg)
"%s", msg)
conditions.MarkReconciling(obj,
meta.ProgressingReason,
msg)
"%s", msg)
return ctrl.Result{Requeue: true}, nil
}

Expand All @@ -125,10 +125,10 @@ func (r *FluxInstanceReconciler) reconcile(ctx context.Context,
conditions.MarkUnknown(obj,
meta.ReadyCondition,
meta.ProgressingReason,
msg)
"%s", msg)
conditions.MarkReconciling(obj,
meta.ProgressingReason,
msg)
"%s", msg)
if err := r.patch(ctx, obj, patcher); err != nil {
return ctrl.Result{}, fmt.Errorf("failed to update status: %w", err)
}
Expand All @@ -151,7 +151,7 @@ func (r *FluxInstanceReconciler) reconcile(ctx context.Context,
conditions.MarkFalse(obj,
meta.ReadyCondition,
meta.ArtifactFailedReason,
msg)
"%s", msg)
r.EventRecorder.Event(obj, corev1.EventTypeWarning, meta.ArtifactFailedReason, msg)
return ctrl.Result{}, err
}
Expand All @@ -163,11 +163,11 @@ func (r *FluxInstanceReconciler) reconcile(ctx context.Context,
conditions.MarkFalse(obj,
meta.ReadyCondition,
meta.BuildFailedReason,
msg)
"%s", msg)
conditions.MarkTrue(obj,
meta.StalledCondition,
meta.BuildFailedReason,
msg)
"%s", msg)
log.Error(err, msg)
r.EventRecorder.Event(obj, corev1.EventTypeWarning, meta.BuildFailedReason, msg)
return ctrl.Result{}, nil
Expand All @@ -193,7 +193,7 @@ func (r *FluxInstanceReconciler) reconcile(ctx context.Context,
conditions.MarkFalse(obj,
meta.ReadyCondition,
meta.ReconciliationFailedReason,
msg)
"%s", msg)
r.EventRecorder.Event(obj, corev1.EventTypeWarning, meta.ReconciliationFailedReason, msg)

return ctrl.Result{}, err
Expand All @@ -205,7 +205,7 @@ func (r *FluxInstanceReconciler) reconcile(ctx context.Context,
conditions.MarkTrue(obj,
meta.ReadyCondition,
meta.ReconciliationSucceededReason,
msg)
"%s", msg)
log.Info(msg, "revision", obj.Status.LastAppliedRevision)
r.EventRecorder.AnnotatedEventf(obj,
map[string]string{fluxcdv1.RevisionAnnotation: obj.Status.LastAppliedRevision},
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/fluxreport_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (r *FluxReportReconciler) Reconcile(ctx context.Context, req ctrl.Request)
conditions.MarkTrue(obj,
meta.ReadyCondition,
meta.SucceededReason,
msg)
"%s", msg)

// Patch the FluxReport with the computed spec.
err = patcher.Patch(ctx, obj, patch.WithFieldOwner(r.StatusManager))
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ import (
// Run e2e tests using the Ginkgo runner.
func TestE2E(t *testing.T) {
RegisterFailHandler(Fail)
fmt.Fprintf(GinkgoWriter, "Starting flux-operator suite\n")
fmt.Fprintf(GinkgoWriter, "Starting flux-operator suite\n") //nolint:errcheck
RunSpecs(t, "e2e suite")
}
4 changes: 2 additions & 2 deletions test/e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ func Run(cmd *exec.Cmd, dirPattern string) ([]byte, error) {
cmd.Dir = dir

if err := os.Chdir(cmd.Dir); err != nil {
fmt.Fprintf(GinkgoWriter, "chdir dir: %s\n", err)
fmt.Fprintf(GinkgoWriter, "chdir dir: %s\n", err) //nolint:errcheck
}

cmd.Env = append(os.Environ(), "GO111MODULE=on")
command := strings.Join(cmd.Args, " ")
fmt.Fprintf(GinkgoWriter, "running: %s\n", command)
fmt.Fprintf(GinkgoWriter, "running: %s\n", command) //nolint:errcheck
output, err := cmd.CombinedOutput()
if err != nil {
return output, fmt.Errorf("%s failed with error: (%v) %s", command, err, string(output))
Expand Down
2 changes: 1 addition & 1 deletion test/olm/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ import (
// Run e2e tests using the Ginkgo runner.
func TestE2E(t *testing.T) {
RegisterFailHandler(Fail)
fmt.Fprintf(GinkgoWriter, "Starting flux-operator olm e2e suite\n")
fmt.Fprintf(GinkgoWriter, "Starting flux-operator olm e2e suite\n") //nolint:errcheck
RunSpecs(t, "olm e2e suite")
}

0 comments on commit d39434d

Please sign in to comment.