Skip to content

Commit

Permalink
✨ Update to Go 1.23.
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Guettler <thomas.guettler@syself.com>
  • Loading branch information
guettli committed Sep 4, 2024
1 parent 3dc37fb commit 6be026b
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .builder-image-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.19
1.1.20
2 changes: 1 addition & 1 deletion .github/renovate/golang.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
},
// https://docs.renovatebot.com/configuration-options/#constraints
"constraints": {
"go": "1.21"
"go": "1.22"
},
packageRules: [
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
container:
image: ghcr.io/sovereigncloudstack/cso-builder:1.1.19
image: ghcr.io/sovereigncloudstack/cso-builder:1.1.20
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schedule-scan-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Trivy
runs-on: ubuntu-latest
container:
image: ghcr.io/sovereigncloudstack/cso-builder:1.1.19
image: ghcr.io/sovereigncloudstack/cso-builder:1.1.20
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ main
*.tgz.yaml
*.build.yaml
.release

# .config/go/telemetry/local/
.config
21 changes: 5 additions & 16 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ linters:
- errname
- errorlint
- exhaustive
- exportloopref
- copyloopvar
- forcetypeassert
- gci
- goconst
Expand Down Expand Up @@ -86,10 +86,7 @@ linters-settings:
allow-unused: false
allow-leading-space: false
require-specific: true
staticcheck:
go: "1.21"
stylecheck:
go: "1.21"
checks: ["all", "-ST1006"]
dot-import-whitelist:
- "github.com/onsi/gomega"
Expand Down Expand Up @@ -223,8 +220,6 @@ linters-settings:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
- name: struct-tag
disabled: true
unused:
go: "1.21"
usestdlibvars:
# Suggest the use of http.MethodXX.
# Default: true
Expand All @@ -247,9 +242,6 @@ linters-settings:
# Suggest the use of rpc.DefaultXXPath.
# Default: false
default-rpc-path: true
# Suggest the use of os.DevNull.
# Default: false
os-dev-null: true
# Suggest the use of sql.LevelXX.String().
# Default: false
sql-isolation-level: true
Expand All @@ -259,9 +251,6 @@ linters-settings:
# Suggest the use of constant.Kind.String().
# Default: false
constant-kind: true
# Suggest the use of syslog.Priority.
# Default: false
syslog-priority: true
wrapcheck:
ignoreSigs:
- status.Error(
Expand All @@ -285,11 +274,11 @@ issues:
- linters:
- wrapcheck
path: _test\.go
exclude-dirs:
- vendor$
- test/vendor$
run:
timeout: 10m
go: "1.21"
go: "1.22"
allow-parallel-runners: true
modules-download-mode: vendor
skip-dirs:
- vendor$
- test/vendor$
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ MGT_CLUSTER_KUBECONFIG ?= ".mgt-cluster-kubeconfig.yaml"

# Kubebuilder.
export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.29.3
# versions
# versions
CTLPTL_VERSION := 0.8.25

##@ Binaries
Expand Down Expand Up @@ -445,7 +445,7 @@ ifeq ($(BUILD_IN_CONTAINER),true)
else
go version
golangci-lint version
GO111MODULE=on golangci-lint run -v --out-format=github-actions
GO111MODULE=on golangci-lint run -v --out-format=colored-line-number
endif

.PHONY: lint-yaml
Expand Down
14 changes: 11 additions & 3 deletions api/v1alpha1/conditions_const.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (

const (
// HelmChartFoundCondition reports when mentioned helm chart is present in the cluster addon tar archive.
HelmChartFoundCondition = "HelmChartFound"
HelmChartFoundCondition clusterv1.ConditionType = "HelmChartFound"

// HelmChartMissingReason is used when mentioned helm chart is missing in the cluster addon tar archive.
HelmChartMissingReason = "HelmChartMissing"
Expand All @@ -62,6 +62,14 @@ const (
TemplateNewClusterStackFailedReason = "TemplateNewClusterStackFailed"
)

const (
// ClusterAddonConfigValidatedCondition reports when there is a error parsing clusteraddon.yaml.
ClusterAddonConfigValidatedCondition clusterv1.ConditionType = "ClusterAddonConfigValidated"

// ParsingClusterAddonConfigFailedReason is used when there's some error happen while parsing clusteraddon.yaml.
ParsingClusterAddonConfigFailedReason = "ParsingClusterAddonConfigFailed"
)

const (
// HelmChartAppliedCondition reports on whether the relevant helm chart has been applied.
HelmChartAppliedCondition clusterv1.ConditionType = "HelmChartApplied"
Expand Down Expand Up @@ -91,7 +99,7 @@ const (

const (
// ProviderClusterStackReleasesSyncedCondition reports on whether the ProviderClusterStackReleases are ready.
ProviderClusterStackReleasesSyncedCondition = "ProviderClusterStackReleasesSynced"
ProviderClusterStackReleasesSyncedCondition clusterv1.ConditionType = "ProviderClusterStackReleasesSynced"

// ProviderTemplateNotFoundReason is used when providerTemplate is not found.
ProviderTemplateNotFoundReason = "ProviderTemplateNotFound"
Expand All @@ -102,7 +110,7 @@ const (

const (
// ClusterStackReleasesSyncedCondition reports on whether the ClusterStackReleases are ready.
ClusterStackReleasesSyncedCondition = "ClusterStackReleasesSynced" //#nosec
ClusterStackReleasesSyncedCondition clusterv1.ConditionType = "ClusterStackReleasesSynced" //#nosec
)

const (
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/SovereignCloudStack/cluster-stack-operator

go 1.21
go 1.22

require (
github.com/go-logr/logr v1.4.2
Expand Down
28 changes: 14 additions & 14 deletions images/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# If you make changes to this Dockerfile run `make builder-image-push`.

# Install Lychee
FROM docker.io/library/alpine:3.20.0@sha256:216266c86fc4dcef5619930bd394245824c2af52fd21ba7c6fa0e618657d4c3b as lychee
FROM docker.io/library/alpine:3.20.2 AS lychee
# update: datasource=github-tags depName=lycheeverse/lychee versioning=semver
ENV LYCHEE_VERSION="v0.15.1"
# hadolint ignore=DL3018
Expand All @@ -29,22 +29,22 @@ RUN apk add --no-cache curl && \
mv /tmp/lychee /usr/bin/lychee && \
rm -rf /tmp/linux-amd64 /tmp/lychee-${LYCHEE_VERSION}.tgz

FROM cgr.dev/chainguard/wolfi-base:latest as wolfi
FROM cgr.dev/chainguard/wolfi-base:latest AS wolfi

# update: datasource=github-tags depName=kubernetes-sigs/cluster-api
ARG CLUSTERCTL_VERSION="v1.6.2"
ARG CLUSTERCTL_VERSION="v1.8.1"
# update: datasource=github-tags depName=helm/helm
ENV HELM_VERSION="v3.14.1"
# update: datasource=github-tags depName=kubernetes-sigs/kind
ARG KIND_VERSION="v0.20.0"
ARG KIND_VERSION="v0.24.0"
# update: datasource=github-tags depName=kubernetes/kubernetes
ARG KUBECTL_VERSION="v1.27.3"
ARG KUBECTL_VERSION="v1.30.4"
# update: datasource=github-tags depName=kubernetes-sigs/kustomize extractVersion=^kustomize\/v(?<version>.+)$
ARG KUSTOMIZE_VERSION="v5.3.0"
ARG KUSTOMIZE_VERSION="v5.4.3"
# update: datasource=github-tags depName=aquasecurity/trivy
ARG TRIVY_VERSION="v0.48.3"
ARG TRIVY_VERSION="v0.54.1"
# update: datasource=github-tags depName=kubernetes-sigs/controller-tools
ARG CONTROLLER_GEN_VERSION="v0.14.0"
ARG CONTROLLER_GEN_VERSION="v0.16.1"

# hadolint ignore=DL3018
RUN apk add -U --no-cache \
Expand All @@ -55,27 +55,27 @@ RUN apk add -U --no-cache \
kind=~${KIND_VERSION#v} \
kubectl=~${KUBECTL_VERSION#v} \
kustomize=~${KUSTOMIZE_VERSION#v} \
trivy=~${TRIVY_VERSION#v}
trivy=~${TRIVY_VERSION#v}

# Install Golang CI Lint
FROM docker.io/library/alpine:3.20.0@sha256:216266c86fc4dcef5619930bd394245824c2af52fd21ba7c6fa0e618657d4c3b as golangci
FROM docker.io/library/alpine:3.20.2 AS golangci
# update: datasource=github-tags depName=golangci/golangci-lint versioning=semver
ENV GOLANGCI_VERSION="v1.59.0"
ENV GOLANGCI_VERSION="v1.60.3"
WORKDIR /
# hadolint ignore=DL3018,DL4006
RUN apk add --no-cache curl && \
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s ${GOLANGCI_VERSION}

# Install Hadolint
FROM docker.io/hadolint/hadolint:v2.12.0-alpine@sha256:7dba9a9f1a0350f6d021fb2f6f88900998a4fb0aaf8e4330aa8c38544f04db42 as hadolint
FROM docker.io/hadolint/hadolint:v2.12.0-alpine@sha256:7dba9a9f1a0350f6d021fb2f6f88900998a4fb0aaf8e4330aa8c38544f04db42 AS hadolint

# Install Trivy
FROM docker.io/aquasec/trivy:0.51.4@sha256:20a7c9cd02841a3d8d2a2506b93502a944adc57a3db9adf75b59266023b2af1e as trivy
FROM docker.io/aquasec/trivy:0.54.1 AS trivy

############################
# CSO Build Image Base #
############################
FROM docker.io/library/golang:1.21.6-bullseye
FROM docker.io/library/golang:1.23.0-bullseye

# update: datasource=github-tags depName=adrienverge/yamllint versioning=semver
ENV YAMLLINT_VERSION="v1.35.1"
Expand Down
2 changes: 1 addition & 1 deletion images/cso/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
FROM --platform=${BUILDPLATFORM} docker.io/alpine/helm:3.15.1 as helm

# Build the manager binary
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.21.6-bullseye as build
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.23.0-bullseye as build
ARG TARGETOS TARGETARCH

COPY . /src/cluster-stack-operator
Expand Down
36 changes: 27 additions & 9 deletions internal/controller/clusteraddon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re

releaseAsset, download, err := release.New(release.ConvertFromClusterClassToClusterStackFormat(cluster.Spec.Topology.Class), r.ReleaseDirectory)
if err != nil {
conditions.MarkFalse(clusterAddon, csov1alpha1.ClusterStackReleaseAssetsReadyCondition, csov1alpha1.IssueWithReleaseAssetsReason, clusterv1.ConditionSeverityError, err.Error())
conditions.MarkFalse(clusterAddon, csov1alpha1.ClusterStackReleaseAssetsReadyCondition, csov1alpha1.IssueWithReleaseAssetsReason, clusterv1.ConditionSeverityError, "%s", err.Error())
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
}
if download {
Expand All @@ -204,9 +204,9 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
csov1alpha1.ClusterStackReleaseAssetsReadyCondition,
csov1alpha1.IssueWithReleaseAssetsReason,
clusterv1.ConditionSeverityError,
msg,
"%s", msg,
)
record.Warnf(clusterAddon, "ValidateHelmChartFailed", msg)
record.Warn(clusterAddon, "ValidateHelmChartFailed", msg)
return reconcile.Result{}, nil
}

Expand Down Expand Up @@ -298,8 +298,23 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
// multi-stage cluster addon flow
in.addonStagesInput, err = r.getAddonStagesInput(in.restConfig, in.clusterAddonChartPath)
if err != nil {
return reconcile.Result{}, fmt.Errorf("failed to get addon stages input: %w", err)
conditions.MarkFalse(
clusterAddon,
csov1alpha1.ClusterAddonConfigValidatedCondition,
csov1alpha1.ParsingClusterAddonConfigFailedReason,
clusterv1.ConditionSeverityError,
"cluster addon config (clusteraddon.yaml) is wrong: %s", err.Error(),
)

record.Warnf(
clusterAddon,
csov1alpha1.ParsingClusterAddonConfigFailedReason,
"cluster addon config (clusteraddon.yaml) is wrong: %s", err.Error(),
)

return reconcile.Result{}, nil
}
conditions.MarkTrue(clusterAddon, csov1alpha1.ClusterAddonConfigValidatedCondition)

// clusteraddon.yaml in the release.
clusterAddonConfig, err := clusteraddon.ParseConfig(in.clusterAddonConfigPath)
Expand Down Expand Up @@ -932,9 +947,9 @@ func (r *ClusterAddonReconciler) downloadOldClusterStackRelease(ctx context.Cont
csov1alpha1.AssetsClientAPIAvailableCondition,
csov1alpha1.FailedCreateAssetsClientReason,
clusterv1.ConditionSeverityError,
err.Error(),
"%s", err.Error(),
)
record.Warnf(clusterAddon, "FailedCreateAssetsClient", err.Error())
record.Warn(clusterAddon, "FailedCreateAssetsClient", err.Error())

// give the assets client a second change
if isSet {
Expand All @@ -948,7 +963,10 @@ func (r *ClusterAddonReconciler) downloadOldClusterStackRelease(ctx context.Cont
// check if old cluster stack release is present or not.
releaseAsset, download, err := release.New(release.ConvertFromClusterClassToClusterStackFormat(clusterAddon.Spec.ClusterStack), r.ReleaseDirectory)
if err != nil {
conditions.MarkFalse(clusterAddon, csov1alpha1.ClusterStackReleaseAssetsReadyCondition, csov1alpha1.IssueWithReleaseAssetsReason, clusterv1.ConditionSeverityError, err.Error())
conditions.MarkFalse(clusterAddon,
csov1alpha1.ClusterStackReleaseAssetsReadyCondition,
csov1alpha1.IssueWithReleaseAssetsReason,
clusterv1.ConditionSeverityError, "%s", err.Error())
return nil, true, nil
}
if download {
Expand Down Expand Up @@ -976,9 +994,9 @@ func (r *ClusterAddonReconciler) downloadOldClusterStackRelease(ctx context.Cont
csov1alpha1.ClusterStackReleaseAssetsReadyCondition,
csov1alpha1.IssueWithReleaseAssetsReason,
clusterv1.ConditionSeverityError,
msg,
"%s", msg,
)
record.Warnf(clusterAddon, "ValidateHelmChartFailed", msg)
record.Warn(clusterAddon, "ValidateHelmChartFailed", msg)
return nil, false, nil
}

Expand Down
Loading

0 comments on commit 6be026b

Please sign in to comment.