diff --git a/.github/workflows/e2e-olm.yml b/.github/workflows/e2e-olm.yml index 144de60..26150bc 100644 --- a/.github/workflows/e2e-olm.yml +++ b/.github/workflows/e2e-olm.yml @@ -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 diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 6c78226..bd7afbc 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -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 diff --git a/Dockerfile b/Dockerfile index 53abd75..023d499 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Makefile b/Makefile index 5b650f1..c6bb79a 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/config/crd/bases/fluxcd.controlplane.io_fluxinstances.yaml b/config/crd/bases/fluxcd.controlplane.io_fluxinstances.yaml index 5675bc9..c134f8c 100644 --- a/config/crd/bases/fluxcd.controlplane.io_fluxinstances.yaml +++ b/config/crd/bases/fluxcd.controlplane.io_fluxinstances.yaml @@ -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 @@ -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: |- @@ -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 diff --git a/config/crd/bases/fluxcd.controlplane.io_fluxreports.yaml b/config/crd/bases/fluxcd.controlplane.io_fluxreports.yaml index 296679e..794836b 100644 --- a/config/crd/bases/fluxcd.controlplane.io_fluxreports.yaml +++ b/config/crd/bases/fluxcd.controlplane.io_fluxreports.yaml @@ -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 @@ -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: |- @@ -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 diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 01b8cd9..8d8730d 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -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 @@ -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 diff --git a/internal/controller/fluxinstance_controller.go b/internal/controller/fluxinstance_controller.go index 869ed93..ae8f880 100644 --- a/internal/controller/fluxinstance_controller.go +++ b/internal/controller/fluxinstance_controller.go @@ -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 } @@ -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) } @@ -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 } @@ -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 @@ -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 @@ -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}, diff --git a/internal/controller/fluxreport_controller.go b/internal/controller/fluxreport_controller.go index 57bf05f..20f0bfc 100644 --- a/internal/controller/fluxreport_controller.go +++ b/internal/controller/fluxreport_controller.go @@ -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)) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 75db6bd..674f36d 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -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") } diff --git a/test/e2e/utils.go b/test/e2e/utils.go index b50d2e1..769b801 100644 --- a/test/e2e/utils.go +++ b/test/e2e/utils.go @@ -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)) diff --git a/test/olm/e2e_suite_test.go b/test/olm/e2e_suite_test.go index 32e16fb..42f5ae9 100644 --- a/test/olm/e2e_suite_test.go +++ b/test/olm/e2e_suite_test.go @@ -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") }