From e5dd67dbf9d2d4dc229d457662422499e9965218 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:43:48 +0200 Subject: [PATCH 1/6] Bump zeebe-io/backport-action from 2.5.0 to 3.0.2 (#71) Bumps [zeebe-io/backport-action](https://github.com/zeebe-io/backport-action) from 2.5.0 to 3.0.2. - [Release notes](https://github.com/zeebe-io/backport-action/releases) - [Commits](https://github.com/zeebe-io/backport-action/compare/v2.5.0...v3.0.2) --- updated-dependencies: - dependency-name: zeebe-io/backport-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/backport.yml | 2 +- .github/workflows/commands.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 950de45..aad9ff1 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -27,7 +27,7 @@ jobs: fetch-depth: 0 - name: Open Backport PR - uses: zeebe-io/backport-action@v2.5.0 + uses: zeebe-io/backport-action@v3.0.2 with: github_token: ${{ secrets.GITHUB_TOKEN }} github_workspace: ${{ github.workspace }} diff --git a/.github/workflows/commands.yml b/.github/workflows/commands.yml index 9f6c5b2..1595d6e 100644 --- a/.github/workflows/commands.yml +++ b/.github/workflows/commands.yml @@ -24,7 +24,7 @@ jobs: fetch-depth: 0 - name: Open Backport PR - uses: zeebe-io/backport-action@v2.5.0 + uses: zeebe-io/backport-action@v3.0.2 with: github_token: ${{ secrets.GITHUB_TOKEN }} github_workspace: ${{ github.workspace }} From 0857b92afe7cd083e94d204e1e2c33c651ce6a7d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:44:04 +0200 Subject: [PATCH 2/6] Bump golangci/golangci-lint-action from 5 to 6 (#72) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 5 to 6. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v5...v6) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index deaa790..48e337d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: # We could run 'make lint' but we prefer this action because it leaves # 'annotations' (i.e. it comments on PRs to point out linter violations). - name: Lint - uses: golangci/golangci-lint-action@v5 + uses: golangci/golangci-lint-action@v6 with: version: latest args: --timeout 10m From 75a4e0182cb285d6bd6425bbe3b2defbbcefba45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jules=20Cast=C3=A9ran?= Date: Wed, 5 Jun 2024 15:03:23 +0200 Subject: [PATCH 3/6] chore: update linter config (#73) --- .golangci.yml | 46 +++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 494a907..5ad658a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,12 +1,6 @@ -run: - deadline: 10m - - skip-files: - - "zz_\\..+\\.go$" - output: - # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: colored-line-number + formats: + - format: colored-line-number linters-settings: errcheck: @@ -18,18 +12,11 @@ linters-settings: # default is false: such cases aren't reported by default. check-blank: false - # [deprecated] comma-separated list of pairs of the form pkg:regex - # the regex is used to ignore names within pkg. (default "fmt:.*"). - # see https://github.com/kisielk/errcheck#the-deprecated-method for details - ignore: fmt:.*,io/ioutil:^Read.* govet: # report about shadowed variables - check-shadowing: false - - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.8 + disable: + - shadow gofmt: # simplify code: gofmt with `-s` option, true by default @@ -44,10 +31,6 @@ linters-settings: # minimal code complexity to report, 30 by default (but we recommend 10-20) min-complexity: 10 - maligned: - # print struct with more effective memory layout or not, false by default - suggest-new: true - dupl: # tokens count to trigger issue, 150 by default threshold: 100 @@ -67,7 +50,7 @@ linters-settings: # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: # if it's called for subdir of a project it can't find funcs usages. All text editor integrations # with golangci-lint call it on a directory with the changed file. - check-exported: false + exported-is-used: true unparam: # Inspect exported functions, default is false. Set to true if no external program/library imports your code. @@ -104,16 +87,17 @@ linters-settings: linters: enable: - - megacheck + - gosimple + - staticcheck + - unused - govet - gocyclo - gocritic - - interfacer - goconst - goimports - gofmt # We enable this as well as goimports for its simplify mode. - prealloc - - golint + - revive - unconvert - misspell - nakedret @@ -125,6 +109,8 @@ linters: issues: + exclude-files: + - "zz_\\..+\\.go$" # Excluding configuration per-path and per-linter exclude-rules: # Exclude some linters from running on tests files. @@ -136,7 +122,7 @@ issues: - gosec - scopelint - unparam - + # Ease some gocritic warnings on test files. - path: _test\.go text: "(unnamedResult|exitAfterDefer)" @@ -174,12 +160,6 @@ issues: - gosec - gas - # Independently from option `exclude` we use default exclude patterns, - # it can be disabled by this option. To list all - # excluded by default patterns execute `golangci-lint run --help`. - # Default value for this option is true. - exclude-use-default: false - # Show only new issues: if there are unstaged changes or untracked files, # only those changes are analyzed, else only changes in HEAD~ are analyzed. # It's a super-useful option for integration of golangci-lint into existing @@ -189,7 +169,7 @@ issues: new: false # Maximum issues count per one linter. Set to 0 to disable. Default is 50. - max-per-linter: 0 + max-issues-per-linter: 0 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. max-same-issues: 0 From 44d57c63ad0c9f4589fcbb16c2dc88326617fced Mon Sep 17 00:00:00 2001 From: Yacine Fodil <105779815+yfodil@users.noreply.github.com> Date: Thu, 6 Jun 2024 10:12:54 +0200 Subject: [PATCH 4/6] feat: add managed resources metrics (#70) * feat: add managed resources metrics * goimports * remove deprecated linters --- cmd/provider/main.go | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/cmd/provider/main.go b/cmd/provider/main.go index 26d7ff5..6215fe0 100644 --- a/cmd/provider/main.go +++ b/cmd/provider/main.go @@ -10,15 +10,20 @@ import ( "path/filepath" "time" + "sigs.k8s.io/controller-runtime/pkg/metrics" + "sigs.k8s.io/controller-runtime/pkg/cache" - "github.com/alecthomas/kingpin/v2" kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/leaderelection/resourcelock" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/log/zap" + "github.com/alecthomas/kingpin/v2" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" "github.com/crossplane/crossplane-runtime/pkg/certificates" xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" @@ -39,15 +44,16 @@ import ( func main() { var ( - app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for Scaleway").DefaultEnvars() - debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() - syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() - pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() - leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() - terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() - providerSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() - providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() - maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for Scaleway").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + pollStateMetricInterval = app.Flag("poll-state-metric", "State metric recording interval").Default("5s").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + providerSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() namespace = app.Flag("registry_namespace.yaml", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() @@ -83,6 +89,18 @@ func main() { kingpin.FatalIfError(err, "Cannot create controller manager") kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add Scaleway APIs to scheme") + metricRecorder := managed.NewMRMetricRecorder() + stateMetrics := statemetrics.NewMRStateMetrics() + + metrics.Registry.MustRegister(metricRecorder) + metrics.Registry.MustRegister(stateMetrics) + + metricOptions := &xpcontroller.MetricOptions{ + PollStateMetricInterval: *pollStateMetricInterval, + MRMetrics: metricRecorder, + MRStateMetrics: stateMetrics, + } + featureFlags := &feature.Flags{} o := tjcontroller.Options{ Options: xpcontroller.Options{ @@ -91,6 +109,7 @@ func main() { PollInterval: *pollInterval, MaxConcurrentReconciles: 1, Features: featureFlags, + MetricOptions: metricOptions, }, Provider: config.GetProvider(), // use the following WorkspaceStoreOption to enable the shared gRPC mode From cae57d87b438cae321c92b8399a6cc038cc08529 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:24:02 +0200 Subject: [PATCH 5/6] Bump github.com/crossplane/upjet from 1.4.0 to 1.4.1 (#75) Bumps [github.com/crossplane/upjet](https://github.com/crossplane/upjet) from 1.4.0 to 1.4.1. - [Release notes](https://github.com/crossplane/upjet/releases) - [Commits](https://github.com/crossplane/upjet/compare/v1.4.0...v1.4.1) --- updated-dependencies: - dependency-name: github.com/crossplane/upjet dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2bcde50..85404e7 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/alecthomas/kingpin/v2 v2.4.0 github.com/crossplane/crossplane-runtime v1.17.0-rc.0 github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 - github.com/crossplane/upjet v1.4.0 + github.com/crossplane/upjet v1.4.1 github.com/pkg/errors v0.9.1 k8s.io/apimachinery v0.30.1 k8s.io/client-go v0.29.4 diff --git a/go.sum b/go.sum index fe46d85..a442abc 100644 --- a/go.sum +++ b/go.sum @@ -34,8 +34,8 @@ github.com/crossplane/crossplane-runtime v1.17.0-rc.0 h1:v+JZ+94bQhunadP3wM64Mw6 github.com/crossplane/crossplane-runtime v1.17.0-rc.0/go.mod h1:Pz2tdGVMF6KDGzHZOkvKro0nKc8EzK0sb/nSA7pH4Dc= github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 h1:HigXs5tEQxWz0fcj8hzbU2UAZgEM7wPe0XRFOsrtF8Y= github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79/go.mod h1:+e4OaFlOcmr0JvINHl/yvEYBrZawzTgj6pQumOH1SS0= -github.com/crossplane/upjet v1.4.0 h1:twKCU8omU7VAA7E5fpbQkqDHjVnoTb8EXqmB805Q37o= -github.com/crossplane/upjet v1.4.0/go.mod h1:3pDVtCgyBc5f2Zx4K5HEPxxhjndmOc5CHCJNpIivK/g= +github.com/crossplane/upjet v1.4.1 h1:f2HawXz8OGte1jhe3Fa+IIOca+eCsNFE3Fc5rnkF24Y= +github.com/crossplane/upjet v1.4.1/go.mod h1:3pDVtCgyBc5f2Zx4K5HEPxxhjndmOc5CHCJNpIivK/g= github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw= github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 553e564b95ec7cb73c3750b15f69808e050edcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Fri, 28 Jun 2024 16:27:36 +0200 Subject: [PATCH 6/6] chore: update build submodule & add support for codeowners (#80) * chore: add support for codeowners * update build submodule * set crossplane version --------- Co-authored-by: Yacine FODIL --- .github/CODEOWNERS | 1 + .github/workflows/ci.yml | 10 +++++----- .gitmodules | 2 +- Makefile | 10 +++++++--- build | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ea229aa --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @yfodil diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48e337d..7d11f7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: restore-keys: ${{ runner.os }}-build-lint- - name: Vendor Dependencies - run: make vendor vendor.check + run: make modules.download modules.check # We could run 'make lint' but we prefer this action because it leaves # 'annotations' (i.e. it comments on PRs to point out linter violations). @@ -105,7 +105,7 @@ jobs: restore-keys: ${{ runner.os }}-build-check-diff- - name: Vendor Dependencies - run: make vendor vendor.check + run: make modules.download modules.check - name: Check Diff run: make check-diff @@ -138,7 +138,7 @@ jobs: restore-keys: ${{ runner.os }}-build-unit-tests- - name: Vendor Dependencies - run: make vendor vendor.check + run: make modules.download modules.check - name: Run Unit Tests run: make -j2 test @@ -177,7 +177,7 @@ jobs: restore-keys: ${{ runner.os }}-build-unit-tests- - name: Vendor Dependencies - run: make vendor vendor.check + run: make modules.download modules.check - name: Deploying locally built provider package run: make local-deploy @@ -232,7 +232,7 @@ jobs: restore-keys: ${{ runner.os }}-build-publish-artifacts- - name: Vendor Dependencies - run: make vendor vendor.check + run: make modules.download modules.check - name: Build Artifacts run: make -j2 build.all diff --git a/.gitmodules b/.gitmodules index c2fad47..8f84209 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "build"] path = build - url = https://github.com/upbound/build + url = https://github.com/crossplane/build diff --git a/Makefile b/Makefile index 1a61667..762b616 100644 --- a/Makefile +++ b/Makefile @@ -48,11 +48,12 @@ GO_SUBDIRS += cmd internal apis # ==================================================================================== # Setup Kubernetes tools -KIND_VERSION = v0.15.0 -UP_VERSION = v0.14.0 +KIND_VERSION = v0.23.0 +UP_VERSION = v0.31.0 UP_CHANNEL = stable -UPTEST_VERSION = v0.2.1 +UPTEST_VERSION = v0.12.0 -include build/makelib/k8s_tools.mk +CROSSPLANE_VERSION = 1.16.0 # ==================================================================================== # Setup Images @@ -199,3 +200,6 @@ crossplane.help: help-special: crossplane.help .PHONY: crossplane.help help-special + +vendor: modules.download +vendor.check: modules.check \ No newline at end of file diff --git a/build b/build index 7da2fde..c40a953 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit 7da2fdeb3dc1ebbce8210a58616debe34ef0fd97 +Subproject commit c40a953a4e49fbeff593861e6b723acc3989b244