diff --git a/.builder-image-version.txt b/.builder-image-version.txt index 238d6e882..b0f3d96f8 100644 --- a/.builder-image-version.txt +++ b/.builder-image-version.txt @@ -1 +1 @@ -1.0.7 +1.0.8 diff --git a/.github/actions/manager-image/action.yaml b/.github/actions/manager-image/action.yaml index 2e4bd8dc5..368eb1873 100644 --- a/.github/actions/manager-image/action.yaml +++ b/.github/actions/manager-image/action.yaml @@ -44,7 +44,7 @@ runs: # Import GitHub's cache build to docker cache - name: Copy Caph Golang cache to docker cache - uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 with: provenance: false context: /tmp/.cache/caph @@ -54,7 +54,7 @@ runs: target: import-cache - name: Build and push manager image - uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4 + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5 with: provenance: false context: . diff --git a/.github/actions/metadata/action.yaml b/.github/actions/metadata/action.yaml index 54a17d82a..349f1a021 100644 --- a/.github/actions/metadata/action.yaml +++ b/.github/actions/metadata/action.yaml @@ -22,7 +22,7 @@ runs: steps: - name: Docker manager metadata id: meta - uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0 + uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: ${{ inputs.metadata_flavor }} diff --git a/.github/renovate/golang.json5 b/.github/renovate/golang.json5 index cb71f33cd..64557900b 100644 --- a/.github/renovate/golang.json5 +++ b/.github/renovate/golang.json5 @@ -4,7 +4,7 @@ }, // https://docs.renovatebot.com/configuration-options/#constraints "constraints": { - "go": "1.20" + "go": "1.21" }, packageRules: [ { @@ -41,4 +41,4 @@ enabled: false, }, ], -} \ No newline at end of file +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5161d0d1d..a608c5357 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,7 +81,7 @@ jobs: # Import GitHub's cache build to docker cache - name: Copy Caph Golang cache to docker cache - uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 with: provenance: false context: /tmp/.cache/caph @@ -91,7 +91,7 @@ jobs: target: import-cache - name: Build and push manager image - uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4 + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5 id: docker_build_release with: provenance: false @@ -127,7 +127,7 @@ jobs: # Store docker's golang's cache build locally only on the main branch - name: Store Caph Golang cache build locally if: ${{ steps.cache.outputs.cache-hit != 'true' }} - uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 with: provenance: false context: . diff --git a/.github/workflows/main-promote-builder-image.yml b/.github/workflows/main-promote-builder-image.yml index 556496e6f..4284b35f2 100644 --- a/.github/workflows/main-promote-builder-image.yml +++ b/.github/workflows/main-promote-builder-image.yml @@ -10,7 +10,7 @@ jobs: name: Promote Latest tag to Caph Builder Image runs-on: ubuntu-latest container: - image: ghcr.io/syself/caph-builder:1.0.7 + image: ghcr.io/syself/caph-builder:1.0.8 credentials: username: ${{ github.actor }} password: ${{ secrets.github_token }} diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml index 8e6b39770..7800f4345 100644 --- a/.github/workflows/pr-lint.yml +++ b/.github/workflows/pr-lint.yml @@ -14,7 +14,7 @@ jobs: if: github.event_name != 'pull_request_target' || !github.event.pull_request.draft runs-on: ubuntu-latest container: - image: ghcr.io/syself/caph-builder:1.0.7 + image: ghcr.io/syself/caph-builder:1.0.8 credentials: username: ${{ github.actor }} password: ${{ secrets.github_token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e678e1a2..abefcec78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,7 +60,7 @@ jobs: echo 'EOF' >> $GITHUB_ENV - name: Build and push manager image - uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4 + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5 id: docker_build_release with: provenance: false diff --git a/.github/workflows/schedule-cache-cleaner-caph-image.yml b/.github/workflows/schedule-cache-cleaner-caph-image.yml index 8655ff001..3c6ccf347 100644 --- a/.github/workflows/schedule-cache-cleaner-caph-image.yml +++ b/.github/workflows/schedule-cache-cleaner-caph-image.yml @@ -11,11 +11,7 @@ concurrency: cancel-in-progress: true jobs: cache-cleaner: - runs-on: ubuntu-22.04 - strategy: - matrix: - include: - - name: symin + runs-on: ubuntu-20.04 steps: # Load Golang cache build from GitHub - name: Load Caph Golang cache build from GitHub diff --git a/.github/workflows/schedule-scan-image.yml b/.github/workflows/schedule-scan-image.yml index 51a6f968a..066e53890 100644 --- a/.github/workflows/schedule-scan-image.yml +++ b/.github/workflows/schedule-scan-image.yml @@ -9,7 +9,7 @@ jobs: name: Trivy runs-on: ubuntu-latest container: - image: ghcr.io/syself/caph-builder:1.0.7 + image: ghcr.io/syself/caph-builder:1.0.8 credentials: username: ${{ github.actor }} password: ${{ secrets.github_token }} diff --git a/.golangci-suggestions.yaml b/.golangci-suggestions.yaml index df30fcad1..b63852273 100644 --- a/.golangci-suggestions.yaml +++ b/.golangci-suggestions.yaml @@ -94,9 +94,9 @@ linters-settings: allow-leading-space: false require-specific: true staticcheck: - go: "1.20" + go: "1.21" stylecheck: - go: "1.20" + go: "1.21" gocritic: enabled-tags: - diagnostic @@ -151,7 +151,14 @@ linters-settings: severity: warning disabled: false arguments: - - ["call-chain", "loop", "method-call", "recover", "immediate-recover", "return"] # yamllint disable-line rule:line-length + - [ + "call-chain", + "loop", + "method-call", + "recover", + "immediate-recover", + "return", + ] # yamllint disable-line rule:line-length # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported - name: exported severity: warning @@ -218,7 +225,7 @@ linters-settings: - ["ID"] # AllowList - ["VM"] # DenyList unused: - go: "1.20" + go: "1.21" usestdlibvars: # Suggest the use of http.MethodXX. # Default: true @@ -276,8 +283,8 @@ issues: exclude-use-default: false run: timeout: 10m - go: "1.20" + go: "1.21" allow-parallel-runners: true modules-download-mode: vendor skip-dirs: - - vendor$ \ No newline at end of file + - vendor$ diff --git a/.golangci.yaml b/.golangci.yaml index d6d8f7219..09e590238 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -81,9 +81,9 @@ linters-settings: allow-leading-space: false require-specific: true staticcheck: - go: "1.20" + go: "1.21" stylecheck: - go: "1.20" + go: "1.21" gosec: excludes: - G307 # Deferring unsafe method "Close" on type "\*os.File" @@ -111,7 +111,7 @@ linters-settings: - rangeValCopy - hugeParam unused: - go: "1.20" + go: "1.21" issues: max-same-issues: 0 max-issues-per-linter: 0 @@ -205,4 +205,4 @@ run: - "tilt_modules" - "test" allow-parallel-runners: true - modules-download-mode: readonly \ No newline at end of file + modules-download-mode: readonly diff --git a/controllers/hcloudmachine_controller.go b/controllers/hcloudmachine_controller.go index 5ddd8055f..2f6c65d0e 100644 --- a/controllers/hcloudmachine_controller.go +++ b/controllers/hcloudmachine_controller.go @@ -234,7 +234,7 @@ func (r *HCloudMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl return fmt.Errorf("error creating controller: %w", err) } - clusterToObjectFunc, err := util.ClusterToObjectsMapper(r.Client, &infrav1.HCloudMachineList{}, mgr.GetScheme()) + clusterToObjectFunc, err := util.ClusterToTypedObjectsMapper(r.Client, &infrav1.HCloudMachineList{}, mgr.GetScheme()) if err != nil { return fmt.Errorf("failed to create mapper for Cluster to HCloudMachines: %w", err) } @@ -303,6 +303,7 @@ func (r *HCloudMachineReconciler) HetznerClusterToHCloudMachines(_ context.Conte } } +// IgnoreHetznerClusterConditionUpdates is a predicate used for ignoring HetznerCluster condition updates. func IgnoreHetznerClusterConditionUpdates(logger logr.Logger) predicate.Funcs { return predicate.Funcs{ UpdateFunc: func(e event.UpdateEvent) bool { @@ -344,7 +345,6 @@ func IgnoreHetznerClusterConditionUpdates(logger logr.Logger) predicate.Funcs { // Only insignificant fields changed, no need to reconcile log.V(1).Info("Update to resource only changes insignificant fields, will not enqueue event") return false - } // There is a noteworthy diff, so we should reconcile log.V(1).Info("Update to resource changes significant fields, will enqueue event") diff --git a/controllers/hcloudmachinetemplate_controller.go b/controllers/hcloudmachinetemplate_controller.go index d9e82103b..4c32bb164 100644 --- a/controllers/hcloudmachinetemplate_controller.go +++ b/controllers/hcloudmachinetemplate_controller.go @@ -22,11 +22,6 @@ import ( "fmt" "time" - infrav1 "github.com/syself/cluster-api-provider-hetzner/api/v1beta1" - "github.com/syself/cluster-api-provider-hetzner/pkg/scope" - secretutil "github.com/syself/cluster-api-provider-hetzner/pkg/secrets" - hcloudclient "github.com/syself/cluster-api-provider-hetzner/pkg/services/hcloud/client" - "github.com/syself/cluster-api-provider-hetzner/pkg/services/hcloud/machinetemplate" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/klog/v2" @@ -40,6 +35,12 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/reconcile" + + infrav1 "github.com/syself/cluster-api-provider-hetzner/api/v1beta1" + "github.com/syself/cluster-api-provider-hetzner/pkg/scope" + secretutil "github.com/syself/cluster-api-provider-hetzner/pkg/secrets" + hcloudclient "github.com/syself/cluster-api-provider-hetzner/pkg/services/hcloud/client" + "github.com/syself/cluster-api-provider-hetzner/pkg/services/hcloud/machinetemplate" ) // HCloudMachineTemplateReconciler reconciles a HCloudMachineTemplate object. diff --git a/controllers/hetznerbaremetalmachine_controller.go b/controllers/hetznerbaremetalmachine_controller.go index 09534b89a..7e54f3aa2 100644 --- a/controllers/hetznerbaremetalmachine_controller.go +++ b/controllers/hetznerbaremetalmachine_controller.go @@ -230,7 +230,7 @@ func (r *HetznerBareMetalMachineReconciler) SetupWithManager(ctx context.Context return fmt.Errorf("error creating controller: %w", err) } - clusterToObjectFunc, err := util.ClusterToObjectsMapper(r.Client, &infrav1.HetznerBareMetalMachineList{}, mgr.GetScheme()) + clusterToObjectFunc, err := util.ClusterToTypedObjectsMapper(r.Client, &infrav1.HetznerBareMetalMachineList{}, mgr.GetScheme()) if err != nil { return fmt.Errorf("failed to create mapper for Cluster to BareMetalMachines: %w", err) } diff --git a/go.mod b/go.mod index 987b396f7..1fe964027 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/syself/cluster-api-provider-hetzner -go 1.20 +go 1.21 replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.5.0 diff --git a/go.sum b/go.sum index eb7087592..25bfada7f 100644 --- a/go.sum +++ b/go.sum @@ -38,6 +38,7 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU= github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -138,6 +139,7 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= @@ -310,6 +312,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -346,6 +349,7 @@ github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -353,6 +357,7 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -403,6 +408,7 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= @@ -488,6 +494,7 @@ go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= @@ -878,6 +885,7 @@ gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/hack/golang-modules-update.sh b/hack/golang-modules-update.sh index f6152c359..59c5075bc 100755 --- a/hack/golang-modules-update.sh +++ b/hack/golang-modules-update.sh @@ -23,8 +23,8 @@ cd "${REPO_ROOT}" || exit 1 DIRS="./ ./hack/tools" for DIR in ${DIRS}; do - cd ${REPO_ROOT}/${DIR} && go mod download - cd ${REPO_ROOT}/${DIR} && go mod verify - cd ${REPO_ROOT}/${DIR} && go mod tidy - cd ${REPO_ROOT}/${DIR} && go mod vendor -done \ No newline at end of file + cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod download + cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod verify + cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod tidy + cd ${REPO_ROOT}/${DIR} && GO111MODULE=on GOPROXY=https://proxy.golang.org go mod vendor +done diff --git a/hack/upgrade-builder-image.sh b/hack/upgrade-builder-image.sh index 0eca7046b..425d3343f 100755 --- a/hack/upgrade-builder-image.sh +++ b/hack/upgrade-builder-image.sh @@ -25,11 +25,7 @@ set -o errexit set -o nounset set -o pipefail -if [ -z "${BUILDER_IMAGE:-}" ]; then - echo "Please provide BUILDER_IMAGE as env var" - exit 1 -fi - +export BUILDER_IMAGE=ghcr.io/syself/caph-builder REPO_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/..) cd "${REPO_ROOT}" || exit 1 diff --git a/images/builder/Dockerfile b/images/builder/Dockerfile index 559ef32d5..202c99102 100644 --- a/images/builder/Dockerfile +++ b/images/builder/Dockerfile @@ -31,7 +31,7 @@ RUN apk add --no-cache curl && \ FROM docker.io/library/alpine:3.17.3@sha256:b6ca290b6b4cdcca5b3db3ffa338ee0285c11744b4a6abaa9627746ee3291d8d as golangci # update: datasource=github-tags depName=golangci/golangci-lint versioning=semver ENV GOLANGCI_VERSION="v1.52.2" -WORKDIR / +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} @@ -45,7 +45,7 @@ FROM docker.io/aquasec/trivy:0.39.0@sha256:ab281f43ee11b8ea5443ca8897641441f04f1 ############################ # Caph Build Image Base # ############################ -FROM docker.io/library/golang:1.20.2-bullseye@sha256:2101aa981e68ab1e06e3d4ac35ae75ed122f0380e5331e3ae4ba7e811bf9d256 +FROM docker.io/library/golang:1.21.1-bullseye@sha256:357be9f9e594a338ba16f54c4df16481e7e82533a6571cecaf22dca833622f91 # update: datasource=repology depName=debian_11/skopeo versioning=loose ENV SKOPEO_VERSION="1.2.2+dfsg1-1+b6" @@ -65,7 +65,7 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ pip install --no-cache-dir \ yamllint==${YAMLLINT_VERSION} \ - yamlfixer-opt-nc==${YAMLFIXER_VERSION} + yamlfixer-opt-nc==${YAMLFIXER_VERSION} COPY --from=lychee /usr/bin/lychee /usr/bin/lychee COPY --from=golangci /bin/golangci-lint /usr/local/bin @@ -76,4 +76,4 @@ ENV GOCACHE=/go/cache COPY build.sh / RUN chmod +x /build.sh -ENTRYPOINT ["/build.sh"] \ No newline at end of file +ENTRYPOINT ["/build.sh"] diff --git a/images/caph/Dockerfile b/images/caph/Dockerfile index b87a16395..4390b4c4c 100644 --- a/images/caph/Dockerfile +++ b/images/caph/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # Build the manager binary -FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.20.5@sha256:fd9306e1c664bd49a11d4a4a04e41303430e069e437d137876e9290a555e06fb as build +FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.21.1-bullseye@sha256:357be9f9e594a338ba16f54c4df16481e7e82533a6571cecaf22dca833622f91 as build ARG TARGETOS TARGETARCH COPY . /src/cluster-api-provider-hetzner @@ -28,4 +28,4 @@ WORKDIR / COPY --from=build /src/cluster-api-provider-hetzner/manager . # Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies USER 65532 -ENTRYPOINT ["/manager"] \ No newline at end of file +ENTRYPOINT ["/manager"] diff --git a/pkg/services/baremetal/client/robot/robot_client.go b/pkg/services/baremetal/client/robot/robot_client.go index dc14532a4..26ece1edb 100644 --- a/pkg/services/baremetal/client/robot/robot_client.go +++ b/pkg/services/baremetal/client/robot/robot_client.go @@ -51,6 +51,7 @@ type Factory interface { NewClient(Credentials) Client } +// LoggingTransport is a struct for creating new logger for robot API. type LoggingTransport struct { roundTripper http.RoundTripper log logr.Logger @@ -58,8 +59,8 @@ type LoggingTransport struct { var replaceHex = regexp.MustCompile(`0x[0123456789abcdef]+`) +// RoundTrip is used for logging api calls to robot API. func (lt *LoggingTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) { - stack := replaceHex.ReplaceAllString(string(debug.Stack()), "0xX") resp, err = lt.roundTripper.RoundTrip(req) @@ -71,7 +72,7 @@ func (lt *LoggingTransport) RoundTrip(req *http.Request) (resp *http.Response, e return resp, nil } -// NewClient creates new HCloud clients. +// NewClient creates new robot clients. func (f *factory) NewClient(creds Credentials) Client { client := &http.Client{ Transport: &LoggingTransport{ diff --git a/pkg/services/hcloud/loadbalancer/loadbalancer.go b/pkg/services/hcloud/loadbalancer/loadbalancer.go index b886e2b02..273b6a69b 100644 --- a/pkg/services/hcloud/loadbalancer/loadbalancer.go +++ b/pkg/services/hcloud/loadbalancer/loadbalancer.go @@ -279,13 +279,6 @@ func (s *Service) reconcileServices(ctx context.Context, lb *hcloud.LoadBalancer return multierr } -func max(x, y int) int { - if x > y { - return x - } - return y -} - func (s *Service) createLoadBalancer(ctx context.Context) (*hcloud.LoadBalancer, error) { opts := createOptsFromSpec(s.scope.HetznerCluster) lb, err := s.scope.HCloudClient.CreateLoadBalancer(ctx, opts)