From 37100b5807449e26978651e5977d408b62329ff6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:17:36 +0000 Subject: [PATCH 1/3] vendor: bump github.com/operator-framework/operator-sdk Bumps the github-dependencies group in /tools with 1 update: [github.com/operator-framework/operator-sdk](https://github.com/operator-framework/operator-sdk). Updates `github.com/operator-framework/operator-sdk` from 1.36.1 to 1.37.0 - [Release notes](https://github.com/operator-framework/operator-sdk/releases) - [Changelog](https://github.com/operator-framework/operator-sdk/blob/master/.goreleaser.yml) - [Commits](https://github.com/operator-framework/operator-sdk/compare/v1.36.1...v1.37.0) --- updated-dependencies: - dependency-name: github.com/operator-framework/operator-sdk dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-dependencies ... Signed-off-by: dependabot[bot] --- tools/go.mod | 10 +- tools/go.sum | 20 +- tools/vendor/github.com/docker/cli/AUTHORS | 20 + tools/vendor/github.com/docker/cli/NOTICE | 2 +- .../docker/cli/cli/config/config.go | 69 +++- .../docker/cli/cli/config/configfile/file.go | 2 + .../cli/cli/config/credentials/file_store.go | 19 +- tools/vendor/github.com/docker/docker/AUTHORS | 29 +- .../docker/api/types/registry/authconfig.go | 14 +- .../docker/api/types/registry/registry.go | 26 -- .../docker/api/types/registry/search.go | 47 +++ .../docker/api/types/versions/README.md | 14 - .../docker/docker/pkg/homedir/homedir.go | 44 --- .../docker/pkg/homedir/homedir_linux.go | 105 ----- .../docker/pkg/homedir/homedir_others.go | 32 -- .../docker/docker/pkg/homedir/homedir_unix.go | 8 - .../docker/pkg/homedir/homedir_windows.go | 6 - .../docker/docker/pkg/ioutils/fswriters.go | 4 +- .../github.com/docker/docker/registry/auth.go | 22 +- .../docker/docker/registry/search.go | 27 +- .../runc/libcontainer/user/user.go | 1 - .../helm-operator-plugins/LICENSE | 201 ---------- .../pkg/plugins/helm/v1/chartutil/chart.go | 198 ---------- .../pkg/plugins/hybrid/v1alpha/init.go | 154 -------- .../pkg/plugins/hybrid/v1alpha/plugin.go | 46 --- .../plugins/hybrid/v1alpha/scaffolds/init.go | 158 -------- .../internal/templates/dockerfile.go | 82 ---- .../internal/templates/dockerignore.go | 45 --- .../scaffolds/internal/templates/gitignore.go | 56 --- .../scaffolds/internal/templates/gomod.go | 54 --- .../internal/templates/hack/boilerplate.go | 128 ------ .../scaffolds/internal/templates/main.go | 369 ------------------ .../scaffolds/internal/templates/makefile.go | 205 ---------- .../internal/templates/rbac/manager_role.go | 79 ---- .../scaffolds/internal/templates/watches.go | 97 ----- .../pkg/plugins/util/cleanup.go | 203 ---------- .../pkg/plugins/util/message.go | 20 - .../pkg/plugins/util/utils.go | 84 ---- .../java-operator-plugins/LICENSE | 201 ---------- .../pkg/quarkus/v1beta/api.go | 267 ------------- .../pkg/quarkus/v1beta/init.go | 124 ------ .../pkg/quarkus/v1beta/plugin.go | 68 ---- .../pkg/quarkus/v1beta/scaffolds/api.go | 83 ---- .../pkg/quarkus/v1beta/scaffolds/doc.go | 18 - .../pkg/quarkus/v1beta/scaffolds/init.go | 87 ----- .../templates/applicationproperties.go | 58 --- .../templates/controller/controller.go | 75 ---- .../scaffolds/internal/templates/doc.go | 18 - .../scaffolds/internal/templates/gitignore.go | 54 --- .../scaffolds/internal/templates/makefile.go | 125 ------ .../internal/templates/model/model.go | 63 --- .../internal/templates/model/modelspec.go | 58 --- .../internal/templates/model/modelstatus.go | 57 --- .../internal/templates/operatorfile.go | 82 ---- .../scaffolds/internal/templates/pomxml.go | 123 ------ .../scaffolds/internal/templates/util/file.go | 38 -- .../pkg/quarkus/v1beta/util/util.go | 157 -------- .../internal/cmd/operator-sdk/cli/cli.go | 15 - .../internal/util/projutil/project_util.go | 4 - tools/vendor/modules.txt | 29 +- 60 files changed, 216 insertions(+), 4288 deletions(-) create mode 100644 tools/vendor/github.com/docker/docker/api/types/registry/search.go delete mode 100644 tools/vendor/github.com/docker/docker/api/types/versions/README.md delete mode 100644 tools/vendor/github.com/docker/docker/pkg/homedir/homedir.go delete mode 100644 tools/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go delete mode 100644 tools/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go delete mode 100644 tools/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go delete mode 100644 tools/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/LICENSE delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/helm/v1/chartutil/chart.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/init.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/plugin.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/init.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerfile.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerignore.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/gitignore.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/gomod.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/hack/boilerplate.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/main.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/makefile.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/rbac/manager_role.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/watches.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/cleanup.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/message.go delete mode 100644 tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/utils.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/LICENSE delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/api.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/init.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/plugin.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/api.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/doc.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/init.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/applicationproperties.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/controller/controller.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/doc.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/gitignore.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/makefile.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/model.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/modelspec.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/modelstatus.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/operatorfile.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/pomxml.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util/file.go delete mode 100644 tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/util/util.go diff --git a/tools/go.mod b/tools/go.mod index 3fb635d7f..b3230c4df 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -3,7 +3,7 @@ module github.com/csi-addons/kubernetes-csi-addons/tools go 1.22.0 require ( - github.com/operator-framework/operator-sdk v1.36.1 + github.com/operator-framework/operator-sdk v1.37.0 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 google.golang.org/protobuf v1.34.2 sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240102165319-7f316f1309b1 @@ -44,9 +44,9 @@ require ( github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/distribution/reference v0.6.0 // indirect - github.com/docker/cli v25.0.5+incompatible // indirect + github.com/docker/cli v27.2.0+incompatible // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v25.0.5+incompatible // indirect + github.com/docker/docker v27.2.0+incompatible // indirect github.com/docker/docker-credential-helpers v0.8.0 // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect @@ -138,12 +138,10 @@ require ( github.com/onsi/gomega v1.34.2 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc6 // indirect - github.com/opencontainers/runc v1.1.12 // indirect + github.com/opencontainers/runc v1.1.14 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/operator-framework/ansible-operator-plugins v1.35.0 // indirect github.com/operator-framework/api v0.23.0 // indirect - github.com/operator-framework/helm-operator-plugins v0.2.2 // indirect - github.com/operator-framework/java-operator-plugins v0.10.0 // indirect github.com/operator-framework/operator-manifest-tools v0.6.0 // indirect github.com/operator-framework/operator-registry v1.39.0 // indirect github.com/otiai10/copy v1.14.0 // indirect diff --git a/tools/go.sum b/tools/go.sum index 37c384d9c..7dea20682 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -99,12 +99,12 @@ github.com/distribution/distribution/v3 v3.0.0-alpha.1 h1:jn7I1gvjOvmLztH1+1cLiU github.com/distribution/distribution/v3 v3.0.0-alpha.1/go.mod h1:LCp4JZp1ZalYg0W/TN05jarCQu+h4w7xc7ZfQF4Y/cY= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/cli v25.0.5+incompatible h1:3Llw3kcE1gOScEojA247iDD+p1l9hHeC7H3vf3Zd5fk= -github.com/docker/cli v25.0.5+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v27.2.0+incompatible h1:yHD1QEB1/0vr5eBNpu8tncu8gWxg8EydFPOSKHzXSMM= +github.com/docker/cli v27.2.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE= -github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.2.0+incompatible h1:Rk9nIVdfH3+Vz4cyI/uhbINhEZ/oLmc+CBXmH6fbNk4= +github.com/docker/docker v27.2.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.0 h1:YQFtbBQb4VrpoPxhFuzEBPQ9E16qz5SpHLS+uswaCp8= github.com/docker/docker-credential-helpers v0.8.0/go.mod h1:UGFXcuoQ5TxPiB54nHOZ32AWRqQdECoh/Mg0AlEYb40= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= @@ -411,24 +411,20 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc6 h1:XDqvyKsJEbRtATzkgItUqBA7QHk58yxX1Ov9HERHNqU= github.com/opencontainers/image-spec v1.1.0-rc6/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= +github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= +github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/operator-framework/ansible-operator-plugins v1.35.0 h1:ranI6NhcnAl2sokuwWI0OYqtcT/1fPIfEfWcMFLXUBg= github.com/operator-framework/ansible-operator-plugins v1.35.0/go.mod h1:ehsR1S7COaxHD54t7/1CXuvnTkSiMxUqgJhTGVcH6Fs= github.com/operator-framework/api v0.23.0 h1:kHymOwcHBpBVujT49SKOCd4EVG7Odwj4wl3NbOR2LLA= github.com/operator-framework/api v0.23.0/go.mod h1:oKcFOz+Xc1UhMi2Pzcp6qsO7wjS4r+yP7EQprQBXrfM= -github.com/operator-framework/helm-operator-plugins v0.2.2 h1:xbVRXM4VIpixrjA9OwVF+Kky6DpYHpkOnME2HEoQUfg= -github.com/operator-framework/helm-operator-plugins v0.2.2/go.mod h1:h8HwfHHr29GRpduxy5jCL/sIe4TDarS5XHExBHVDc8k= -github.com/operator-framework/java-operator-plugins v0.10.0 h1:JkYapsvQv08+KXMWXhIyJ3JKcB6BSSvvK+RsJe2VMz0= -github.com/operator-framework/java-operator-plugins v0.10.0/go.mod h1:2qkhvf5jY3Myd6Ef+3HtseJyZPAAOWTa8xTOsPidHKY= github.com/operator-framework/operator-manifest-tools v0.6.0 h1:1fUP0ki3plXM6WivlcE6m5cV8fO2ZZVPHJM93vlgWJo= github.com/operator-framework/operator-manifest-tools v0.6.0/go.mod h1:rL+U7e+hpH87/kq88mbEprZpq25lwtJofsAFhq6Y/Wc= github.com/operator-framework/operator-registry v1.39.0 h1:GiAlmA2h16sLpLjVIuURd2ANm7wYoUbssGCJbdGauYw= github.com/operator-framework/operator-registry v1.39.0/go.mod h1:PxN7myibIBIHeXTNu65tIJkCl1HuFDMU3NN6jrPHJLs= -github.com/operator-framework/operator-sdk v1.36.1 h1:BHStDCO38uRU0Yu/kDtmG3K9QaM+zWf3FpaAhY6KlZ0= -github.com/operator-framework/operator-sdk v1.36.1/go.mod h1:m8MAGTUwjHxTTYt+zkuoKdBP2zdqfolZygtr29bWnWI= +github.com/operator-framework/operator-sdk v1.37.0 h1:yRRv2+MNvGgWgPsrg4snJj1dsmkrjkrIQsI7sPGjCvY= +github.com/operator-framework/operator-sdk v1.37.0/go.mod h1:DAxga5gdjFfhRGZ8Cmqaz2ltwhqA+kr+pZ+jtImHgX0= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= diff --git a/tools/vendor/github.com/docker/cli/AUTHORS b/tools/vendor/github.com/docker/cli/AUTHORS index d6d23b3de..ad1abd496 100644 --- a/tools/vendor/github.com/docker/cli/AUTHORS +++ b/tools/vendor/github.com/docker/cli/AUTHORS @@ -26,6 +26,7 @@ Akhil Mohan Akihiro Suda Akim Demaille Alan Thompson +Alano Terblanche Albert Callarisa Alberto Roura Albin Kerouanton @@ -65,6 +66,7 @@ Andrew Hsu Andrew Macpherson Andrew McDonnell Andrew Po +Andrew-Zipperer Andrey Petrov Andrii Berehuliak André Martins @@ -124,11 +126,13 @@ Bryan Bess Bryan Boreham Bryan Murphy bryfry +Calvin Liu Cameron Spear Cao Weiwei Carlo Mion Carlos Alexandro Becker Carlos de Paula +Casey Korver Ce Gao Cedric Davies Cezar Sa Espinola @@ -160,6 +164,8 @@ Christophe Vidal Christopher Biscardi Christopher Crone Christopher Jones +Christopher Petito <47751006+krissetto@users.noreply.github.com> +Christopher Petito Christopher Svensson Christy Norman Chun Chen @@ -212,6 +218,7 @@ David Cramer David Dooling David Gageot David Karlsson +David le Blanc David Lechner David Scott David Sheets @@ -298,6 +305,7 @@ Gang Qiao Gary Schaetz Genki Takiuchi George MacRorie +George Margaritis George Xie Gianluca Borello Gildas Cuisinier @@ -306,6 +314,7 @@ Gleb Stsenov Goksu Toprak Gou Rao Govind Rai +Grace Choi Graeme Wiebe Grant Reaber Greg Pflaum @@ -386,6 +395,7 @@ Jezeniel Zapanta Jian Zhang Jie Luo Jilles Oldenbeuving +Jim Chen Jim Galasyn Jim Lin Jimmy Leger @@ -416,6 +426,7 @@ John Willis Jon Johnson Jon Zeolla Jonatas Baldin +Jonathan A. Sternberg Jonathan Boulle Jonathan Lee Jonathan Lomas @@ -470,6 +481,7 @@ Kevin Woblick khaled souf Kim Eik Kir Kolyshkin +Kirill A. Korinsky Kotaro Yoshimatsu Krasi Georgiev Kris-Mikael Krister @@ -530,6 +542,7 @@ Marco Vedovati Marcus Martins Marianna Tessel Marius Ileana +Marius Meschter Marius Sturm Mark Oates Marsh Macy @@ -538,6 +551,7 @@ Mary Anthony Mason Fish Mason Malone Mateusz Major +Mathias Duedahl <64321057+Lussebullen@users.noreply.github.com> Mathieu Champlon Mathieu Rollet Matt Gucci @@ -547,6 +561,7 @@ Matthew Heon Matthieu Hauglustaine Mauro Porras P Max Shytikov +Max-Julian Pogner Maxime Petazzoni Maximillian Fan Xavier Mei ChunTao @@ -610,6 +625,7 @@ Nathan McCauley Neil Peterson Nick Adcock Nick Santos +Nick Sieger Nico Stapelbroek Nicola Kabar Nicolas Borboën @@ -704,6 +720,7 @@ Rory Hunter Ross Boucher Rubens Figueiredo Rui Cao +Rui JingAn Ryan Belgrave Ryan Detzel Ryan Stelly @@ -797,6 +814,7 @@ Tim Hockin Tim Sampson Tim Smith Tim Waugh +Tim Welsh Tim Wraight timfeirg Timothy Hobbs @@ -880,9 +898,11 @@ Zhang Wei Zhang Wentao ZhangHang zhenghenghuo +Zhiwei Liang Zhou Hao Zhoulin Xie Zhu Guihua +Zhuo Zhi Álex González Álvaro Lázaro Átila Camurça Alves diff --git a/tools/vendor/github.com/docker/cli/NOTICE b/tools/vendor/github.com/docker/cli/NOTICE index 58b19b6d1..1c40faaec 100644 --- a/tools/vendor/github.com/docker/cli/NOTICE +++ b/tools/vendor/github.com/docker/cli/NOTICE @@ -14,6 +14,6 @@ United States and other governments. It is your responsibility to ensure that your use and/or transfer does not violate applicable laws. -For more information, please see https://www.bis.doc.gov +For more information, see https://www.bis.doc.gov See also https://www.apache.org/dev/crypto.html and/or seek legal counsel. diff --git a/tools/vendor/github.com/docker/cli/cli/config/config.go b/tools/vendor/github.com/docker/cli/cli/config/config.go index 952f6e71f..5a5184326 100644 --- a/tools/vendor/github.com/docker/cli/cli/config/config.go +++ b/tools/vendor/github.com/docker/cli/cli/config/config.go @@ -4,14 +4,15 @@ import ( "fmt" "io" "os" + "os/user" "path/filepath" + "runtime" "strings" "sync" "github.com/docker/cli/cli/config/configfile" "github.com/docker/cli/cli/config/credentials" "github.com/docker/cli/cli/config/types" - "github.com/docker/docker/pkg/homedir" "github.com/pkg/errors" ) @@ -42,12 +43,38 @@ func resetConfigDir() { initConfigDir = new(sync.Once) } +// getHomeDir returns the home directory of the current user with the help of +// environment variables depending on the target operating system. +// Returned path should be used with "path/filepath" to form new paths. +// +// On non-Windows platforms, it falls back to nss lookups, if the home +// directory cannot be obtained from environment-variables. +// +// If linking statically with cgo enabled against glibc, ensure the +// osusergo build tag is used. +// +// If needing to do nss lookups, do not disable cgo or set osusergo. +// +// getHomeDir is a copy of [pkg/homedir.Get] to prevent adding docker/docker +// as dependency for consumers that only need to read the config-file. +// +// [pkg/homedir.Get]: https://pkg.go.dev/github.com/docker/docker@v26.1.4+incompatible/pkg/homedir#Get +func getHomeDir() string { + home, _ := os.UserHomeDir() + if home == "" && runtime.GOOS != "windows" { + if u, err := user.Current(); err == nil { + return u.HomeDir + } + } + return home +} + // Dir returns the directory the configuration file is stored in func Dir() string { initConfigDir.Do(func() { configDir = os.Getenv(EnvOverrideConfigDir) if configDir == "" { - configDir = filepath.Join(homedir.Get(), configFileDir) + configDir = filepath.Join(getHomeDir(), configFileDir) } }) return configDir @@ -75,7 +102,7 @@ func Path(p ...string) (string, error) { } // LoadFromReader is a convenience function that creates a ConfigFile object from -// a reader +// a reader. It returns an error if configData is malformed. func LoadFromReader(configData io.Reader) (*configfile.ConfigFile, error) { configFile := configfile.ConfigFile{ AuthConfigs: make(map[string]types.AuthConfig), @@ -84,8 +111,14 @@ func LoadFromReader(configData io.Reader) (*configfile.ConfigFile, error) { return &configFile, err } -// Load reads the configuration files in the given directory, and sets up -// the auth config information and returns values. +// Load reads the configuration file ([ConfigFileName]) from the given directory. +// If no directory is given, it uses the default [Dir]. A [*configfile.ConfigFile] +// is returned containing the contents of the configuration file, or a default +// struct if no configfile exists in the given location. +// +// Load returns an error if a configuration file exists in the given location, +// but cannot be read, or is malformed. Consumers must handle errors to prevent +// overwriting an existing configuration file. func Load(configDir string) (*configfile.ConfigFile, error) { if configDir == "" { configDir = Dir() @@ -100,29 +133,37 @@ func load(configDir string) (*configfile.ConfigFile, error) { file, err := os.Open(filename) if err != nil { if os.IsNotExist(err) { - // - // if file is there but we can't stat it for any reason other - // than it doesn't exist then stop + // It is OK for no configuration file to be present, in which + // case we return a default struct. return configFile, nil } - // if file is there but we can't stat it for any reason other - // than it doesn't exist then stop - return configFile, nil + // Any other error happening when failing to read the file must be returned. + return configFile, errors.Wrap(err, "loading config file") } defer file.Close() err = configFile.LoadFromReader(file) if err != nil { - err = errors.Wrap(err, filename) + err = errors.Wrapf(err, "loading config file: %s: ", filename) } return configFile, err } // LoadDefaultConfigFile attempts to load the default config file and returns -// an initialized ConfigFile struct if none is found. +// a reference to the ConfigFile struct. If none is found or when failing to load +// the configuration file, it initializes a default ConfigFile struct. If no +// credentials-store is set in the configuration file, it attempts to discover +// the default store to use for the current platform. +// +// Important: LoadDefaultConfigFile prints a warning to stderr when failing to +// load the configuration file, but otherwise ignores errors. Consumers should +// consider using [Load] (and [credentials.DetectDefaultStore]) to detect errors +// when updating the configuration file, to prevent discarding a (malformed) +// configuration file. func LoadDefaultConfigFile(stderr io.Writer) *configfile.ConfigFile { configFile, err := load(Dir()) if err != nil { - _, _ = fmt.Fprintf(stderr, "WARNING: Error loading config file: %v\n", err) + // FIXME(thaJeztah): we should not proceed here to prevent overwriting existing (but malformed) config files; see https://github.com/docker/cli/issues/5075 + _, _ = fmt.Fprintln(stderr, "WARNING: Error", err) } if !configFile.ContainsAuth() { configFile.CredentialsStore = credentials.DetectDefaultStore(configFile.CredentialsStore) diff --git a/tools/vendor/github.com/docker/cli/cli/config/configfile/file.go b/tools/vendor/github.com/docker/cli/cli/config/configfile/file.go index 442c31110..ae9dcb337 100644 --- a/tools/vendor/github.com/docker/cli/cli/config/configfile/file.go +++ b/tools/vendor/github.com/docker/cli/cli/config/configfile/file.go @@ -41,6 +41,7 @@ type ConfigFile struct { CLIPluginsExtraDirs []string `json:"cliPluginsExtraDirs,omitempty"` Plugins map[string]map[string]string `json:"plugins,omitempty"` Aliases map[string]string `json:"aliases,omitempty"` + Features map[string]string `json:"features,omitempty"` } // ProxyConfig contains proxy configuration settings @@ -302,6 +303,7 @@ func (configFile *ConfigFile) GetAllCredentials() (map[string]types.AuthConfig, for registryHostname := range configFile.CredentialHelpers { newAuth, err := configFile.GetAuthConfig(registryHostname) if err != nil { + // TODO(thaJeztah): use context-logger, so that this output can be suppressed (in tests). logrus.WithError(err).Warnf("Failed to get credentials for registry: %s", registryHostname) continue } diff --git a/tools/vendor/github.com/docker/cli/cli/config/credentials/file_store.go b/tools/vendor/github.com/docker/cli/cli/config/credentials/file_store.go index ea30fc300..3b8955994 100644 --- a/tools/vendor/github.com/docker/cli/cli/config/credentials/file_store.go +++ b/tools/vendor/github.com/docker/cli/cli/config/credentials/file_store.go @@ -1,6 +1,8 @@ package credentials import ( + "net" + "net/url" "strings" "github.com/docker/cli/cli/config/types" @@ -68,14 +70,17 @@ func (c *fileStore) IsFileStore() bool { // ConvertToHostname converts a registry url which has http|https prepended // to just an hostname. // Copied from github.com/docker/docker/registry.ConvertToHostname to reduce dependencies. -func ConvertToHostname(url string) string { - stripped := url - if strings.HasPrefix(url, "http://") { - stripped = strings.TrimPrefix(url, "http://") - } else if strings.HasPrefix(url, "https://") { - stripped = strings.TrimPrefix(url, "https://") +func ConvertToHostname(maybeURL string) string { + stripped := maybeURL + if strings.Contains(stripped, "://") { + u, err := url.Parse(stripped) + if err == nil && u.Hostname() != "" { + if u.Port() == "" { + return u.Hostname() + } + return net.JoinHostPort(u.Hostname(), u.Port()) + } } - hostName, _, _ := strings.Cut(stripped, "/") return hostName } diff --git a/tools/vendor/github.com/docker/docker/AUTHORS b/tools/vendor/github.com/docker/docker/AUTHORS index 48d04f9a9..5f93eeb4e 100644 --- a/tools/vendor/github.com/docker/docker/AUTHORS +++ b/tools/vendor/github.com/docker/docker/AUTHORS @@ -10,6 +10,7 @@ Aaron Huslage Aaron L. Xu Aaron Lehmann Aaron Welch +Aaron Yoshitake Abel Muiño Abhijeet Kasurde Abhinandan Prativadi @@ -62,6 +63,7 @@ alambike Alan Hoyle Alan Scherger Alan Thompson +Alano Terblanche Albert Callarisa Albert Zhang Albin Kerouanton @@ -141,6 +143,7 @@ Andreas Tiefenthaler Andrei Gherzan Andrei Ushakov Andrei Vagin +Andrew Baxter <423qpsxzhh8k3h@s.rendaw.me> Andrew C. Bodine Andrew Clay Shafer Andrew Duckworth @@ -193,6 +196,7 @@ Anton Löfgren Anton Nikitin Anton Polonskiy Anton Tiurin +Antonio Aguilar Antonio Murdaca Antonis Kalipetis Antony Messerli @@ -221,7 +225,6 @@ Avi Das Avi Kivity Avi Miller Avi Vaid -ayoshitake Azat Khuyiyakhmetov Bao Yonglei Bardia Keyoumarsi @@ -316,6 +319,7 @@ Burke Libbey Byung Kang Caleb Spare Calen Pennington +Calvin Liu Cameron Boehmer Cameron Sparr Cameron Spear @@ -362,6 +366,7 @@ Chen Qiu Cheng-mean Liu Chengfei Shang Chengguang Xu +Chentianze Chenyang Yan chenyuzhu Chetan Birajdar @@ -409,6 +414,7 @@ Christopher Crone Christopher Currie Christopher Jones Christopher Latham +Christopher Petito Christopher Rigor Christy Norman Chun Chen @@ -669,6 +675,7 @@ Erik Hollensbe Erik Inge Bolsø Erik Kristensen Erik Sipsma +Erik Sjölund Erik St. Martin Erik Weathers Erno Hopearuoho @@ -731,6 +738,7 @@ Feroz Salam Ferran Rodenas Filipe Brandenburger Filipe Oliveira +Filipe Pina Flavio Castelli Flavio Crisciani Florian @@ -775,6 +783,7 @@ Gabriel L. Somlo Gabriel Linder Gabriel Monroy Gabriel Nicolas Avellaneda +Gabriel Tomitsuka Gaetan de Villele Galen Sampson Gang Qiao @@ -790,6 +799,7 @@ Geoff Levand Geoffrey Bachelet Geon Kim George Kontridze +George Ma George MacRorie George Xie Georgi Hristozov @@ -875,6 +885,8 @@ Hsing-Yu (David) Chen hsinko <21551195@zju.edu.cn> Hu Keping Hu Tao +Huajin Tong +huang-jl <1046678590@qq.com> HuanHuan Ye Huanzhong Zhang Huayi Zhang @@ -909,6 +921,7 @@ Illo Abdulrahim Ilya Dmitrichenko Ilya Gusev Ilya Khlopotov +imalasong <2879499479@qq.com> imre Fitos inglesp Ingo Gottwald @@ -926,6 +939,7 @@ J Bruni J. Nunn Jack Danger Canty Jack Laxson +Jack Walker <90711509+j2walker@users.noreply.github.com> Jacob Atzen Jacob Edelman Jacob Tomlinson @@ -969,6 +983,7 @@ Jannick Fahlbusch Januar Wayong Jared Biel Jared Hocutt +Jaroslav Jindrak Jaroslaw Zabiello Jasmine Hegman Jason A. Donenfeld @@ -984,6 +999,7 @@ Jason Shepherd Jason Smith Jason Sommer Jason Stangroome +Jasper Siepkes Javier Bassi jaxgeller Jay @@ -1012,6 +1028,7 @@ Jeffrey Bolle Jeffrey Morgan Jeffrey van Gogh Jenny Gebske +Jeongseok Kang Jeremy Chambers Jeremy Grosser Jeremy Huntwork @@ -1029,6 +1046,7 @@ Jezeniel Zapanta Jhon Honce Ji.Zhilong Jian Liao +Jian Zeng Jian Zhang Jiang Jinyang Jianyong Wu @@ -1093,6 +1111,7 @@ Jon Johnson Jon Surrell Jon Wedaman Jonas Dohse +Jonas Geiler Jonas Heinrich Jonas Pfenniger Jonathan A. Schweder @@ -1260,6 +1279,7 @@ Lakshan Perera Lalatendu Mohanty Lance Chen Lance Kinley +Lars Andringa Lars Butler Lars Kellogg-Stedman Lars R. Damerow @@ -1666,6 +1686,7 @@ Patrick Böänziger Patrick Devine Patrick Haas Patrick Hemmer +Patrick St. laurent Patrick Stapleton Patrik Cyvoct pattichen @@ -1871,6 +1892,7 @@ Royce Remer Rozhnov Alexandr Rudolph Gottesheim Rui Cao +Rui JingAn Rui Lopes Ruilin Li Runshen Zhu @@ -1967,6 +1989,7 @@ Sergey Evstifeev Sergii Kabashniuk Sergio Lopez Serhat Gülçiçek +Serhii Nakon SeungUkLee Sevki Hasirci Shane Canon @@ -2176,6 +2199,7 @@ Tomek Mańko Tommaso Visconti Tomoya Tabuchi Tomáš Hrčka +Tomáš Virtus tonic Tonny Xu Tony Abboud @@ -2220,6 +2244,7 @@ Victor I. Wood Victor Lyuboslavsky Victor Marmol Victor Palma +Victor Toni Victor Vieux Victoria Bialas Vijaya Kumar K @@ -2253,6 +2278,7 @@ VladimirAus Vladislav Kolesnikov Vlastimil Zeman Vojtech Vitek (V-Teq) +voloder <110066198+voloder@users.noreply.github.com> Walter Leibbrandt Walter Stanish Wang Chao @@ -2270,6 +2296,7 @@ Wassim Dhif Wataru Ishida Wayne Chang Wayne Song +weebney Weerasak Chongnguluam Wei Fu Wei Wu diff --git a/tools/vendor/github.com/docker/docker/api/types/registry/authconfig.go b/tools/vendor/github.com/docker/docker/api/types/registry/authconfig.go index 97a924e37..8e383f6e6 100644 --- a/tools/vendor/github.com/docker/docker/api/types/registry/authconfig.go +++ b/tools/vendor/github.com/docker/docker/api/types/registry/authconfig.go @@ -34,10 +34,9 @@ type AuthConfig struct { } // EncodeAuthConfig serializes the auth configuration as a base64url encoded -// RFC4648, section 5) JSON string for sending through the X-Registry-Auth header. +// ([RFC4648, section 5]) JSON string for sending through the X-Registry-Auth header. // -// For details on base64url encoding, see: -// - RFC4648, section 5: https://tools.ietf.org/html/rfc4648#section-5 +// [RFC4648, section 5]: https://tools.ietf.org/html/rfc4648#section-5 func EncodeAuthConfig(authConfig AuthConfig) (string, error) { buf, err := json.Marshal(authConfig) if err != nil { @@ -46,15 +45,14 @@ func EncodeAuthConfig(authConfig AuthConfig) (string, error) { return base64.URLEncoding.EncodeToString(buf), nil } -// DecodeAuthConfig decodes base64url encoded (RFC4648, section 5) JSON +// DecodeAuthConfig decodes base64url encoded ([RFC4648, section 5]) JSON // authentication information as sent through the X-Registry-Auth header. // -// This function always returns an AuthConfig, even if an error occurs. It is up +// This function always returns an [AuthConfig], even if an error occurs. It is up // to the caller to decide if authentication is required, and if the error can // be ignored. // -// For details on base64url encoding, see: -// - RFC4648, section 5: https://tools.ietf.org/html/rfc4648#section-5 +// [RFC4648, section 5]: https://tools.ietf.org/html/rfc4648#section-5 func DecodeAuthConfig(authEncoded string) (*AuthConfig, error) { if authEncoded == "" { return &AuthConfig{}, nil @@ -69,7 +67,7 @@ func DecodeAuthConfig(authEncoded string) (*AuthConfig, error) { // clients and API versions. Current clients and API versions expect authentication // to be provided through the X-Registry-Auth header. // -// Like DecodeAuthConfig, this function always returns an AuthConfig, even if an +// Like [DecodeAuthConfig], this function always returns an [AuthConfig], even if an // error occurs. It is up to the caller to decide if authentication is required, // and if the error can be ignored. func DecodeAuthConfigBody(rdr io.ReadCloser) (*AuthConfig, error) { diff --git a/tools/vendor/github.com/docker/docker/api/types/registry/registry.go b/tools/vendor/github.com/docker/docker/api/types/registry/registry.go index 05cb31075..75ee07b15 100644 --- a/tools/vendor/github.com/docker/docker/api/types/registry/registry.go +++ b/tools/vendor/github.com/docker/docker/api/types/registry/registry.go @@ -84,32 +84,6 @@ type IndexInfo struct { Official bool } -// SearchResult describes a search result returned from a registry -type SearchResult struct { - // StarCount indicates the number of stars this repository has - StarCount int `json:"star_count"` - // IsOfficial is true if the result is from an official repository. - IsOfficial bool `json:"is_official"` - // Name is the name of the repository - Name string `json:"name"` - // IsAutomated indicates whether the result is automated. - // - // Deprecated: the "is_automated" field is deprecated and will always be "false" in the future. - IsAutomated bool `json:"is_automated"` - // Description is a textual description of the repository - Description string `json:"description"` -} - -// SearchResults lists a collection search results returned from a registry -type SearchResults struct { - // Query contains the query string that generated the search results - Query string `json:"query"` - // NumResults indicates the number of results the query returned - NumResults int `json:"num_results"` - // Results is a slice containing the actual results for the search - Results []SearchResult `json:"results"` -} - // DistributionInspect describes the result obtained from contacting the // registry to retrieve image metadata type DistributionInspect struct { diff --git a/tools/vendor/github.com/docker/docker/api/types/registry/search.go b/tools/vendor/github.com/docker/docker/api/types/registry/search.go new file mode 100644 index 000000000..a0a1eec54 --- /dev/null +++ b/tools/vendor/github.com/docker/docker/api/types/registry/search.go @@ -0,0 +1,47 @@ +package registry + +import ( + "context" + + "github.com/docker/docker/api/types/filters" +) + +// SearchOptions holds parameters to search images with. +type SearchOptions struct { + RegistryAuth string + + // PrivilegeFunc is a [types.RequestPrivilegeFunc] the client can + // supply to retry operations after getting an authorization error. + // + // It must return the registry authentication header value in base64 + // format, or an error if the privilege request fails. + PrivilegeFunc func(context.Context) (string, error) + Filters filters.Args + Limit int +} + +// SearchResult describes a search result returned from a registry +type SearchResult struct { + // StarCount indicates the number of stars this repository has + StarCount int `json:"star_count"` + // IsOfficial is true if the result is from an official repository. + IsOfficial bool `json:"is_official"` + // Name is the name of the repository + Name string `json:"name"` + // IsAutomated indicates whether the result is automated. + // + // Deprecated: the "is_automated" field is deprecated and will always be "false". + IsAutomated bool `json:"is_automated"` + // Description is a textual description of the repository + Description string `json:"description"` +} + +// SearchResults lists a collection search results returned from a registry +type SearchResults struct { + // Query contains the query string that generated the search results + Query string `json:"query"` + // NumResults indicates the number of results the query returned + NumResults int `json:"num_results"` + // Results is a slice containing the actual results for the search + Results []SearchResult `json:"results"` +} diff --git a/tools/vendor/github.com/docker/docker/api/types/versions/README.md b/tools/vendor/github.com/docker/docker/api/types/versions/README.md deleted file mode 100644 index 1ef911edb..000000000 --- a/tools/vendor/github.com/docker/docker/api/types/versions/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Legacy API type versions - -This package includes types for legacy API versions. The stable version of the API types live in `api/types/*.go`. - -Consider moving a type here when you need to keep backwards compatibility in the API. This legacy types are organized by the latest API version they appear in. For instance, types in the `v1p19` package are valid for API versions below or equal `1.19`. Types in the `v1p20` package are valid for the API version `1.20`, since the versions below that will use the legacy types in `v1p19`. - -## Package name conventions - -The package name convention is to use `v` as a prefix for the version number and `p`(patch) as a separator. We use this nomenclature due to a few restrictions in the Go package name convention: - -1. We cannot use `.` because it's interpreted by the language, think of `v1.20.CallFunction`. -2. We cannot use `_` because golint complains about it. The code is actually valid, but it looks probably more weird: `v1_20.CallFunction`. - -For instance, if you want to modify a type that was available in the version `1.21` of the API but it will have different fields in the version `1.22`, you want to create a new package under `api/types/versions/v1p21`. diff --git a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir.go b/tools/vendor/github.com/docker/docker/pkg/homedir/homedir.go deleted file mode 100644 index 590683206..000000000 --- a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir.go +++ /dev/null @@ -1,44 +0,0 @@ -package homedir - -import ( - "os" - "os/user" - "runtime" -) - -// Key returns the env var name for the user's home dir based on -// the platform being run on. -// -// Deprecated: this function is no longer used, and will be removed in the next release. -func Key() string { - return envKeyName -} - -// Get returns the home directory of the current user with the help of -// environment variables depending on the target operating system. -// Returned path should be used with "path/filepath" to form new paths. -// -// On non-Windows platforms, it falls back to nss lookups, if the home -// directory cannot be obtained from environment-variables. -// -// If linking statically with cgo enabled against glibc, ensure the -// osusergo build tag is used. -// -// If needing to do nss lookups, do not disable cgo or set osusergo. -func Get() string { - home, _ := os.UserHomeDir() - if home == "" && runtime.GOOS != "windows" { - if u, err := user.Current(); err == nil { - return u.HomeDir - } - } - return home -} - -// GetShortcutString returns the string that is shortcut to user's home directory -// in the native shell of the platform running on. -// -// Deprecated: this function is no longer used, and will be removed in the next release. -func GetShortcutString() string { - return homeShortCut -} diff --git a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go b/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go deleted file mode 100644 index ded1c7c8c..000000000 --- a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go +++ /dev/null @@ -1,105 +0,0 @@ -package homedir // import "github.com/docker/docker/pkg/homedir" - -import ( - "errors" - "os" - "path/filepath" - "strings" -) - -// GetRuntimeDir returns XDG_RUNTIME_DIR. -// XDG_RUNTIME_DIR is typically configured via pam_systemd. -// GetRuntimeDir returns non-nil error if XDG_RUNTIME_DIR is not set. -// -// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html -func GetRuntimeDir() (string, error) { - if xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR"); xdgRuntimeDir != "" { - return xdgRuntimeDir, nil - } - return "", errors.New("could not get XDG_RUNTIME_DIR") -} - -// StickRuntimeDirContents sets the sticky bit on files that are under -// XDG_RUNTIME_DIR, so that the files won't be periodically removed by the system. -// -// StickyRuntimeDir returns slice of sticked files. -// StickyRuntimeDir returns nil error if XDG_RUNTIME_DIR is not set. -// -// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html -func StickRuntimeDirContents(files []string) ([]string, error) { - runtimeDir, err := GetRuntimeDir() - if err != nil { - // ignore error if runtimeDir is empty - return nil, nil - } - runtimeDir, err = filepath.Abs(runtimeDir) - if err != nil { - return nil, err - } - var sticked []string - for _, f := range files { - f, err = filepath.Abs(f) - if err != nil { - return sticked, err - } - if strings.HasPrefix(f, runtimeDir+"/") { - if err = stick(f); err != nil { - return sticked, err - } - sticked = append(sticked, f) - } - } - return sticked, nil -} - -func stick(f string) error { - st, err := os.Stat(f) - if err != nil { - return err - } - m := st.Mode() - m |= os.ModeSticky - return os.Chmod(f, m) -} - -// GetDataHome returns XDG_DATA_HOME. -// GetDataHome returns $HOME/.local/share and nil error if XDG_DATA_HOME is not set. -// If HOME and XDG_DATA_HOME are not set, getpwent(3) is consulted to determine the users home directory. -// -// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html -func GetDataHome() (string, error) { - if xdgDataHome := os.Getenv("XDG_DATA_HOME"); xdgDataHome != "" { - return xdgDataHome, nil - } - home := Get() - if home == "" { - return "", errors.New("could not get either XDG_DATA_HOME or HOME") - } - return filepath.Join(home, ".local", "share"), nil -} - -// GetConfigHome returns XDG_CONFIG_HOME. -// GetConfigHome returns $HOME/.config and nil error if XDG_CONFIG_HOME is not set. -// If HOME and XDG_CONFIG_HOME are not set, getpwent(3) is consulted to determine the users home directory. -// -// See also https://standards.freedesktop.org/basedir-spec/latest/ar01s03.html -func GetConfigHome() (string, error) { - if xdgConfigHome := os.Getenv("XDG_CONFIG_HOME"); xdgConfigHome != "" { - return xdgConfigHome, nil - } - home := Get() - if home == "" { - return "", errors.New("could not get either XDG_CONFIG_HOME or HOME") - } - return filepath.Join(home, ".config"), nil -} - -// GetLibHome returns $HOME/.local/lib -// If HOME is not set, getpwent(3) is consulted to determine the users home directory. -func GetLibHome() (string, error) { - home := Get() - if home == "" { - return "", errors.New("could not get HOME") - } - return filepath.Join(home, ".local/lib"), nil -} diff --git a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go b/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go deleted file mode 100644 index 4eeb26b5d..000000000 --- a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build !linux - -package homedir // import "github.com/docker/docker/pkg/homedir" - -import ( - "errors" -) - -// GetRuntimeDir is unsupported on non-linux system. -func GetRuntimeDir() (string, error) { - return "", errors.New("homedir.GetRuntimeDir() is not supported on this system") -} - -// StickRuntimeDirContents is unsupported on non-linux system. -func StickRuntimeDirContents(files []string) ([]string, error) { - return nil, errors.New("homedir.StickRuntimeDirContents() is not supported on this system") -} - -// GetDataHome is unsupported on non-linux system. -func GetDataHome() (string, error) { - return "", errors.New("homedir.GetDataHome() is not supported on this system") -} - -// GetConfigHome is unsupported on non-linux system. -func GetConfigHome() (string, error) { - return "", errors.New("homedir.GetConfigHome() is not supported on this system") -} - -// GetLibHome is unsupported on non-linux system. -func GetLibHome() (string, error) { - return "", errors.New("homedir.GetLibHome() is not supported on this system") -} diff --git a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go b/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go deleted file mode 100644 index feae4d736..000000000 --- a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build !windows - -package homedir // import "github.com/docker/docker/pkg/homedir" - -const ( - envKeyName = "HOME" - homeShortCut = "~" -) diff --git a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go b/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go deleted file mode 100644 index 37f4ee670..000000000 --- a/tools/vendor/github.com/docker/docker/pkg/homedir/homedir_windows.go +++ /dev/null @@ -1,6 +0,0 @@ -package homedir // import "github.com/docker/docker/pkg/homedir" - -const ( - envKeyName = "USERPROFILE" - homeShortCut = "%USERPROFILE%" // be careful while using in format functions -) diff --git a/tools/vendor/github.com/docker/docker/pkg/ioutils/fswriters.go b/tools/vendor/github.com/docker/docker/pkg/ioutils/fswriters.go index 82671d8cd..05da97b0e 100644 --- a/tools/vendor/github.com/docker/docker/pkg/ioutils/fswriters.go +++ b/tools/vendor/github.com/docker/docker/pkg/ioutils/fswriters.go @@ -9,6 +9,7 @@ import ( // NewAtomicFileWriter returns WriteCloser so that writing to it writes to a // temporary file and closing it atomically changes the temporary file to // destination path. Writing and closing concurrently is not allowed. +// NOTE: umask is not considered for the file's permissions. func NewAtomicFileWriter(filename string, perm os.FileMode) (io.WriteCloser, error) { f, err := os.CreateTemp(filepath.Dir(filename), ".tmp-"+filepath.Base(filename)) if err != nil { @@ -26,7 +27,8 @@ func NewAtomicFileWriter(filename string, perm os.FileMode) (io.WriteCloser, err }, nil } -// AtomicWriteFile atomically writes data to a file named by filename. +// AtomicWriteFile atomically writes data to a file named by filename and with the specified permission bits. +// NOTE: umask is not considered for the file's permissions. func AtomicWriteFile(filename string, data []byte, perm os.FileMode) error { f, err := NewAtomicFileWriter(filename, perm) if err != nil { diff --git a/tools/vendor/github.com/docker/docker/registry/auth.go b/tools/vendor/github.com/docker/docker/registry/auth.go index f685892c1..905ccf5f5 100644 --- a/tools/vendor/github.com/docker/docker/registry/auth.go +++ b/tools/vendor/github.com/docker/docker/registry/auth.go @@ -108,16 +108,18 @@ func v2AuthHTTPClient(endpoint *url.URL, authTransport http.RoundTripper, modifi return nil, err } - tokenHandlerOptions := auth.TokenHandlerOptions{ - Transport: authTransport, - Credentials: creds, - OfflineAccess: true, - ClientID: AuthClientID, - Scopes: scopes, - } - tokenHandler := auth.NewTokenHandlerWithOptions(tokenHandlerOptions) - basicHandler := auth.NewBasicHandler(creds) - modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, tokenHandler, basicHandler)) + authHandlers := []auth.AuthenticationHandler{ + auth.NewTokenHandlerWithOptions(auth.TokenHandlerOptions{ + Transport: authTransport, + Credentials: creds, + OfflineAccess: true, + ClientID: AuthClientID, + Scopes: scopes, + }), + auth.NewBasicHandler(creds), + } + + modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, authHandlers...)) return &http.Client{ Transport: transport.NewTransport(authTransport, modifiers...), diff --git a/tools/vendor/github.com/docker/docker/registry/search.go b/tools/vendor/github.com/docker/docker/registry/search.go index 75a544410..4ce90f55d 100644 --- a/tools/vendor/github.com/docker/docker/registry/search.go +++ b/tools/vendor/github.com/docker/docker/registry/search.go @@ -27,11 +27,16 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s return nil, err } - // TODO(thaJeztah): the "is-automated" field is deprecated; reset the field for the next release (v26.0.0). Return early when using "is-automated=true", and ignore "is-automated=false". isAutomated, err := searchFilters.GetBoolOrDefault("is-automated", false) if err != nil { return nil, err } + + // "is-automated" is deprecated and filtering for `true` will yield no results. + if isAutomated { + return []registry.SearchResult{}, nil + } + isOfficial, err := searchFilters.GetBoolOrDefault("is-official", false) if err != nil { return nil, err @@ -51,7 +56,6 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s } } - // TODO(thaJeztah): the "is-automated" field is deprecated. Reset the field for the next release (v26.0.0) if any "true" values are present. unfilteredResult, err := s.searchUnfiltered(ctx, term, limit, authConfig, headers) if err != nil { return nil, err @@ -59,11 +63,6 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s filteredResults := []registry.SearchResult{} for _, result := range unfilteredResult.Results { - if searchFilters.Contains("is-automated") { - if isAutomated != result.IsAutomated { //nolint:staticcheck // ignore SA1019 for old API versions. - continue - } - } if searchFilters.Contains("is-official") { if isOfficial != result.IsOfficial { continue @@ -74,6 +73,10 @@ func (s *Service) Search(ctx context.Context, searchFilters filters.Args, term s continue } } + // "is-automated" is deprecated and the value in Docker Hub search + // results is untrustworthy. Force it to false so as to not mislead our + // clients. + result.IsAutomated = false //nolint:staticcheck // ignore SA1019 (field is deprecated) filteredResults = append(filteredResults, result) } @@ -109,16 +112,12 @@ func (s *Service) searchUnfiltered(ctx context.Context, term string, limit int, var client *http.Client if authConfig != nil && authConfig.IdentityToken != "" && authConfig.Username != "" { creds := NewStaticCredentialStore(authConfig) - scopes := []auth.Scope{ - auth.RegistryScope{ - Name: "catalog", - Actions: []string{"search"}, - }, - } // TODO(thaJeztah); is there a reason not to include other headers here? (originally added in 19d48f0b8ba59eea9f2cac4ad1c7977712a6b7ac) modifiers := Headers(headers.Get("User-Agent"), nil) - v2Client, err := v2AuthHTTPClient(endpoint.URL, endpoint.client.Transport, modifiers, creds, scopes) + v2Client, err := v2AuthHTTPClient(endpoint.URL, endpoint.client.Transport, modifiers, creds, []auth.Scope{ + auth.RegistryScope{Name: "catalog", Actions: []string{"search"}}, + }) if err != nil { return nil, err } diff --git a/tools/vendor/github.com/opencontainers/runc/libcontainer/user/user.go b/tools/vendor/github.com/opencontainers/runc/libcontainer/user/user.go index 984466d1a..198c49367 100644 --- a/tools/vendor/github.com/opencontainers/runc/libcontainer/user/user.go +++ b/tools/vendor/github.com/opencontainers/runc/libcontainer/user/user.go @@ -197,7 +197,6 @@ func ParseGroupFilter(r io.Reader, filter func(Group) bool) ([]Group, error) { for { var line []byte line, isPrefix, err = rd.ReadLine() - if err != nil { // We should return no error if EOF is reached // without a match. diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/LICENSE b/tools/vendor/github.com/operator-framework/helm-operator-plugins/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/helm/v1/chartutil/chart.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/helm/v1/chartutil/chart.go deleted file mode 100644 index 5587c2175..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/helm/v1/chartutil/chart.go +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright 2018 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package chartutil - -import ( - "bytes" - "fmt" - "os" - "path/filepath" - - log "github.com/sirupsen/logrus" - "helm.sh/helm/v3/pkg/chart" - "helm.sh/helm/v3/pkg/chart/loader" - "helm.sh/helm/v3/pkg/chartutil" - "helm.sh/helm/v3/pkg/cli" - "helm.sh/helm/v3/pkg/downloader" - "helm.sh/helm/v3/pkg/getter" - "helm.sh/helm/v3/pkg/repo" -) - -const ( - // HelmChartsDir is the relative directory within a SDK project where Helm charts are stored. - HelmChartsDir = "helm-charts" -) - -// Options is used to configure how a Helm chart is scaffolded -// for a new Helm operator project. -type Options struct { - // Chart is a chart reference for a local or remote chart. - Chart string - - // Repo is a URL to a custom chart repository. - Repo string - - // Version is the version of the chart to fetch. - Version string -} - -// NewChart creates a new helm chart for the project from helm's default template. -// It returns a chart.Chart that references the newly created chart or an error. -func NewChart(name string) (*chart.Chart, error) { - tmpDir, err := os.MkdirTemp("", "osdk-helm-chart") - if err != nil { - return nil, err - } - defer func() { - if err := os.RemoveAll(tmpDir); err != nil { - log.Errorf("Failed to remove temporary directory %s: %v", tmpDir, err) - } - }() - - // Create a new chart - chartPath, err := chartutil.Create(name, tmpDir) - if err != nil { - return nil, err - } - - return loader.Load(chartPath) -} - -// LoadChart creates a new helm chart for the project based on the passed opts. -// It returns a chart.Chart that references the newly created chart or an error. -// -// If opts.Chart is a local file, it verifies that it is a valid helm chart -// archive and returns its chart.Chart representation. -// -// If opts.Chart is a local directory, it verifies that it is a valid helm chart -// directory and returns its chart.Chart representation. -// -// For any other value of opts.Chart, it attempts to fetch the helm chart from a -// remote repository. -// -// If opts.Repo is not specified, the following chart reference formats are supported: -// -// - /: Fetch the helm chart named chartName from the helm -// chart repository named repoName, as specified in the -// $HELM_HOME/repositories/repositories.yaml file. -// -// - : Fetch the helm chart archive at the specified URL. -// -// If opts.Repo is specified, only one chart reference format is supported: -// -// - : Fetch the helm chart named chartName in the helm chart repository -// specified by opts.Repo -// -// If opts.Version is not set, it will fetch the latest available version of the helm -// chart. Otherwise, it will fetch the specified version. -// opts.Version is not used when opts.Chart itself refers to a specific version, for -// example when it is a local path or a URL. -func LoadChart(opts Options) (*chart.Chart, error) { - tmpDir, err := os.MkdirTemp("", "osdk-helm-chart") - if err != nil { - return nil, err - } - defer func() { - if err := os.RemoveAll(tmpDir); err != nil { - log.Errorf("Failed to remove temporary directory %s: %v", tmpDir, err) - } - }() - - chartPath := opts.Chart - - // If it is a remote chart, download it to a temp dir first - if _, err := os.Stat(opts.Chart); err != nil { - chartPath, err = downloadChart(tmpDir, opts) - if err != nil { - return nil, err - } - } - - return loader.Load(chartPath) -} - -func downloadChart(destDir string, opts Options) (string, error) { - settings := cli.New() - getters := getter.All(settings) - c := downloader.ChartDownloader{ - Out: os.Stderr, - Getters: getters, - RepositoryConfig: settings.RepositoryConfig, - RepositoryCache: settings.RepositoryCache, - } - - if opts.Repo != "" { - chartURL, err := repo.FindChartInRepoURL(opts.Repo, opts.Chart, opts.Version, "", "", "", getters) - if err != nil { - return "", err - } - opts.Chart = chartURL - } - - chartArchive, _, err := c.DownloadTo(opts.Chart, opts.Version, destDir) - if err != nil { - return "", err - } - - return chartArchive, nil -} - -// ScaffoldChart scaffolds the provided chart.Chart to a known directory relative to projectDir -// -// # It also fetches the dependencies and reloads the chart.Chart -// -// It returns the reloaded chart, the relative path, or an error. -func ScaffoldChart(chrt *chart.Chart, projectDir string) (*chart.Chart, string, error) { - chartsPath := filepath.Join(projectDir, HelmChartsDir) - - // Save it into our project's helm-charts directory. - if err := chartutil.SaveDir(chrt, chartsPath); err != nil { - return chrt, "", err - } - - chartPath := filepath.Join(chartsPath, chrt.Name()) - - // Fetch dependencies - if err := fetchChartDependencies(chartPath); err != nil { - return chrt, "", fmt.Errorf("failed to fetch chart dependencies: %w", err) - } - - // Reload chart in case dependencies changed - chrt, err := loader.Load(chartPath) - if err != nil { - return chrt, "", fmt.Errorf("failed to reload chart: %w", err) - } - - return chrt, filepath.Join(HelmChartsDir, chrt.Name()), nil -} - -func fetchChartDependencies(chartPath string) error { - settings := cli.New() - getters := getter.All(settings) - - out := &bytes.Buffer{} - man := &downloader.Manager{ - Out: out, - ChartPath: chartPath, - Getters: getters, - RepositoryConfig: settings.RepositoryConfig, - RepositoryCache: settings.RepositoryCache, - } - if err := man.Build(); err != nil { - fmt.Println(out.String()) - return err - } - return nil -} diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/init.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/init.go deleted file mode 100644 index 2d2dbc794..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/init.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package v1alpha - -import ( - "fmt" - "path/filepath" - - "github.com/spf13/pflag" - "sigs.k8s.io/kubebuilder/v3/pkg/config" - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - "sigs.k8s.io/kubebuilder/v3/pkg/plugin" - "sigs.k8s.io/kubebuilder/v3/pkg/plugin/util" - "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang" - - "github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds" - projutil "github.com/operator-framework/helm-operator-plugins/pkg/plugins/util" -) - -type initSubcommand struct { - config config.Config - - // For help text - commandName string - - // boilerplate options - license string - owner string - - // go config options - repo string -} - -var _ plugin.InitSubcommand = &initSubcommand{} - -// UpdateMetadata defines plugin context -func (p *initSubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdMeta *plugin.SubcommandMetadata) { - subcmdMeta.Description = `Initialize a new project including the following files: - - a "go.mod" with project dependencies - - a "PROJECT" file that stores project configuration - - a "Makefile" with several useful make targets for the project - - several YAML files for project deployment under the "config" directory - - a "main.go" file that creates the manager that will run the project controllers - ` - subcmdMeta.Examples = fmt.Sprintf(` # Initialize a new project with your domain and name in copyright - $ %[1]s init --plugins=%[2]s --owner "Your Name" - - # Initialize a new project defining a specific project version - %[1]s init --plugins=%[2]s --project-version 3 -`, cliMeta.CommandName, pluginKey) - - p.commandName = cliMeta.CommandName -} - -func (p *initSubcommand) BindFlags(fs *pflag.FlagSet) { - fs.SortFlags = false - - // project args - fs.StringVar(&p.repo, "repo", "", "name to use for go module (e.g., github.com/user/repo), "+ - "defaults to the go package of the current working directory.") - - // boilerplate args - fs.StringVar(&p.license, "license", "apache2", - "license to use to boilerplate, may be one of 'apache2', 'none'") - fs.StringVar(&p.owner, "owner", "", "owner to add to the copyright") -} - -func (p *initSubcommand) InjectConfig(c config.Config) error { - p.config = c - - // Try to guess repository if flag is not set - if p.repo == "" { - repoPath, err := golang.FindCurrentRepo() - if err != nil { - return fmt.Errorf("error finding current repository: %v", err) - } - p.repo = repoPath - } - - if err := p.config.SetRepository(p.repo); err != nil { - return err - } - return nil -} - -// TODO: -// 1. Pre-scaffold check to verify if the right Go version and directory is used. -// This needs to be added from Kubebuilder. -// 2. Verify if additional customizations are needed in config files as done in -// helm operator. -func (p *initSubcommand) Scaffold(fs machinery.Filesystem) error { - if err := addInitCustomizations(p.config.GetProjectName()); err != nil { - return fmt.Errorf("error updating init manifests: %q", err) - } - - scaffolder := scaffolds.NewInitScaffolder(p.config, p.license, p.owner) - scaffolder.InjectFS(fs) - return scaffolder.Scaffold() -} - -func (p *initSubcommand) PostScaffold() error { - err := util.RunCmd("Update dependencies", "go", "mod", "tidy") - if err != nil { - return err - } - - return nil -} - -// addInitCustomizations will perform the required customizations for this plugin on the common base -func addInitCustomizations(projectName string) error { - managerFile := filepath.Join("config", "manager", "manager.yaml") - - // todo: we ought to use afero instead. Replace this methods to insert/update - // by https://github.com/kubernetes-sigs/kubebuilder/pull/2119 - - // Add leader election arg in config/manager/manager.yaml and in config/default/manager_auth_proxy_patch.yaml - err := util.InsertCode(managerFile, - "--leader-elect", - fmt.Sprintf("\n - --leader-election-id=%s", projectName)) - if err != nil { - return err - } - err = util.InsertCode(filepath.Join("config", "default", "manager_auth_proxy_patch.yaml"), - "- \"--leader-elect\"", - fmt.Sprintf("\n - \"--leader-election-id=%s\"", projectName)) - if err != nil { - return err - } - - // Remove the call to the command as manager. Helm has not been exposing this entrypoint - // todo: provide the manager entrypoint for helm and then remove it - const command = `command: - - /manager - ` - err = projutil.ReplaceInFile(managerFile, command, "") - if err != nil { - return err - } - - return nil -} diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/plugin.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/plugin.go deleted file mode 100644 index 9b2e4dc7d..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/plugin.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2020 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package v1alpha - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/config" - cfgv3 "sigs.k8s.io/kubebuilder/v3/pkg/config/v3" - "sigs.k8s.io/kubebuilder/v3/pkg/model/stage" - "sigs.k8s.io/kubebuilder/v3/pkg/plugin" - - "github.com/operator-framework/helm-operator-plugins/pkg/plugins/util" -) - -const pluginName = "hybrid.helm" + util.DefaultNameQualifier - -var ( - pluginVersion = plugin.Version{Number: 1, Stage: stage.Alpha} - supportedProjectVersions = []config.Version{cfgv3.Version} - pluginKey = plugin.KeyFor(Plugin{}) -) - -var ( - _ plugin.Plugin = Plugin{} - _ plugin.Init = Plugin{} -) - -type Plugin struct { - initSubcommand -} - -func (Plugin) Name() string { return pluginName } -func (Plugin) Version() plugin.Version { return pluginVersion } -func (Plugin) SupportedProjectVersions() []config.Version { return supportedProjectVersions } -func (p Plugin) GetInitSubcommand() plugin.InitSubcommand { return &p.initSubcommand } diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/init.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/init.go deleted file mode 100644 index 2ab9fcc94..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/init.go +++ /dev/null @@ -1,158 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. -Modifications copyright 2020 The Operator-SDK Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package scaffolds - -import ( - "fmt" - "os" - - "github.com/spf13/afero" - "sigs.k8s.io/kubebuilder/v3/pkg/config" - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - "sigs.k8s.io/kubebuilder/v3/pkg/plugin/util" - "sigs.k8s.io/kubebuilder/v3/pkg/plugins" - - "github.com/operator-framework/helm-operator-plugins/pkg/plugins/helm/v1/chartutil" - "github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates" - "github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/hack" - "github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/rbac" - utils "github.com/operator-framework/helm-operator-plugins/pkg/plugins/util" - - kustomizev2 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/common/kustomize/v2" - golangv4 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v4/scaffolds" -) - -const ( - imageName = "controller:latest" - - // TODO: This is a placeholder for now. This would probably be the operator-sdk version - hybridOperatorVersion = "0.2.2" - - // helmPluginVersion is the operator-framework/helm-operator-plugin version to be used in the project - helmPluginVersion = "v0.2.2" -) - -var _ plugins.Scaffolder = &initScaffolder{} - -type initScaffolder struct { - // fs is the filesystem that will be used by the scaffolder - fs machinery.Filesystem - - config config.Config - boilerplatePath string - license string - owner string -} - -// NewInitScaffolder returns a new plugins.Scaffolder for project initialization operations -func NewInitScaffolder(config config.Config, license, owner string) plugins.Scaffolder { - return &initScaffolder{ - config: config, - boilerplatePath: hack.DefaultBoilerplatePath, - license: license, - owner: owner, - } -} - -// InjectFS implements Scaffolder -func (s *initScaffolder) InjectFS(fs machinery.Filesystem) { - s.fs = fs -} - -// Scaffold implements scaffolder -func (s *initScaffolder) Scaffold() error { - fmt.Println("Writing scaffolds for you to edit...") - - if err := utils.UpdateKustomizationsInit(); err != nil { - return fmt.Errorf("error updating kustomization.yaml files: %v", err) - } - - // Initialize the machinery.Scaffold that will write the files to disk - scaffold := machinery.NewScaffold(s.fs, - machinery.WithDirectoryPermissions(0755), - machinery.WithFilePermissions(0644), - machinery.WithConfig(s.config), - ) - - // The boilerplate file needs to be scaffolded as a separate step as it is going to be used - // by rest of the files, even those scaffolded in this command call. - bpFile := &hack.Boilerplate{ - License: s.license, - Owner: s.owner, - } - - bpFile.Path = s.boilerplatePath - if err := scaffold.Execute(bpFile); err != nil { - return err - } - - boilerplate, err := afero.ReadFile(s.fs.FS, s.boilerplatePath) - if err != nil { - return err - } - - // Initialize the machinery.Scaffold that will write the files to disk - scaffold = machinery.NewScaffold(s.fs, - machinery.WithConfig(s.config), - machinery.WithBoilerplate(string(boilerplate)), - ) - - // create placeholder directories for helm charts and go apis - err = createDirectories([]string{chartutil.HelmChartsDir, "api", "controllers"}) - if err != nil { - return err - } - - err = scaffold.Execute( - &templates.Main{}, - &templates.GoMod{ControllerRuntimeVersion: golangv4.ControllerRuntimeVersion}, - &templates.GitIgnore{}, - &templates.Watches{}, - &rbac.ManagerRole{}, - &templates.Makefile{ - Image: imageName, - KustomizeVersion: kustomizev2.KustomizeVersion, - HybridOperatorVersion: hybridOperatorVersion, - ControllerToolsVersion: golangv4.ControllerToolsVersion, - ControllerRuntimeVersion: golangv4.ControllerRuntimeVersion, - }, - &templates.Dockerfile{}, - &templates.DockerIgnore{}, - ) - - if err != nil { - return err - } - - err = util.RunCmd("Get helm-operator-plugins", "go", "get", - "github.com/operator-framework/helm-operator-plugins@"+helmPluginVersion) - if err != nil { - return err - } - - return nil -} - -func createDirectories(directories []string) error { - for _, dir := range directories { - if err := os.MkdirAll(dir, 0755); err != nil { - return fmt.Errorf("unable to create directory %q : %v", dir, err) - } - } - return nil -} diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerfile.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerfile.go deleted file mode 100644 index 0ee7f99c9..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerfile.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package templates - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &Dockerfile{} - -// Dockerfile scaffolds a file that defines the containerized build process -type Dockerfile struct { - machinery.TemplateMixin -} - -// SetTemplateDefaults implements file.Template -func (f *Dockerfile) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = "Dockerfile" - } - - f.TemplateBody = dockerfileTemplate - - return nil -} - -// The current template scaffolds copying of go dependencies and building -// main.go. If there are any other depencies or folders to be copied like -// `api/` and `controller/` they would have to be added. - -const dockerfileTemplate = `# Build the manager binary -FROM golang:1.20 as builder - -WORKDIR /workspace -# Copy the Go Modules manifests -COPY go.mod go.mod -COPY go.sum go.sum -# cache deps before building and copying source so that we don't need to re-download as much -# and so that source changes don't invalidate our downloaded layer -RUN go mod download - -# Copy the go source -COPY cmd/ cmd/ -COPY api/ api/ -COPY controllers/ controllers/ - -# Build -RUN GOOS=linux GOARCH=amd64 go build -a -o manager cmd/main.go - -FROM registry.access.redhat.com/ubi8/ubi-micro:8.7 - -ENV HOME=/opt/helm \ - USER_NAME=helm \ - USER_UID=1001 - -RUN echo "${USER_NAME}:x:${USER_UID}:0:${USER_NAME} user:${HOME}:/sbin/nologin" >> /etc/passwd - -# Copy necessary files with the right permissions -COPY --chown=${USER_UID}:0 watches.yaml ${HOME}/watches.yaml -COPY --chown=${USER_UID}:0 helm-charts ${HOME}/helm-charts - -# Copy manager binary -COPY --from=builder /workspace/manager . - -USER ${USER_UID} - -WORKDIR ${HOME} - -ENTRYPOINT ["/manager"] -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerignore.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerignore.go deleted file mode 100644 index 3826dc2b8..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/dockerignore.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package templates - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &DockerIgnore{} - -// DockerIgnore scaffolds a file that defines which files should be ignored by the containerized build process -type DockerIgnore struct { - machinery.TemplateMixin -} - -// SetTemplateDefaults implements file.Template -func (f *DockerIgnore) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = ".dockerignore" - } - - f.TemplateBody = dockerignorefileTemplate - - return nil -} - -const dockerignorefileTemplate = `# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file -# Ignore build and test binaries. -bin/ -testbin/ -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/gitignore.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/gitignore.go deleted file mode 100644 index 0d7290b58..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/gitignore.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. -Modifications copyright 2020 The Operator-SDK Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package templates - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &GitIgnore{} - -// GitIgnore scaffolds the .gitignore file -type GitIgnore struct { - machinery.TemplateMixin -} - -// SetTemplateDefaults implements machinery.Template -func (f *GitIgnore) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = ".gitignore" - } - - f.TemplateBody = gitignoreTemplate - - return nil -} - -const gitignoreTemplate = ` -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib -bin - -# editor and IDE paraphernalia -.idea -*.swp -*.swo -*~ -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/gomod.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/gomod.go deleted file mode 100644 index 49a3138f6..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/gomod.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package templates - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &GoMod{} - -// GoMod scaffolds a file that defines the project dependencies -type GoMod struct { - machinery.TemplateMixin - machinery.RepositoryMixin - - ControllerRuntimeVersion string -} - -// SetTemplateDefaults implements file.Template -func (f *GoMod) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = "go.mod" - } - - f.TemplateBody = goModTemplate - - f.IfExistsAction = machinery.OverwriteFile - - return nil -} - -const goModTemplate = ` -module {{ .Repo }} - -go 1.20 - -require ( - sigs.k8s.io/controller-runtime {{ .ControllerRuntimeVersion }} -) -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/hack/boilerplate.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/hack/boilerplate.go deleted file mode 100644 index 8f5c3ac84..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/hack/boilerplate.go +++ /dev/null @@ -1,128 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package hack - -import ( - "fmt" - "path/filepath" - "time" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -// DefaultBoilerplatePath is the default path to the boilerplate file -var DefaultBoilerplatePath = filepath.Join("hack", "boilerplate.go.txt") - -var _ machinery.Template = &Boilerplate{} - -// Boilerplate scaffolds a file that defines the common header for the rest of the files -type Boilerplate struct { - machinery.TemplateMixin - machinery.BoilerplateMixin - - // License is the License type to write - License string - - // Licenses maps License types to their actual string - Licenses map[string]string - - // Owner is the copyright owner - e.g. "The Kubernetes Authors" - Owner string - - // Year is the copyright year - Year string -} - -// Validate implements file.RequiresValidation -func (f Boilerplate) Validate() error { - if f.License == "" { - // A default license will be set later - return nil - } - if _, found := knownLicenses[f.License]; found { - // One of the know licenses - return nil - } - if _, found := f.Licenses[f.License]; found { - // A map containing the requested license was also provided - return nil - } - - return fmt.Errorf("unknown specified license %s", f.License) -} - -// SetTemplateDefaults implements file.Template -func (f *Boilerplate) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = DefaultBoilerplatePath - } - - if f.License == "" { - f.License = "apache2" - } - - if f.Licenses == nil { - f.Licenses = make(map[string]string, len(knownLicenses)) - } - - for key, value := range knownLicenses { - if _, hasLicense := f.Licenses[key]; !hasLicense { - f.Licenses[key] = value - } - } - - if f.Year == "" { - f.Year = fmt.Sprintf("%v", time.Now().Year()) - } - - // Boilerplate given - if len(f.Boilerplate) > 0 { - f.TemplateBody = f.Boilerplate - return nil - } - - f.TemplateBody = boilerplateTemplate - - return nil -} - -const boilerplateTemplate = `/* -{{ if .Owner -}} -Copyright {{ .Year }} {{ .Owner }}. -{{- else -}} -Copyright {{ .Year }}. -{{- end }} -{{ index .Licenses .License }}*/` - -var knownLicenses = map[string]string{ - "apache2": apache2, - "none": "", -} - -const apache2 = ` -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/main.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/main.go deleted file mode 100644 index 3e4825965..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/main.go +++ /dev/null @@ -1,369 +0,0 @@ -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -package templates - -import ( - "fmt" - "path/filepath" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -const defaultMainPath = "cmd/main.go" - -var _ machinery.Template = &Main{} - -// Main scaffolds a file that defines the controller manager entry point -type Main struct { - machinery.TemplateMixin - machinery.BoilerplateMixin - machinery.DomainMixin - machinery.RepositoryMixin - machinery.ComponentConfigMixin -} - -// SetTemplateDefaults implements file.Template -func (f *Main) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = filepath.Join(defaultMainPath) - } - - f.TemplateBody = fmt.Sprintf(mainTemplate, - machinery.NewMarkerFor(f.Path, importMarker), - machinery.NewMarkerFor(f.Path, addSchemeMarker), - machinery.NewMarkerFor(f.Path, setupMarker), - ) - - return nil -} - -var _ machinery.Inserter = &MainUpdater{} - -// MainUpdater updates main.go to run Controllers -type MainUpdater struct { //nolint:maligned - machinery.RepositoryMixin - machinery.MultiGroupMixin - machinery.ResourceMixin - - // Flags to indicate which parts need to be included when updating the file - WireResource, WireController, WireWebhook bool -} - -// GetPath implements file.Builder -func (*MainUpdater) GetPath() string { - return defaultMainPath -} - -// GetIfExistsAction implements file.Builder -func (*MainUpdater) GetIfExistsAction() machinery.IfExistsAction { - return machinery.OverwriteFile -} - -const ( - importMarker = "imports" - addSchemeMarker = "scheme" - setupMarker = "builder" -) - -// GetMarkers implements file.Inserter -func (f *MainUpdater) GetMarkers() []machinery.Marker { - return []machinery.Marker{ - machinery.NewMarkerFor(defaultMainPath, importMarker), - machinery.NewMarkerFor(defaultMainPath, addSchemeMarker), - machinery.NewMarkerFor(defaultMainPath, setupMarker), - } -} - -const ( - apiImportCodeFragment = `%s "%s" -` - controllerImportCodeFragment = `"%s/controllers" -` - multiGroupControllerImportCodeFragment = `%scontrollers "%s/controllers/%s" -` - addschemeCodeFragment = `utilruntime.Must(%s.AddToScheme(scheme)) -` - reconcilerSetupCodeFragment = `if err = (&controllers.%sReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "%s") - os.Exit(1) - } -` - multiGroupReconcilerSetupCodeFragment = `if err = (&%scontrollers.%sReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "%s") - os.Exit(1) - } -` - webhookSetupCodeFragment = `if err = (&%s.%s{}).SetupWebhookWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create webhook", "webhook", "%s") - os.Exit(1) - } -` -) - -// GetCodeFragments implements file.Inserter -func (f *MainUpdater) GetCodeFragments() machinery.CodeFragmentsMap { - fragments := make(machinery.CodeFragmentsMap, 3) - - // If resource is not being provided we are creating the file, not updating it - if f.Resource == nil { - return fragments - } - - // Generate import code fragments - imports := make([]string, 0) - if f.WireResource { - imports = append(imports, fmt.Sprintf(apiImportCodeFragment, f.Resource.ImportAlias(), f.Resource.Path)) - } - - if f.WireController { - if !f.MultiGroup || f.Resource.Group == "" { - imports = append(imports, fmt.Sprintf(controllerImportCodeFragment, f.Repo)) - } else { - imports = append(imports, fmt.Sprintf(multiGroupControllerImportCodeFragment, - f.Resource.PackageName(), f.Repo, f.Resource.Group)) - } - } - - // Generate add scheme code fragments - addScheme := make([]string, 0) - if f.WireResource { - addScheme = append(addScheme, fmt.Sprintf(addschemeCodeFragment, f.Resource.ImportAlias())) - } - - // Generate setup code fragments - setup := make([]string, 0) - if f.WireController { - if !f.MultiGroup || f.Resource.Group == "" { - setup = append(setup, fmt.Sprintf(reconcilerSetupCodeFragment, - f.Resource.Kind, f.Resource.Kind)) - } else { - setup = append(setup, fmt.Sprintf(multiGroupReconcilerSetupCodeFragment, - f.Resource.PackageName(), f.Resource.Kind, f.Resource.Kind)) - } - } - if f.WireWebhook { - setup = append(setup, fmt.Sprintf(webhookSetupCodeFragment, - f.Resource.ImportAlias(), f.Resource.Kind, f.Resource.Kind)) - } - - // Only store code fragments in the map if the slices are non-empty - if len(imports) != 0 { - fragments[machinery.NewMarkerFor(defaultMainPath, importMarker)] = imports - } - if len(addScheme) != 0 { - fragments[machinery.NewMarkerFor(defaultMainPath, addSchemeMarker)] = addScheme - } - if len(setup) != 0 { - fragments[machinery.NewMarkerFor(defaultMainPath, setupMarker)] = setup - } - - return fragments -} - -// TODO: -// 1. Modify the template when pkg/watches is updated according to the latest -// helm v1 plugin in operator-sdk. -// 2. Move the flags to a seprate package and clean up the scaffolding. -// 3. Modify leader-election-id to be the project name. -var mainTemplate = `{{ .Boilerplate }} - -package main - -import ( - "crypto/tls" - "flag" - "os" - "runtime" - "time" - - // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) - "github.com/operator-framework/helm-operator-plugins/pkg/annotation" - "github.com/operator-framework/helm-operator-plugins/pkg/reconciler" - "github.com/operator-framework/helm-operator-plugins/pkg/watches" - _ "k8s.io/client-go/plugin/pkg/client/auth" - - ctrlruntime "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - clientgoscheme "k8s.io/client-go/kubernetes/scheme" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/healthz" - "sigs.k8s.io/controller-runtime/pkg/log/zap" - "sigs.k8s.io/controller-runtime/pkg/webhook" - metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - - %s -) - -var ( - scheme = ctrlruntime.NewScheme() - setupLog = ctrl.Log.WithName("setup") - defaultMaxConcurrentReconciles = runtime.NumCPU() - defaultReconcilePeriod = time.Minute -) - -func init() { - utilruntime.Must(clientgoscheme.AddToScheme(scheme)) - - %s -} - -func main() { -{{- if not .ComponentConfig }} - var ( - metricsAddr string - leaderElectionID string - watchesPath string - probeAddr string - enableLeaderElection bool - enableHTTP2 bool - secureMetrics bool - ) - - flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") - flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") - flag.StringVar(&watchesPath, "watches-file", "watches.yaml", "path to watches file") - flag.StringVar(&leaderElectionID, "leader-election-id", "{{ hashFNV .Repo }}.{{ .Domain }}", "provide leader election") - flag.BoolVar(&enableLeaderElection, "leader-elect", false, - "Enable leader election for controller manager. " + - "Enabling this will ensure there is only one active controller manager.") - flag.BoolVar(&secureMetrics, "metrics-secure", false, - "Whether or not the metrics endpoint should be served securely") - flag.BoolVar(&enableHTTP2, "enable-http2", false, - "Whether or not HTTP/2 should be enabled for the metrics and webhook servers") -{{- else }} - var configFile string - flag.StringVar(&configFile, "config", "", - "The controller will load its initial configuration from this file. " + - "Omit this flag to use the default configuration values. " + - "Command-line flags override configuration from this file.") -{{- end }} - opts := zap.Options{ - Development: true, - } - opts.BindFlags(flag.CommandLine) - flag.Parse() - - ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - -{{ if not .ComponentConfig }} - disableHTTP2 := func(c *tls.Config) { - setupLog.Info("disabling http/2") - c.NextProtos = []string{"http/1.1"} - } - - tlsOpts := []func(*tls.Config){} - if !enableHTTP2 { - tlsOpts = append(tlsOpts, disableHTTP2) - } - - webhookServer := webhook.NewServer(webhook.Options{ - TLSOpts: tlsOpts, - }) - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ - Scheme: scheme, - Metrics: metricsserver.Options{ - BindAddress: metricsAddr, - SecureServing: secureMetrics, - TLSOpts: tlsOpts, - }, - WebhookServer: webhookServer, - HealthProbeBindAddress: probeAddr, - LeaderElection: enableLeaderElection, - LeaderElectionID: leaderElectionID, - }) -{{- else }} - var err error - options := ctrl.Options{Scheme: scheme} - if configFile != "" { - options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile)) - if err != nil { - setupLog.Error(err, "unable to load the config file") - os.Exit(1) - } - } - - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options) -{{- end }} - if err != nil { - setupLog.Error(err, "unable to start manager") - os.Exit(1) - } - - %s - - if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up health check") - os.Exit(1) - } - if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil { - setupLog.Error(err, "unable to set up ready check") - os.Exit(1) - } - - ws, err := watches.Load(watchesPath) - if err != nil { - setupLog.Error(err, "Failed to create new manager factories") - os.Exit(1) - } - - for _, w := range ws { - // Register controller with the factory - reconcilePeriod := defaultReconcilePeriod - if w.ReconcilePeriod != nil { - reconcilePeriod = w.ReconcilePeriod.Duration - } - - maxConcurrentReconciles := defaultMaxConcurrentReconciles - if w.MaxConcurrentReconciles != nil { - maxConcurrentReconciles = *w.MaxConcurrentReconciles - } - - r, err := reconciler.New( - reconciler.WithChart(*w.Chart), - reconciler.WithGroupVersionKind(w.GroupVersionKind), - reconciler.WithOverrideValues(w.OverrideValues), - reconciler.SkipDependentWatches(w.WatchDependentResources != nil && !*w.WatchDependentResources), - reconciler.WithMaxConcurrentReconciles(maxConcurrentReconciles), - reconciler.WithReconcilePeriod(reconcilePeriod), - reconciler.WithInstallAnnotations(annotation.DefaultInstallAnnotations...), - reconciler.WithUpgradeAnnotations(annotation.DefaultUpgradeAnnotations...), - reconciler.WithUninstallAnnotations(annotation.DefaultUninstallAnnotations...), - ) - if err != nil { - setupLog.Error(err, "unable to create helm reconciler", "controller", "Helm") - os.Exit(1) - } - if err := r.SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "Helm") - os.Exit(1) - } - setupLog.Info("configured watch", "gvk", w.GroupVersionKind, "chartPath", w.ChartPath, "maxConcurrentReconciles", maxConcurrentReconciles, "reconcilePeriod", reconcilePeriod) - } - - setupLog.Info("starting manager") - if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { - setupLog.Error(err, "problem running manager") - os.Exit(1) - } -} -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/makefile.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/makefile.go deleted file mode 100644 index d267d8b65..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/makefile.go +++ /dev/null @@ -1,205 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. -Modifications copyright 2020 The Operator-SDK Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package templates - -import ( - "errors" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &Makefile{} - -// Makefile scaffolds the Makefile -type Makefile struct { - machinery.TemplateMixin - - // Image is controller manager image name - Image string - - // Kustomize version to use in the project - KustomizeVersion string - - // BoilerplatePath is the path to the boilerplate file - BoilerplatePath string - // Controller tools version to use in the project - ControllerToolsVersion string - - // ControllerRuntimeVersion version to use in the project - ControllerRuntimeVersion string - - // HybridOperatorVersion is the version of the hybrid oeprator binary downloaded by Makefile - HybridOperatorVersion string -} - -// SetTemplateDefaults implements machinery.Template -func (f *Makefile) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = "Makefile" - } - - f.TemplateBody = makefileTemplate - - if f.Image == "" { - f.Image = "controller:latest" - } - - if f.KustomizeVersion == "" { - return errors.New("kustomize version is required in scaffold") - } - - if f.HybridOperatorVersion == "" { - return errors.New("hybrid-operator version is required in scaffold") - } - return nil -} - -// TODO: Update the Makefile to have run commands based on how binary is built. -// Include build targets. -const makefileTemplate = ` -# Image URL to use all building/pushing image targets -IMG ?= {{ .Image }} -# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.25.0 - -# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) -ifeq (,$(shell go env GOBIN)) -GOBIN=$(shell go env GOPATH)/bin -else -GOBIN=$(shell go env GOBIN) -endif - -# Setting SHELL to bash allows bash commands to be executed by recipes. -# Options are set to exit when a recipe line exits non-zero or a piped command fails. -SHELL = /usr/bin/env bash -o pipefail -.SHELLFLAGS = -ec - -.PHONY: all -all: build - -##@ General - -# The help target prints out all targets with their descriptions organized -# beneath their categories. The categories are represented by '##@' and the -# target descriptions by '##'. The awk commands is responsible for reading the -# entire set of makefiles included in this invocation, looking for lines of the -# file as xyz: ## something, and then pretty-format the target and help. Then, -# if there's a line with ##@ something, that gets pretty-printed as a category. -# More info on the usage of ANSI control characters for terminal formatting: -# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters -# More info on the awk command: -# http://linuxcommand.org/lc3_adv_awk.php - -.PHONY: help -help: ## Display this help. - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -##@ Build -.PHONY: build -build: manifests generate fmt vet ## Build manager binary. - go build -o bin/manager cmd/main.go - -.PHONY: run -run: manifests generate fmt vet ## Run against the configured Kubernetes cluster in ~/.kube/config - go run cmd/main.go - -.PHONY: docker-build -docker-build: ## Build docker image with the manager. - docker build -t ${IMG} . - -.PHONY: docker-push -docker-push: ## Push docker image with the manager. - docker push ${IMG} - -##@ Development - -.PHONY: manifests -manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases - -.PHONY: generate -generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. - $(CONTROLLER_GEN) object:headerFile={{printf "%q" .BoilerplatePath}} paths="./..." - -.PHONY: fmt -fmt: ## Run go fmt against code. - go fmt ./... - -.PHONY: vet -vet: ## Run go vet against code. - go vet ./... - -.PHONY: test -test: manifests generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out - -##@ Deployment - -ifndef ignore-not-found - ignore-not-found = false -endif - -.PHONY: install -install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/crd | kubectl apply -f - - -.PHONY: uninstall -uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - - -.PHONY: deploy -deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default | kubectl apply -f - - -.PHONY: undeploy -undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - - -##@ Build Dependencies - -## Location to install dependencies to -LOCALBIN ?= $(shell pwd)/bin -$(LOCALBIN): - mkdir -p $(LOCALBIN) - -## Tool Binaries -KUSTOMIZE ?= $(LOCALBIN)/kustomize -CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen -ENVTEST ?= $(LOCALBIN)/setup-envtest - -## Tool Versions -KUSTOMIZE_VERSION ?= {{ .KustomizeVersion }} -CONTROLLER_TOOLS_VERSION ?= {{ .ControllerToolsVersion }} - -KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" -.PHONY: kustomize -kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. -$(KUSTOMIZE): $(LOCALBIN) - test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); } - -.PHONY: controller-gen -controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. -$(CONTROLLER_GEN): $(LOCALBIN) - test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION) - -.PHONY: envtest -envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. -$(ENVTEST): $(LOCALBIN) - test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/rbac/manager_role.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/rbac/manager_role.go deleted file mode 100644 index f5e03a5b8..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/rbac/manager_role.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2019 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package rbac - -import ( - "fmt" - "path/filepath" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &ManagerRole{} - -var defaultRoleFile = filepath.Join("config", "rbac", "role.yaml") - -// ManagerRole scaffolds the role.yaml file -type ManagerRole struct { - machinery.TemplateMixin -} - -// SetTemplateDefaults implements machinery.Template -func (f *ManagerRole) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = defaultRoleFile - } - - f.TemplateBody = fmt.Sprintf(roleTemplate, machinery.NewMarkerFor(f.Path, rulesMarker)) - - return nil -} - -const ( - rulesMarker = "rules" -) - -const roleTemplate = `apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: manager-role -rules: -## -## Base operator rules -## -# We need to get namespaces so the operator can read namespaces to ensure they exist -- apiGroups: - - "" - resources: - - namespaces - verbs: - - get -# We need to manage Helm release secrets -- apiGroups: - - "" - resources: - - secrets - verbs: - - "*" -# We need to create events on CRs about things happening during reconciliation -- apiGroups: - - "" - resources: - - events - verbs: - - create - -%s -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/watches.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/watches.go deleted file mode 100644 index 2297cc036..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/watches.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2020 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package templates - -import ( - "fmt" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &Watches{} - -const defaultWatchesFile = "watches.yaml" - -// Watches scaffolds the watches.yaml file -type Watches struct { - machinery.TemplateMixin -} - -// SetTemplateDefaults implements machinery.Template -func (f *Watches) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = defaultWatchesFile - } - - f.TemplateBody = fmt.Sprintf(watchesTemplate, - machinery.NewMarkerFor(f.Path, watchMarker), - ) - return nil -} - -var _ machinery.Inserter = &WatchesUpdater{} - -type WatchesUpdater struct { - machinery.ResourceMixin - - ChartPath string -} - -func (*WatchesUpdater) GetPath() string { - return defaultWatchesFile -} - -func (*WatchesUpdater) GetIfExistsAction() machinery.IfExistsAction { - return machinery.OverwriteFile -} - -const ( - watchMarker = "watch" -) - -func (f *WatchesUpdater) GetMarkers() []machinery.Marker { - return []machinery.Marker{ - machinery.NewMarkerFor(defaultWatchesFile, watchMarker), - } -} - -func (f *WatchesUpdater) GetCodeFragments() machinery.CodeFragmentsMap { - fragments := make(machinery.CodeFragmentsMap, 1) - - // If resource is not being provided we are creating the file, not updating it - if f.Resource == nil { - return fragments - } - - // Generate watch fragments - watches := make([]string, 0) - watches = append(watches, - fmt.Sprintf(watchFragment, f.Resource.QualifiedGroup(), f.Resource.Version, f.Resource.Kind, f.ChartPath)) - - if len(watches) != 0 { - fragments[machinery.NewMarkerFor(defaultWatchesFile, watchMarker)] = watches - } - return fragments -} - -const watchFragment = `- group: %s - version: %s - kind: %s - chart: %s -` - -const watchesTemplate = `# Use the 'create api' subcommand to add watches to this file. -%s -` diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/cleanup.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/cleanup.go deleted file mode 100644 index 32e6f64e6..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/cleanup.go +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package util - -import ( - "bytes" - "errors" - "fmt" - "os" - "path/filepath" - - log "github.com/sirupsen/logrus" -) - -// RemoveKustomizeCRDManifests removes items in config/crd relating to CRD conversion webhooks. -func RemoveKustomizeCRDManifests() error { - pathsToRemove := []string{ - filepath.Join("config", "crd", "kustomizeconfig.yaml"), - } - configPatchesDir := filepath.Join("config", "crd", "patches") - webhookPatchMatches, err := filepath.Glob(filepath.Join(configPatchesDir, "webhook_in_*.yaml")) - if err != nil { - return err - } - pathsToRemove = append(pathsToRemove, webhookPatchMatches...) - cainjectionPatchMatches, err := filepath.Glob(filepath.Join(configPatchesDir, "cainjection_in_*.yaml")) - if err != nil { - return err - } - pathsToRemove = append(pathsToRemove, cainjectionPatchMatches...) - for _, p := range pathsToRemove { - if err := os.RemoveAll(p); err != nil { - return err - } - } - children, err := os.ReadDir(configPatchesDir) - if err == nil && len(children) == 0 { - if err := os.RemoveAll(configPatchesDir); err != nil { - return err - } - } - return nil -} - -// UpdateKustomizationsCreateAPI updates certain parts of or removes entire kustomization.yaml files -// that are either not used by certain CreateAPI plugins or are created by preceding CreateAPI plugins. -func UpdateKustomizationsCreateAPI() error { - crdKFile := filepath.Join("config", "crd", "kustomization.yaml") - if crdKBytes, err := os.ReadFile(crdKFile); err != nil && !errors.Is(err, os.ErrNotExist) { - log.Debugf("Error reading kustomization for substitution: %v", err) - } else if err == nil { - if bytes.Contains(crdKBytes, []byte("[WEBHOOK]")) || bytes.Contains(crdKBytes, []byte("[CERTMANAGER]")) { - if err := os.RemoveAll(crdKFile); err != nil { - log.Debugf("Error removing file prior to scaffold: %v", err) - } - } - } - - return nil -} - -// UpdateKustomizationsInit updates certain parts of or removes entire kustomization.yaml files -// that are either not used by certain Init plugins or are created by preceding Init plugins. -func UpdateKustomizationsInit() error { - defaultKFile := filepath.Join("config", "default", "kustomization.yaml") - if err := ReplaceInFile(defaultKFile, - ` -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -#- ../webhook -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. -#- ../certmanager`, ""); err != nil { - return fmt.Errorf("remove %s resources: %v", defaultKFile, err) - } - - if err := ReplaceInFile(defaultKFile, - ` -# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in -# crd/kustomization.yaml -#- path: manager_webhook_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. -# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. -# 'CERTMANAGER' needs to be enabled to use ca injection -#- path: webhookcainjection_patch.yaml - -# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. -# Uncomment the following replacements to add the cert-manager CA injection annotations -#replacements: -# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldPath: .metadata.namespace # namespace of the certificate CR -# targets: -# - select: -# kind: ValidatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - select: -# kind: MutatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - select: -# kind: CustomResourceDefinition -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 0 -# create: true -# - source: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# name: serving-cert # this name should match the one in certificate.yaml -# fieldPath: .metadata.name -# targets: -# - select: -# kind: ValidatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - select: -# kind: MutatingWebhookConfiguration -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - select: -# kind: CustomResourceDefinition -# fieldPaths: -# - .metadata.annotations.[cert-manager.io/inject-ca-from] -# options: -# delimiter: '/' -# index: 1 -# create: true -# - source: # Add cert-manager annotation to the webhook Service -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.name # namespace of the service -# targets: -# - select: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# fieldPaths: -# - .spec.dnsNames.0 -# - .spec.dnsNames.1 -# options: -# delimiter: '.' -# index: 0 -# create: true -# - source: -# kind: Service -# version: v1 -# name: webhook-service -# fieldPath: .metadata.namespace # namespace of the service -# targets: -# - select: -# kind: Certificate -# group: cert-manager.io -# version: v1 -# fieldPaths: -# - .spec.dnsNames.0 -# - .spec.dnsNames.1 -# options: -# delimiter: '.' -# index: 1 -# create: true -`, ""); err != nil { - return fmt.Errorf("remove %s patch and vars blocks: %v", defaultKFile, err) - } - - return nil -} diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/message.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/message.go deleted file mode 100644 index f77e945c2..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/message.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2020 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package util - -const WarnMessageRemovalV1beta1 = "The v1beta1 API version for CRDs and Webhooks is deprecated and is no longer offered since " + - "Kubernetes 1.22. This flag will be removed in a future release. We " + - "recommend that you no longer use the v1beta1 API version" + - "More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22" diff --git a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/utils.go b/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/utils.go deleted file mode 100644 index 3494c8223..000000000 --- a/tools/vendor/github.com/operator-framework/helm-operator-plugins/pkg/plugins/util/utils.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2020 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// todo(camilamacedo86): push this helpers to kubbuilder - -package util - -import ( - "errors" - "os" - "regexp" - "strings" -) - -const ( - DefaultNameQualifier = ".sdk.operatorframework.io" -) - -func ReplaceInFile(path, old, new string) error { - info, err := os.Stat(path) - if err != nil { - return err - } - b, err := os.ReadFile(path) - if err != nil { - return err - } - if !strings.Contains(string(b), old) { - return errors.New("unable to find the content to be replaced") - } - s := strings.Replace(string(b), old, new, -1) - err = os.WriteFile(path, []byte(s), info.Mode()) - if err != nil { - return err - } - return nil -} - -func ReplaceRegexInFile(path, match, replace string) error { - matcher, err := regexp.Compile(match) - if err != nil { - return err - } - info, err := os.Stat(path) - if err != nil { - return err - } - b, err := os.ReadFile(path) - if err != nil { - return err - } - s := matcher.ReplaceAllString(string(b), replace) - if s == string(b) { - return errors.New("unable to find the content to be replaced") - } - err = os.WriteFile(path, []byte(s), info.Mode()) - if err != nil { - return err - } - return nil -} - -// InsertCode searches target content in the file and insert `toInsert` after the target. -func InsertCode(filename, target, code string) error { - contents, err := os.ReadFile(filename) - if err != nil { - return err - } - idx := strings.Index(string(contents), target) - out := string(contents[:idx+len(target)]) + code + string(contents[idx+len(target):]) - // false positive - // nolint:gosec - return os.WriteFile(filename, []byte(out), 0644) -} diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/LICENSE b/tools/vendor/github.com/operator-framework/java-operator-plugins/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/api.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/api.go deleted file mode 100644 index 6aa15c791..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/api.go +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package v1 - -import ( - "bufio" - "errors" - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds" - log "github.com/sirupsen/logrus" - "github.com/spf13/afero" - "github.com/spf13/pflag" - - "sigs.k8s.io/kubebuilder/v3/pkg/config" - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - "sigs.k8s.io/kubebuilder/v3/pkg/model/resource" - "sigs.k8s.io/kubebuilder/v3/pkg/plugin" - "sigs.k8s.io/kubebuilder/v3/pkg/plugin/util" - pluginutil "sigs.k8s.io/kubebuilder/v3/pkg/plugin/util" -) - -const filePath = "Makefile" - -type createAPIOptions struct { - CRDVersion string - Namespaced bool -} - -type createAPISubcommand struct { - config config.Config - resource *resource.Resource - options createAPIOptions -} - -func (opts createAPIOptions) UpdateResource(res *resource.Resource) { - - res.API = &resource.API{ - CRDVersion: opts.CRDVersion, - Namespaced: opts.Namespaced, - } - - // Ensure that Path is empty and Controller false as this is not a Go project - res.Path = "" - res.Controller = false -} - -var ( - _ plugin.CreateAPISubcommand = &createAPISubcommand{} -) - -func (p *createAPISubcommand) BindFlags(fs *pflag.FlagSet) { - fs.SortFlags = false - fs.StringVar(&p.options.CRDVersion, "crd-version", "v1", "crd version to generate") - fs.BoolVar(&p.options.Namespaced, "namespaced", true, "resource is namespaced") -} - -func (p *createAPISubcommand) InjectConfig(c config.Config) error { - p.config = c - - return nil -} - -func (p *createAPISubcommand) Run(fs machinery.Filesystem) error { - return nil -} - -func (p *createAPISubcommand) Validate() error { - return nil -} - -func (p *createAPISubcommand) PostScaffold() error { - return nil -} - -func (p *createAPISubcommand) Scaffold(fs machinery.Filesystem) error { - scaffolder := scaffolds.NewCreateAPIScaffolder(p.config, *p.resource) - - var s = fmt.Sprintf(makefileBundleCRDFile, p.resource.Plural, p.resource.QualifiedGroup()) - foundLine := findOldFilesForReplacement(filePath, s) - - if !foundLine { - makefileBytes, err := afero.ReadFile(fs.FS, filePath) - if err != nil { - return err - } - - projectName := p.config.GetProjectName() - if projectName == "" { - dir, err := os.Getwd() - if err != nil { - return fmt.Errorf("error getting current directory: %w", err) - } - projectName = strings.ToLower(filepath.Base(dir)) - } - - makefileBytes = append(makefileBytes, []byte(fmt.Sprintf(makefileBundleVarFragment, p.resource.Plural, p.resource.QualifiedGroup()))...) - - makefileBytes = append([]byte(fmt.Sprintf(makefileBundleImageFragement, p.config.GetDomain(), projectName)), makefileBytes...) - - var mode os.FileMode = 0644 - if info, err := fs.FS.Stat(filePath); err == nil { - mode = info.Mode() - } - if err := afero.WriteFile(fs.FS, filePath, makefileBytes, mode); err != nil { - return fmt.Errorf("error updating Makefile: %w", err) - } - } - - scaffolder.InjectFS(fs) - - if err := scaffolder.Scaffold(); err != nil { - return err - } - - return nil -} - -func (p *createAPISubcommand) InjectResource(res *resource.Resource) error { - p.resource = res - - // RESOURCE: &{{cache zeusville.com v1 Joke} jokes 0xc00082a640 false 0xc00082a680} - p.options.UpdateResource(p.resource) - - if err := p.resource.Validate(); err != nil { - return err - } - - // Check that resource doesn't have the API scaffolded - if res, err := p.config.GetResource(p.resource.GVK); err == nil && res.HasAPI() { - return errors.New("the API resource already exists") - } - - // Check that the provided group can be added to the project - if !p.config.IsMultiGroup() && p.config.ResourcesLength() != 0 && !p.config.HasGroup(p.resource.Group) { - return fmt.Errorf("multiple groups are not allowed by default, to enable multi-group set 'multigroup: true' in your PROJECT file") - } - - // Selected CRD version must match existing CRD versions. - if pluginutil.HasDifferentCRDVersion(p.config, p.resource.API.CRDVersion) { - return fmt.Errorf("only one CRD version can be used for all resources, cannot add %q", p.resource.API.CRDVersion) - } - - return nil -} - -// findOldFilesForReplacement verifies marker (## marker) and if it found then merge new api CRD file to the odler logic -func findOldFilesForReplacement(path, newfile string) bool { - - f, err := os.Open(path) - if err != nil { - log.Fatal(err) - } - - // remember to close the file at the end of the program - defer f.Close() - - // read the file line by line using scanner - scanner := bufio.NewScanner(f) - var foundMarker bool - for scanner.Scan() { - // do something with a line - if scanner.Text() == "## marker" { - foundMarker = true - break - } - } - - if foundMarker { - scanner.Scan() - catLine := scanner.Text() - - splitByPipe := strings.Split(catLine, "|") - - finalString := strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(splitByPipe[0]), "cat"), "target/kubernetes/kubernetes.yml") - - updatedLine := " " + "cat" + finalString + newfile + " target/kubernetes/kubernetes.yml" + " |" + splitByPipe[1] - - if err := scanner.Err(); err != nil { - log.Error(err, "Unable to scan existing bundle target command from the Makefile. New bundle target command being created. This may overwrite any existing commands.") - return false - } - - // ReplaceInFile replaces all instances of old with new in the file at path. - err = util.ReplaceInFile(path, catLine, updatedLine) - if err != nil { - log.Error(err, "Unable to replace existing bundle target command from the Makefile. New bundle target command being created. This may overwrite any existing commands.") - return false - } - } - - return foundMarker -} - -const ( - makefileBundleCRDFile = `target/kubernetes/%[1]s.%[2]s-v1.yml` -) - -const ( - makefileBundleVarFragment = ` -##@Bundle -.PHONY: bundle -bundle: ## Generate bundle manifests and metadata, then validate generated files. -## marker - cat target/kubernetes/%[1]s.%[2]s-v1.yml target/kubernetes/kubernetes.yml | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) - operator-sdk bundle validate ./bundle - -.PHONY: bundle-build -bundle-build: ## Build the bundle image. - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . - -.PHONY: bundle-push -bundle-push: ## Push the bundle image. - docker push $(BUNDLE_IMG) -` -) - -const ( - makefileBundleImageFragement = ` -VERSION ?= 0.0.1 - -# CHANNELS define the bundle channels used in the bundle. -# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") -# To re-generate a bundle for other specific channels without changing the standard setup, you can: -# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable) -# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable") -ifneq ($(origin CHANNELS), undefined) -BUNDLE_CHANNELS := --channels=$(CHANNELS) -endif - -# DEFAULT_CHANNEL defines the default channel used in the bundle. -# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable") -# To re-generate a bundle for any other default channel without changing the default setup, you can: -# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable) -# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable") -ifneq ($(origin DEFAULT_CHANNEL), undefined) -BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL) -endif -BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) - -# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images. -# This variable is used to construct full image tags for bundle and catalog images. -# -# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both -# %[1]s/%[2]s-bundle:$VERSION and %[1]s/%[2]s-catalog:$VERSION. -IMAGE_TAG_BASE ?= %[1]s/%[2]s - -# BUNDLE_IMG defines the image:tag used for the bundle. -# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=/:) -BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) -` -) diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/init.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/init.go deleted file mode 100644 index fce19a81a..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/init.go +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package v1 - -import ( - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds" - "github.com/spf13/pflag" - "k8s.io/apimachinery/pkg/util/validation" - - "sigs.k8s.io/kubebuilder/v3/pkg/config" - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - "sigs.k8s.io/kubebuilder/v3/pkg/plugin" -) - -// This file represents the CLI for this plugin. - -const ( - groupFlag = "group" - versionFlag = "version" - kindFlag = "kind" -) - -type initSubcommand struct { - apiSubcommand createAPISubcommand - - config config.Config - - // For help text. - commandName string - - // Flags - group string - domain string - version string - kind string - projectName string -} - -var ( - _ plugin.InitSubcommand = &initSubcommand{} -) - -func (p *initSubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdMeta *plugin.SubcommandMetadata) { - subcmdMeta.Description = `Initialize a new project based on the java-operator-sdk project. - -Writes the following files: -- a basic, Quarkus-based operator set-up -- a pom.xml file to build the project with Maven -` - p.commandName = cliMeta.CommandName -} - -func (p *initSubcommand) BindFlags(fs *pflag.FlagSet) { - //// TODO: include flags required for this plugin - - fs.SortFlags = false - fs.StringVar(&p.domain, "domain", "my.domain", "domain for groups") - fs.StringVar(&p.projectName, "project-name", "", "name of this project, the default being directory name") - - fs.StringVar(&p.group, groupFlag, "", "resource Group") - fs.StringVar(&p.version, versionFlag, "", "resource Version") - fs.StringVar(&p.kind, kindFlag, "", "resource Kind") - p.apiSubcommand.BindFlags(fs) -} - -func (p *initSubcommand) InjectConfig(c config.Config) error { - p.config = c - - if err := p.config.SetDomain(p.domain); err != nil { - return err - } - - // Assign a default project name - if p.projectName == "" { - dir, err := os.Getwd() - if err != nil { - return fmt.Errorf("error getting current directory: %v", err) - } - p.projectName = strings.ToLower(filepath.Base(dir)) - } - // Check if the project name is a valid k8s namespace (DNS 1123 label). - if err := validation.IsDNS1123Label(p.projectName); err != nil { - return fmt.Errorf("project name (%s) is invalid: %v", p.projectName, err) - } - if err := p.config.SetProjectName(p.projectName); err != nil { - return err - } - - return nil -} - -func (p *initSubcommand) Validate() error { - // TODO: validate the conditions you expect before running the plugin - return nil -} - -func (p *initSubcommand) PostScaffold() error { - // print follow on instructions to better guide the user - fmt.Printf("Next: define a resource with:\n$ %s create api\n", p.commandName) - return nil -} - -func (p *initSubcommand) Scaffold(fs machinery.Filesystem) error { - scaffolder := scaffolds.NewInitScaffolder(p.config) - scaffolder.InjectFS(fs) - return scaffolder.Scaffold() -} diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/plugin.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/plugin.go deleted file mode 100644 index 7ca70c528..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/plugin.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package v1 - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/config" - v3 "sigs.k8s.io/kubebuilder/v3/pkg/config/v3" - "sigs.k8s.io/kubebuilder/v3/pkg/model/stage" - "sigs.k8s.io/kubebuilder/v3/pkg/plugin" -) - -const pluginName = "quarkus.javaoperatorsdk.io" - -var ( - supportedProjectVersions = []config.Version{v3.Version} - pluginVersion = plugin.Version{Number: 1, Stage: stage.Beta} -) - -var ( - // TODO: if we use all the full interface this could be changed to - // _ plugin.Full = Plugin{} - _ plugin.Plugin = Plugin{} - _ plugin.Init = Plugin{} - _ plugin.CreateAPI = Plugin{} -) - -// Plugin implements the plugin.Full interface -type Plugin struct { - initSubcommand - createAPISubcommand - // createWebhookSubcommand - // editSubcommand -} - -// Name returns the name of the plugin -func (Plugin) Name() string { return pluginName } - -// Version returns the version of the plugin -func (Plugin) Version() plugin.Version { return pluginVersion } - -// SupportedProjectVersions returns an array with all project versions supported by the plugin -func (Plugin) SupportedProjectVersions() []config.Version { return supportedProjectVersions } - -// GetInitSubcommand will return the subcommand which is responsible for initializing and common scaffolding -func (p Plugin) GetInitSubcommand() plugin.InitSubcommand { return &p.initSubcommand } - -// GetCreateAPISubcommand will return the subcommand which is responsible for scaffolding apis -func (p Plugin) GetCreateAPISubcommand() plugin.CreateAPISubcommand { return &p.createAPISubcommand } - -// // GetCreateWebhookSubcommand will return the subcommand which is responsible for scaffolding webhooks -// func (p Plugin) GetCreateWebhookSubcommand() plugin.CreateWebhookSubcommand { -// return &p.createWebhookSubcommand -// } - -// // GetEditSubcommand will return the subcommand which is responsible for editing the scaffold of the project -// func (p Plugin) GetEditSubcommand() plugin.EditSubcommand { return &p.editSubcommand } diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/api.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/api.go deleted file mode 100644 index fec7eee3b..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/api.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package scaffolds - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/config" - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - "sigs.k8s.io/kubebuilder/v3/pkg/model/resource" - "sigs.k8s.io/kubebuilder/v3/pkg/plugins" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/controller" - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model" - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/util" -) - -type apiScaffolder struct { - fs machinery.Filesystem - - config config.Config - resource resource.Resource -} - -// NewCreateAPIScaffolder returns a new plugins.Scaffolder for project initialization operations -func NewCreateAPIScaffolder(cfg config.Config, res resource.Resource) plugins.Scaffolder { - return &apiScaffolder{ - config: cfg, - resource: res, - } -} - -func (s *apiScaffolder) InjectFS(fs machinery.Filesystem) { - s.fs = fs -} - -func (s *apiScaffolder) Scaffold() error { - - if err := s.config.UpdateResource(s.resource); err != nil { - return err - } - - // Initialize the machinery.Scaffold that will write the files to disk - scaffold := machinery.NewScaffold(s.fs, - // NOTE: kubebuilder's default permissions are only for root users - machinery.WithDirectoryPermissions(0755), - machinery.WithFilePermissions(0644), - machinery.WithConfig(s.config), - machinery.WithResource(&s.resource), - ) - - var createAPITemplates []machinery.Builder - createAPITemplates = append(createAPITemplates, - &model.Model{ - Package: util.ReverseDomain(util.SanitizeDomain(s.config.GetDomain())), - ClassName: util.ToClassname(s.resource.Kind), - }, - &model.ModelSpec{ - Package: util.ReverseDomain(util.SanitizeDomain(s.config.GetDomain())), - ClassName: util.ToClassname(s.resource.Kind), - }, - &model.ModelStatus{ - Package: util.ReverseDomain(util.SanitizeDomain(s.config.GetDomain())), - ClassName: util.ToClassname(s.resource.Kind), - }, - &controller.Controller{ - Package: util.ReverseDomain(util.SanitizeDomain(s.config.GetDomain())), - ClassName: util.ToClassname(s.resource.Kind), - }, - ) - - return scaffold.Execute(createAPITemplates...) -} diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/doc.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/doc.go deleted file mode 100644 index fa8016fcb..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package scaffolds will likely contain the files used to scaffold the files for specific commands. -*/ -package scaffolds diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/init.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/init.go deleted file mode 100644 index 08ce49a0d..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/init.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package scaffolds - -import ( - "os" - "path/filepath" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/util" - "sigs.k8s.io/kubebuilder/v3/pkg/config" - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates" - "sigs.k8s.io/kubebuilder/v3/pkg/plugins" -) - -const ( - // kustomizeVersion is the sigs.k8s.io/kustomize version to be used in the project - kustomizeVersion = "v3.5.4" - - imageName = "controller:latest" -) - -// This file represents the scaffolding done by this init command - -var _ plugins.Scaffolder = &initScaffolder{} - -type initScaffolder struct { - fs machinery.Filesystem - config config.Config -} - -// NewInitScaffolder returns a new plugins.Scaffolder for project initialization operations -func NewInitScaffolder(config config.Config) plugins.Scaffolder { - return &initScaffolder{ - config: config, - } -} - -// InjectFS implements Scaffolder -func (s *initScaffolder) InjectFS(fs machinery.Filesystem) { - s.fs = fs -} - -// Scaffold implements Scaffolder -func (s *initScaffolder) Scaffold() error { - // Initialize the machinery.Scaffold that will write the files to disk - scaffold := machinery.NewScaffold(s.fs, - // NOTE: kubebuilder's default permissions are only for root users - machinery.WithDirectoryPermissions(0755), - machinery.WithFilePermissions(0644), - machinery.WithConfig(s.config), - ) - - path := filepath.Join("src", "main", "java") - - if err := os.MkdirAll(path, 0755); err != nil { - return err - } - return scaffold.Execute( - &templates.PomXmlFile{ - Package: util.ReverseDomain(util.SanitizeDomain(s.config.GetDomain())), - ProjectName: s.config.GetProjectName(), - OperatorVersion: "0.0.1", - }, - &templates.GitIgnore{}, - &templates.ApplicationPropertiesFile{ - ProjectName: s.config.GetProjectName(), - }, - &templates.Makefile{ - Image: "", - KustomizeVersion: "v3.5.4", - }, - ) -} diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/applicationproperties.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/applicationproperties.go deleted file mode 100644 index 15a3b0aeb..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/applicationproperties.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package templates - -import ( - "fmt" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util" -) - -var _ machinery.Template = &ApplicationPropertiesFile{} - -type ApplicationPropertiesFile struct { - machinery.TemplateMixin - OrgName string - ProjectName string -} - -func (f *ApplicationPropertiesFile) SetTemplateDefaults() error { - if f.ProjectName == "" { - return fmt.Errorf("invalid Application Properties name") - } - - if f.Path == "" { - f.Path = util.PrependResourcePath("application.properties") - } - - f.TemplateBody = ApplicationPropertiesTemplate - - return nil -} - -const ApplicationPropertiesTemplate = `quarkus.container-image.build=true -#quarkus.container-image.group= -quarkus.container-image.name={{ .ProjectName }}-operator - -# Set to false to prevent CRDs from being applied to the cluster automatically (only applies to dev mode, CRD applying is disabled in prod) -# See https://docs.quarkiverse.io/quarkus-operator-sdk/dev/index.html#extension-configuration-reference for the complete list of available configuration options -# quarkus.operator-sdk.crd.apply=false - -# Uncomment this to prevent the client from trusting self-signed certificates (mostly useful when using a local cluster for testing) -# See https://quarkus.io/guides/kubernetes-client#configuration-reference for the complete list of Quarkus Kubernetes client configuration options -# quarkus.kubernetes-client.trust-certs=false -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/controller/controller.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/controller/controller.go deleted file mode 100644 index 96a1ebb9d..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/controller/controller.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package controller - -import ( - "fmt" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util" -) - -var _ machinery.Template = &Controller{} - -type Controller struct { - machinery.TemplateMixin - - // Package is the source files package - Package string - - // Name of the operator used for the main file. - ClassName string -} - -func (f *Controller) SetTemplateDefaults() error { - if f.ClassName == "" { - return fmt.Errorf("invalid model name") - } - - if f.Path == "" { - f.Path = util.PrependJavaPath(f.ClassName+"Reconciler.java", util.AsPath(f.Package)) - } - - f.TemplateBody = controllerTemplate - - return nil -} - -const controllerTemplate = `package {{ .Package }}; - -import io.fabric8.kubernetes.client.KubernetesClient; -import io.javaoperatorsdk.operator.api.reconciler.Context; -import io.javaoperatorsdk.operator.api.reconciler.Reconciler; -import io.javaoperatorsdk.operator.api.reconciler.UpdateControl; - -public class {{ .ClassName }}Reconciler implements Reconciler<{{ .ClassName }}> { - private final KubernetesClient client; - - public {{ .ClassName }}Reconciler(KubernetesClient client) { - this.client = client; - } - - // TODO Fill in the rest of the reconciler - - @Override - public UpdateControl<{{ .ClassName }}> reconcile({{ .ClassName }} resource, Context context) { - // TODO: fill in logic - - return UpdateControl.noUpdate(); - } -} - -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/doc.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/doc.go deleted file mode 100644 index 739de41fa..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package templates contains the files which have templates for the files being output by the scaffolders. -*/ -package templates diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/gitignore.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/gitignore.go deleted file mode 100644 index f5d0c4d58..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/gitignore.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package templates - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &GitIgnore{} - -// GitIgnore scaffolds the .gitignore file -type GitIgnore struct { - machinery.TemplateMixin -} - -// SetTemplateDefaults implements input.Template -func (f *GitIgnore) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = ".gitignore" - } - - f.TemplateBody = gitignoreTemplate - - return nil -} - -const gitignoreTemplate = ` -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib -bin -target - -# editor and IDE paraphernalia -.idea -*.swp -*.swo -*~ -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/makefile.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/makefile.go deleted file mode 100644 index 177047913..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/makefile.go +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package templates - -import ( - "errors" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &Makefile{} - -// Makefile scaffolds the Makefile -type Makefile struct { - machinery.TemplateMixin - - // Image is controller manager image name - Image string - - // OS is the operating system to use for building the image - OS string - - // Arch is the architecture to use for building the image - Arch string - - // Kustomize version to use in the project - KustomizeVersion string - - // // AnsibleOperatorVersion is the version of the ansible-operator binary downloaded by the Makefile. - // AnsibleOperatorVersion string -} - -// SetTemplateDefaults implements machinery.Template -func (f *Makefile) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = "Makefile" - } - - f.TemplateBody = makefileTemplate - - f.IfExistsAction = machinery.Error - - if f.Image == "" { - f.Image = "controller:latest" - } - - if f.OS == "" && f.Arch == "" { - // Default OS/Arch to linux/amd64 - f.OS = "linux" - f.Arch = "amd64" - } else if f.OS == "" || f.Arch == "" { - // Require both OS and Arch - return errors.New("Both OS and Arch are required to be set if not using default") - } - - if f.KustomizeVersion == "" { - return errors.New("kustomize version is required in scaffold") - } - - // if f.AnsibleOperatorVersion == "" { - // return errors.New("ansible-operator version is required in scaffold") - // } - - return nil -} - -const makefileTemplate = ` -# Image URL to use for all building/pushing image targets -IMG ?= {{ .Image }} -# Operating system and architecture to use for building image -OS ?= {{ .OS }} -ARCH ?= {{ .Arch }} - -all: docker-build - -##@ General - -# The help target prints out all targets with their descriptions organized -# beneath their categories. The categories are represented by '##@' and the -# target descriptions by '##'. The awk commands is responsible for reading the -# entire set of makefiles included in this invocation, looking for lines of the -# file as xyz: ## something, and then pretty-format the target and help. Then, -# if there's a line with ##@ something, that gets pretty-printed as a category. -# More info on the usage of ANSI control characters for terminal formatting: -# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters -# More info on the awk command: -# http://linuxcommand.org/lc3_adv_awk.php - -help: ## Display this help. - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) - -##@ Build - -docker-build: ## Build docker image with the manager. - mvn package -Dquarkus.container-image.build=true -Dquarkus.container-image.builder=docker -Dquarkus.container-image.image=${IMG} -Dquarkus.docker.buildx.platform=${OS}/${ARCH} - -docker-push: ## Push docker image with the manager. - mvn package -Dquarkus.container-image.push=true -Dquarkus.container-image.image=${IMG} - -##@ Deployment - -install: ## Install CRDs into the K8s cluster specified in ~/.kube/config. - @$(foreach file, $(wildcard target/kubernetes/*-v1.yml), kubectl apply -f $(file);) - -uninstall: ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. - @$(foreach file, $(wildcard target/kubernetes/*-v1.yml), kubectl delete -f $(file);) - -deploy: ## Deploy controller to the K8s cluster specified in ~/.kube/config. - kubectl apply -f target/kubernetes/kubernetes.yml - -undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. - kubectl delete -f target/kubernetes/kubernetes.yml -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/model.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/model.go deleted file mode 100644 index fcf367985..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/model.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package model - -import ( - "fmt" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util" -) - -var _ machinery.Template = &Model{} - -type Model struct { - machinery.TemplateMixin - machinery.ResourceMixin - - // Package is the source files package - Package string - - // Name of the operator used for the main file. - ClassName string -} - -func (f *Model) SetTemplateDefaults() error { - if f.ClassName == "" { - return fmt.Errorf("invalid model name") - } - - if f.Path == "" { - f.Path = util.PrependJavaPath(f.ClassName+".java", util.AsPath(f.Package)) - } - - f.TemplateBody = modelTemplate - - return nil -} - -const modelTemplate = `package {{ .Package }}; - -{{if .Resource.API.Namespaced}}import io.fabric8.kubernetes.api.model.Namespaced;{{end}} -import io.fabric8.kubernetes.client.CustomResource; -import io.fabric8.kubernetes.model.annotation.Group; -import io.fabric8.kubernetes.model.annotation.Version; - -@Version("{{ .Resource.Version }}") -@Group("{{ .Resource.QualifiedGroup }}") -public class {{ .ClassName }} extends CustomResource<{{ .ClassName }}Spec, {{ .ClassName }}Status> {{if .Resource.API.Namespaced}}implements Namespaced {{end}}{} - -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/modelspec.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/modelspec.go deleted file mode 100644 index fd6d82f67..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/modelspec.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package model - -import ( - "fmt" - - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util" -) - -var _ machinery.Template = &ModelSpec{} - -type ModelSpec struct { - machinery.TemplateMixin - - // Package is the source files package - Package string - - // Name of the operator used for the main file. - ClassName string -} - -func (f *ModelSpec) SetTemplateDefaults() error { - if f.ClassName == "" { - return fmt.Errorf("invalid operator name") - } - - if f.Path == "" { - f.Path = util.PrependJavaPath(f.ClassName+"Spec.java", util.AsPath(f.Package)) - } - - f.TemplateBody = modelSpecTemplate - - return nil -} - -// TODO: pass in the name of the operator i.e. replace Memcached -const modelSpecTemplate = `package {{ .Package }}; - -public class {{ .ClassName }}Spec { - - // Add Spec information here -} -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/modelstatus.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/modelstatus.go deleted file mode 100644 index 9fb5b8042..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model/modelstatus.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package model - -import ( - "fmt" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util" - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &ModelStatus{} - -type ModelStatus struct { - machinery.TemplateMixin - - // Package is the source files package - Package string - - // Name of the operator used for the main file. - ClassName string -} - -func (f *ModelStatus) SetTemplateDefaults() error { - if f.ClassName == "" { - return fmt.Errorf("invalid operator name") - } - - if f.Path == "" { - f.Path = util.PrependJavaPath(f.ClassName+"Status.java", util.AsPath(f.Package)) - } - - f.TemplateBody = modelStatusTemplate - - return nil -} - -// TODO: pass in the name of the operator i.e. replace Memcached -const modelStatusTemplate = `package {{ .Package }}; - -public class {{ .ClassName }}Status { - - // Add Status information here -} -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/operatorfile.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/operatorfile.go deleted file mode 100644 index 1c5f0287d..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/operatorfile.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package templates - -import ( - "fmt" - "strings" - - "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util" - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &OperatorFile{} - -type OperatorFile struct { - machinery.TemplateMixin - - // Package is the source files package - Package string - - // Name of the operator used for the main file. - OperatorName string -} - -func (f *OperatorFile) SetTemplateDefaults() error { - if f.OperatorName == "" { - return fmt.Errorf("invalid operator name") - } - - if strings.HasSuffix(f.OperatorName, "Operator") { - f.OperatorName = strings.TrimSuffix(f.OperatorName, "Operator") - } - - if f.Path == "" { - f.Path = util.PrependJavaPath(f.OperatorName+"Operator.java", util.AsPath(f.Package)) - } - - f.TemplateBody = operatorTemplate - - return nil -} - -// TODO: pass in the name of the operator i.e. replace Memcached -const operatorTemplate = ` -package {{ .Package }}; - -import io.javaoperatorsdk.operator.Operator; -import io.quarkus.runtime.Quarkus; -import io.quarkus.runtime.QuarkusApplication; -import io.quarkus.runtime.annotations.QuarkusMain; -import javax.inject.Inject; - -@QuarkusMain -public class {{ .OperatorName }}Operator implements QuarkusApplication { - - @Inject Operator operator; - - public static void main(String... args) { - Quarkus.run({{ .OperatorName }}Operator.class, args); - } - - @Override - public int run(String... args) throws Exception { - operator.start(); - - Quarkus.waitForExit(); - return 0; - } -} -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/pomxml.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/pomxml.go deleted file mode 100644 index cf2a48287..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/pomxml.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package templates - -import ( - "sigs.k8s.io/kubebuilder/v3/pkg/machinery" -) - -var _ machinery.Template = &PomXmlFile{} - -type PomXmlFile struct { - machinery.TemplateMixin - - // Package is the source files package - Package string - ProjectName string - OperatorVersion string -} - -func (f *PomXmlFile) SetTemplateDefaults() error { - if f.Path == "" { - f.Path = "pom.xml" - } - - f.TemplateBody = pomxmlTemplate - - return nil -} - -// TODO: pass in the name of the operator i.e. replace Memcached -const pomxmlTemplate = ` - - 4.0.0 - {{ .Package }} - {{ .ProjectName }} - {{ .ProjectName }} - {{ .OperatorVersion }}-SNAPSHOT - jar - - 3.10.1 - true - 17 - 17 - UTF-8 - UTF-8 - 6.7.1 - 3.11.0 - - - - - - io.quarkiverse.operatorsdk - quarkus-operator-sdk-bom - ${quarkus-sdk.version} - pom - import - - - - - - io.quarkiverse.operatorsdk - quarkus-operator-sdk - - - - io.quarkiverse.operatorsdk - quarkus-operator-sdk-bundle-generator - - - io.quarkus - quarkus-micrometer-registry-prometheus - ${quarkus.version} - - - - - - - io.quarkus - quarkus-maven-plugin - ${quarkus.version} - - - - build - - - - - - maven-compiler-plugin - ${compiler-plugin.version} - - - - - - - native - - native - - - - - -` diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util/file.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util/file.go deleted file mode 100644 index 06c129fa2..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util/file.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package util - -import ( - "path/filepath" - "strings" -) - -const ( - filePathSep = string(filepath.Separator) - javaPath = "src" + filePathSep + "main" + filePathSep + "java" - resourcePath = "src" + filePathSep + "main" + filePathSep + "resources" -) - -func PrependJavaPath(filename string, pkg string) string { - return javaPath + filePathSep + pkg + filePathSep + filename -} - -func PrependResourcePath(filename string) string { - return resourcePath + filePathSep + filename -} - -func AsPath(s string) string { - return strings.ReplaceAll(s, ".", filePathSep) -} diff --git a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/util/util.go b/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/util/util.go deleted file mode 100644 index e05a44684..000000000 --- a/tools/vendor/github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/util/util.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2021 The Operator-SDK Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package util - -import ( - "fmt" - "strings" -) - -var ( - wordMapping = map[string]string{ - "http": "HTTP", - "url": "URL", - "ip": "IP", - } - - javaKeywords = map[string]int8{ - "abstract": 0, - "assert": 0, - "boolean": 0, - "break": 0, - "byte": 0, - "case": 0, - "catch": 0, - "char": 0, - "class": 0, - "const": 0, - "continue": 0, - "default": 0, - "do": 0, - "double": 0, - "else": 0, - "enum": 0, - "extends": 0, - "final": 0, - "finally": 0, - "float": 0, - "for": 0, - "goto": 0, - "if": 0, - "implements": 0, - "import": 0, - "instanceof": 0, - "int": 0, - "interface": 0, - "long": 0, - "native": 0, - "new": 0, - "package": 0, - "private": 0, - "protected": 0, - "public": 0, - "return": 0, - "short": 0, - "static": 0, - "strictfp": 0, - "super": 0, - "switch": 0, - "synchronized": 0, - "this": 0, - "throw": 0, - "throws": 0, - "transient": 0, - "try": 0, - "void": 0, - "volatile": 0, - "while": 0, - } -) - -func translateWord(word string, initCase bool) string { - if val, ok := wordMapping[word]; ok { - return val - } - if initCase { - return strings.Title(word) - } - return word -} - -func ReverseDomain(domain string) string { - s := strings.Split(domain, ".") - - for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { - s[i], s[j] = s[j], s[i] - } - - return strings.Join(s, ".") -} - -// Converts a string to CamelCase -func ToCamel(s string) string { - // s = addWordBoundariesToNumbers(s) - s = strings.Trim(s, " ") - n := "" - bits := []string{} - for _, v := range s { - if v == '_' || v == ' ' || v == '-' { - bits = append(bits, n) - n = "" - } else { - n += string(v) - } - } - bits = append(bits, n) - - ret := "" - for i, substr := range bits { - ret += translateWord(substr, i != 0) - } - return ret -} - -func ToClassname(s string) string { - return translateWord(ToCamel(s), true) -} - -func SanitizeDomain(domain string) string { - // Split into the domain portions via "." - domainSplit := strings.Split(domain, ".") - - // Loop through each portion of the domain - for i, domainPart := range domainSplit { - // If there are hyphens, replace with underscore - if strings.Contains(domainPart, "-") { - fmt.Printf("\ndomain portion (%s) contains hyphens ('-') and needs to be sanitized to create a legal Java package name. Replacing all hyphens with underscores ('_')\n", domainPart) - domainSplit[i] = strings.ReplaceAll(domainPart, "-", "_") - } - - // If any portion includes a keyword, replace with keyword_ - if _, ok := javaKeywords[domainPart]; ok { - fmt.Printf("\ndomain portion (%s) is a Java keyword and needs to be sanitized to create a legal Java package name. Adding an underscore ('_') to the end of the domain portion\n", domainPart) - domainSplit[i] = domainPart + "_" - } - - // If any portion starts with number, make it start with underscore - if domainPart != "" && domainPart[0] >= '0' && domainPart[0] <= '9' { - fmt.Printf("\ndomain portion(%s) begins with a digit and needs to be sanitized to create a legal Java package name. Adding an underscore('_') to the beginning of the domain portion\n", domainPart) - domainSplit[i] = "_" + domainPart - } - - } - - return strings.Join(domainSplit, ".") -} diff --git a/tools/vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli/cli.go b/tools/vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli/cli.go index 4d6e7ab8d..d0f00199c 100644 --- a/tools/vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli/cli.go +++ b/tools/vendor/github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cli/cli.go @@ -15,8 +15,6 @@ package cli import ( - hybrid "github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha" - quarkusv1 "github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta" log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -139,17 +137,6 @@ func GetPluginsCLIAndRoot() (*cli.CLI, *cobra.Command) { ), ) - hybridBundle, _ := plugin.NewBundleWithOptions( - plugin.WithName("hybrid.helm"+plugins.DefaultNameQualifier), - plugin.WithVersion(plugin.Version{Number: 1, Stage: stage.Alpha}), - plugin.WithPlugins( - kustomizev2.Plugin{}, - hybrid.Plugin{}, - manifestsv2.Plugin{}, - scorecardv2.Plugin{}, - ), - ) - deployImageBundle, _ := plugin.NewBundleWithOptions( plugin.WithName("deploy-image."+golang.DefaultNameQualifier), plugin.WithVersion(plugin.Version{Number: 1, Stage: stage.Alpha}), @@ -167,11 +154,9 @@ func GetPluginsCLIAndRoot() (*cli.CLI, *cobra.Command) { gov3Bundle, // Deprecated gov4Bundle, helmBundle, - hybridBundle, grafanav1alpha.Plugin{}, deployImageBundle, declarativev1.Plugin{}, - &quarkusv1.Plugin{}, ), cli.WithDefaultPlugins(cfgv2.Version, gov2Bundle), cli.WithDefaultPlugins(cfgv3.Version, gov4Bundle), diff --git a/tools/vendor/github.com/operator-framework/operator-sdk/internal/util/projutil/project_util.go b/tools/vendor/github.com/operator-framework/operator-sdk/internal/util/projutil/project_util.go index 149ec1e84..b8efb3d28 100644 --- a/tools/vendor/github.com/operator-framework/operator-sdk/internal/util/projutil/project_util.go +++ b/tools/vendor/github.com/operator-framework/operator-sdk/internal/util/projutil/project_util.go @@ -54,8 +54,6 @@ const ( OperatorTypeAnsible OperatorType = "ansible" // OperatorTypeHelm - helm type of operator. OperatorTypeHelm OperatorType = "helm" - // OperatorTypeHybrid - hybrid type of operator. - operatorTypeHybridHelm OperatorType = "hybridHelm" // OperatorTypeUnknown - unknown type of operator. OperatorTypeUnknown OperatorType = "unknown" ) @@ -106,8 +104,6 @@ func PluginChainToOperatorType(pluginKeys []string) OperatorType { return OperatorTypeHelm case strings.HasPrefix(pluginKey, "ansible"): return OperatorTypeAnsible - case strings.HasPrefix(pluginKey, "hybrid"): - return operatorTypeHybridHelm } } return OperatorTypeUnknown diff --git a/tools/vendor/modules.txt b/tools/vendor/modules.txt index 60b777ae6..2347ff8c0 100644 --- a/tools/vendor/modules.txt +++ b/tools/vendor/modules.txt @@ -221,7 +221,7 @@ github.com/davecgh/go-spew/spew # github.com/distribution/reference v0.6.0 ## explicit; go 1.20 github.com/distribution/reference -# github.com/docker/cli v25.0.5+incompatible +# github.com/docker/cli v27.2.0+incompatible ## explicit github.com/docker/cli/cli/config github.com/docker/cli/cli/config/configfile @@ -239,13 +239,12 @@ github.com/docker/distribution/registry/client/auth/challenge github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory -# github.com/docker/docker v25.0.5+incompatible +# github.com/docker/docker v27.2.0+incompatible ## explicit github.com/docker/docker/api/types/filters github.com/docker/docker/api/types/registry github.com/docker/docker/api/types/versions github.com/docker/docker/errdefs -github.com/docker/docker/pkg/homedir github.com/docker/docker/pkg/ioutils github.com/docker/docker/registry # github.com/docker/docker-credential-helpers v0.8.0 @@ -636,8 +635,8 @@ github.com/opencontainers/go-digest ## explicit; go 1.18 github.com/opencontainers/image-spec/specs-go github.com/opencontainers/image-spec/specs-go/v1 -# github.com/opencontainers/runc v1.1.12 -## explicit; go 1.17 +# github.com/opencontainers/runc v1.1.14 +## explicit; go 1.18 github.com/opencontainers/runc/libcontainer/user # github.com/opencontainers/runtime-spec v1.1.0 ## explicit @@ -674,24 +673,6 @@ github.com/operator-framework/api/pkg/validation github.com/operator-framework/api/pkg/validation/errors github.com/operator-framework/api/pkg/validation/interfaces github.com/operator-framework/api/pkg/validation/internal -# github.com/operator-framework/helm-operator-plugins v0.2.2 -## explicit; go 1.21 -github.com/operator-framework/helm-operator-plugins/pkg/plugins/helm/v1/chartutil -github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha -github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds -github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates -github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/hack -github.com/operator-framework/helm-operator-plugins/pkg/plugins/hybrid/v1alpha/scaffolds/internal/templates/rbac -github.com/operator-framework/helm-operator-plugins/pkg/plugins/util -# github.com/operator-framework/java-operator-plugins v0.10.0 -## explicit; go 1.21 -github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta -github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds -github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates -github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/controller -github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/model -github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/scaffolds/internal/templates/util -github.com/operator-framework/java-operator-plugins/pkg/quarkus/v1beta/util # github.com/operator-framework/operator-manifest-tools v0.6.0 ## explicit; go 1.21 github.com/operator-framework/operator-manifest-tools/internal/utils @@ -717,7 +698,7 @@ github.com/operator-framework/operator-registry/pkg/prettyunmarshaler github.com/operator-framework/operator-registry/pkg/registry github.com/operator-framework/operator-registry/pkg/sqlite github.com/operator-framework/operator-registry/pkg/sqlite/migrations -# github.com/operator-framework/operator-sdk v1.36.1 +# github.com/operator-framework/operator-sdk v1.37.0 ## explicit; go 1.21 github.com/operator-framework/operator-sdk/cmd/operator-sdk github.com/operator-framework/operator-sdk/internal/annotations/metrics From 1ac6ecead6ef77ad4d0711e3d5a7b402a0236f74 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:27:50 +0000 Subject: [PATCH 2/3] vendor: bump google.golang.org/grpc in the golang-dependencies group Bumps the golang-dependencies group with 1 update: [google.golang.org/grpc](https://github.com/grpc/grpc-go). Updates `google.golang.org/grpc` from 1.66.2 to 1.67.0 - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.66.2...v1.67.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor dependency-group: golang-dependencies ... Signed-off-by: dependabot[bot] --- go.mod | 6 +- go.sum | 12 +-- vendor/golang.org/x/oauth2/LICENSE | 4 +- .../grpc/balancer/base/balancer.go | 4 +- .../grpc/balancer/pickfirst/pickfirst.go | 2 +- .../grpc/balancer_wrapper.go | 6 +- .../grpc_binarylog_v1/binarylog.pb.go | 22 ++--- .../grpc/credentials/insecure/insecure.go | 2 +- vendor/google.golang.org/grpc/dialoptions.go | 2 + .../grpc/grpclog/internal/logger.go | 2 +- .../grpc/internal/binarylog/method_logger.go | 2 +- .../grpc/internal/channelz/channelmap.go | 7 -- .../grpc/internal/channelz/funcs.go | 2 +- .../internal/channelz/syscall_nonlinux.go | 4 +- .../grpc/internal/envconfig/envconfig.go | 2 +- .../grpc/internal/internal.go | 4 +- .../resolver/passthrough/passthrough.go | 2 +- .../grpc/internal/status/status.go | 4 +- .../grpc/internal/syscall/syscall_nonlinux.go | 6 +- .../grpc/internal/transport/controlbuf.go | 7 -- .../grpc/internal/transport/handler_server.go | 4 +- .../grpc/internal/transport/http2_client.go | 18 ++-- .../grpc/internal/transport/http2_server.go | 4 +- .../grpc/internal/transport/http_util.go | 2 +- .../grpc/keepalive/keepalive.go | 20 ++++- vendor/google.golang.org/grpc/mem/buffers.go | 4 +- vendor/google.golang.org/grpc/rpc_util.go | 34 ++++---- .../grpc/stream_interfaces.go | 86 +++++++++++++++++++ vendor/google.golang.org/grpc/version.go | 2 +- vendor/modules.txt | 8 +- 30 files changed, 182 insertions(+), 102 deletions(-) diff --git a/go.mod b/go.mod index 9a30c809e..b331a5711 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( // manually pin otelgrpc to v0.46.0, until it is addresses in csi-lib-utils upstream go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect go.uber.org/zap v1.27.0 - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.0 google.golang.org/protobuf v1.34.2 k8s.io/api v0.31.1 k8s.io/apimachinery v0.31.1 @@ -70,14 +70,14 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.23.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.24.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index ba78e4451..81473f370 100644 --- a/go.sum +++ b/go.sum @@ -146,8 +146,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -176,10 +176,10 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/vendor/golang.org/x/oauth2/LICENSE b/vendor/golang.org/x/oauth2/LICENSE index 6a66aea5e..2a7cf70da 100644 --- a/vendor/golang.org/x/oauth2/LICENSE +++ b/vendor/golang.org/x/oauth2/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index a7f1eeec8..2b87bd79c 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -36,7 +36,7 @@ type baseBuilder struct { config Config } -func (bb *baseBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { +func (bb *baseBuilder) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer { bal := &baseBalancer{ cc: cc, pickerBuilder: bb.pickerBuilder, @@ -259,6 +259,6 @@ type errPicker struct { err error // Pick() always returns this err. } -func (p *errPicker) Pick(info balancer.PickInfo) (balancer.PickResult, error) { +func (p *errPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { return balancer.PickResult{}, p.err } diff --git a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go index 5b592f48a..4d69b4052 100644 --- a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go +++ b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go @@ -50,7 +50,7 @@ const ( type pickfirstBuilder struct{} -func (pickfirstBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { +func (pickfirstBuilder) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer { b := &pickfirstBalancer{cc: cc} b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b)) return b diff --git a/vendor/google.golang.org/grpc/balancer_wrapper.go b/vendor/google.golang.org/grpc/balancer_wrapper.go index 6561b769e..8ad6ce2f0 100644 --- a/vendor/google.golang.org/grpc/balancer_wrapper.go +++ b/vendor/google.golang.org/grpc/balancer_wrapper.go @@ -192,7 +192,7 @@ func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer return acbw, nil } -func (ccb *ccBalancerWrapper) RemoveSubConn(sc balancer.SubConn) { +func (ccb *ccBalancerWrapper) RemoveSubConn(balancer.SubConn) { // The graceful switch balancer will never call this. logger.Errorf("ccb RemoveSubConn(%v) called unexpectedly, sc") } @@ -342,8 +342,8 @@ func (acbw *acBalancerWrapper) GetOrBuildProducer(pb balancer.ProducerBuilder) ( pData := acbw.producers[pb] if pData == nil { // Not found; create a new one and add it to the producers map. - p, close := pb.Build(acbw) - pData = &refCountedProducer{producer: p, close: close} + p, closeFn := pb.Build(acbw) + pData = &refCountedProducer{producer: p, close: closeFn} acbw.producers[pb] = pData } // Account for this new reference. diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index fcd1cfe80..55bffaa77 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -18,7 +18,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 +// protoc-gen-go v1.34.2 // protoc v5.27.1 // source: grpc/binlog/v1/binarylog.proto @@ -1015,7 +1015,7 @@ func file_grpc_binlog_v1_binarylog_proto_rawDescGZIP() []byte { var file_grpc_binlog_v1_binarylog_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_grpc_binlog_v1_binarylog_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_grpc_binlog_v1_binarylog_proto_goTypes = []interface{}{ +var file_grpc_binlog_v1_binarylog_proto_goTypes = []any{ (GrpcLogEntry_EventType)(0), // 0: grpc.binarylog.v1.GrpcLogEntry.EventType (GrpcLogEntry_Logger)(0), // 1: grpc.binarylog.v1.GrpcLogEntry.Logger (Address_Type)(0), // 2: grpc.binarylog.v1.Address.Type @@ -1058,7 +1058,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_grpc_binlog_v1_binarylog_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*GrpcLogEntry); i { case 0: return &v.state @@ -1070,7 +1070,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*ClientHeader); i { case 0: return &v.state @@ -1082,7 +1082,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*ServerHeader); i { case 0: return &v.state @@ -1094,7 +1094,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*Trailer); i { case 0: return &v.state @@ -1106,7 +1106,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*Message); i { case 0: return &v.state @@ -1118,7 +1118,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*Metadata); i { case 0: return &v.state @@ -1130,7 +1130,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*MetadataEntry); i { case 0: return &v.state @@ -1142,7 +1142,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { return nil } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_grpc_binlog_v1_binarylog_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*Address); i { case 0: return &v.state @@ -1155,7 +1155,7 @@ func file_grpc_binlog_v1_binarylog_proto_init() { } } } - file_grpc_binlog_v1_binarylog_proto_msgTypes[0].OneofWrappers = []interface{}{ + file_grpc_binlog_v1_binarylog_proto_msgTypes[0].OneofWrappers = []any{ (*GrpcLogEntry_ClientHeader)(nil), (*GrpcLogEntry_ServerHeader)(nil), (*GrpcLogEntry_Message)(nil), diff --git a/vendor/google.golang.org/grpc/credentials/insecure/insecure.go b/vendor/google.golang.org/grpc/credentials/insecure/insecure.go index 82bee1443..4c805c644 100644 --- a/vendor/google.golang.org/grpc/credentials/insecure/insecure.go +++ b/vendor/google.golang.org/grpc/credentials/insecure/insecure.go @@ -40,7 +40,7 @@ func NewCredentials() credentials.TransportCredentials { // NoSecurity. type insecureTC struct{} -func (insecureTC) ClientHandshake(ctx context.Context, _ string, conn net.Conn) (net.Conn, credentials.AuthInfo, error) { +func (insecureTC) ClientHandshake(_ context.Context, _ string, conn net.Conn) (net.Conn, credentials.AuthInfo, error) { return conn, info{credentials.CommonAuthInfo{SecurityLevel: credentials.NoSecurity}}, nil } diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index 27c1b9bb6..2b285beee 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -518,6 +518,8 @@ func WithUserAgent(s string) DialOption { // WithKeepaliveParams returns a DialOption that specifies keepalive parameters // for the client transport. +// +// Keepalive is disabled by default. func WithKeepaliveParams(kp keepalive.ClientParameters) DialOption { if kp.Time < internal.KeepaliveMinPingTime { logger.Warningf("Adjusting keepalive ping interval to minimum period of %v", internal.KeepaliveMinPingTime) diff --git a/vendor/google.golang.org/grpc/grpclog/internal/logger.go b/vendor/google.golang.org/grpc/grpclog/internal/logger.go index 0d9a824ce..e524fdd40 100644 --- a/vendor/google.golang.org/grpc/grpclog/internal/logger.go +++ b/vendor/google.golang.org/grpc/grpclog/internal/logger.go @@ -81,7 +81,7 @@ func (l *LoggerWrapper) Errorf(format string, args ...any) { } // V reports whether verbosity level l is at least the requested verbose level. -func (*LoggerWrapper) V(l int) bool { +func (*LoggerWrapper) V(int) bool { // Returns true for all verbose level. return true } diff --git a/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go b/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go index aa4505a87..966932891 100644 --- a/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go +++ b/vendor/google.golang.org/grpc/internal/binarylog/method_logger.go @@ -106,7 +106,7 @@ func (ml *TruncatingMethodLogger) Build(c LogEntryConfig) *binlogpb.GrpcLogEntry } // Log creates a proto binary log entry, and logs it to the sink. -func (ml *TruncatingMethodLogger) Log(ctx context.Context, c LogEntryConfig) { +func (ml *TruncatingMethodLogger) Log(_ context.Context, c LogEntryConfig) { ml.sink.Write(ml.Build(c)) } diff --git a/vendor/google.golang.org/grpc/internal/channelz/channelmap.go b/vendor/google.golang.org/grpc/internal/channelz/channelmap.go index bb531225d..64c791953 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/channelmap.go +++ b/vendor/google.golang.org/grpc/internal/channelz/channelmap.go @@ -234,13 +234,6 @@ func copyMap(m map[int64]string) map[int64]string { return n } -func min(a, b int) int { - if a < b { - return a - } - return b -} - func (c *channelMap) getTopChannels(id int64, maxResults int) ([]*Channel, bool) { if maxResults <= 0 { maxResults = EntriesPerPage diff --git a/vendor/google.golang.org/grpc/internal/channelz/funcs.go b/vendor/google.golang.org/grpc/internal/channelz/funcs.go index 03e24e150..078bb8123 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/funcs.go +++ b/vendor/google.golang.org/grpc/internal/channelz/funcs.go @@ -33,7 +33,7 @@ var ( // outside this package except by tests. IDGen IDGenerator - db *channelMap = newChannelMap() + db = newChannelMap() // EntriesPerPage defines the number of channelz entries to be shown on a web page. EntriesPerPage = 50 curState int32 diff --git a/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go b/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go index d1ed8df6a..0e6e18e18 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go +++ b/vendor/google.golang.org/grpc/internal/channelz/syscall_nonlinux.go @@ -35,13 +35,13 @@ type SocketOptionData struct { // Getsockopt defines the function to get socket options requested by channelz. // It is to be passed to syscall.RawConn.Control(). // Windows OS doesn't support Socket Option -func (s *SocketOptionData) Getsockopt(fd uintptr) { +func (s *SocketOptionData) Getsockopt(uintptr) { once.Do(func() { logger.Warning("Channelz: socket options are not supported on non-linux environments") }) } // GetSocketOption gets the socket option info of the conn. -func GetSocketOption(c any) *SocketOptionData { +func GetSocketOption(any) *SocketOptionData { return nil } diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index 00abc7c2b..452985f8d 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -45,7 +45,7 @@ var ( // option is present for backward compatibility. This option may be overridden // by setting the environment variable "GRPC_ENFORCE_ALPN_ENABLED" to "true" // or "false". - EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", false) + EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", true) // XDSFallbackSupport is the env variable that controls whether support for // xDS fallback is turned on. If this is unset or is false, only the first // xDS server in the list of server configs will be used. diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 73fa407b6..7aae9240f 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -183,7 +183,7 @@ var ( // GRPCResolverSchemeExtraMetadata determines when gRPC will add extra // metadata to RPCs. - GRPCResolverSchemeExtraMetadata string = "xds" + GRPCResolverSchemeExtraMetadata = "xds" // EnterIdleModeForTesting gets the ClientConn to enter IDLE mode. EnterIdleModeForTesting any // func(*grpc.ClientConn) @@ -203,7 +203,7 @@ var ( // UserSetDefaultScheme is set to true if the user has overridden the // default resolver scheme. - UserSetDefaultScheme bool = false + UserSetDefaultScheme = false // ShuffleAddressListForTesting pseudo-randomizes the order of addresses. n // is the number of elements. swap swaps the elements with indexes i and j. diff --git a/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go b/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go index afac56572..b901c7bac 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go +++ b/vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go @@ -55,7 +55,7 @@ func (r *passthroughResolver) start() { r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint()}}}) } -func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOptions) {} +func (*passthroughResolver) ResolveNow(resolver.ResolveNowOptions) {} func (*passthroughResolver) Close() {} diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go index c7dbc8205..757925381 100644 --- a/vendor/google.golang.org/grpc/internal/status/status.go +++ b/vendor/google.golang.org/grpc/internal/status/status.go @@ -138,11 +138,11 @@ func (s *Status) WithDetails(details ...protoadapt.MessageV1) (*Status, error) { // s.Code() != OK implies that s.Proto() != nil. p := s.Proto() for _, detail := range details { - any, err := anypb.New(protoadapt.MessageV2Of(detail)) + m, err := anypb.New(protoadapt.MessageV2Of(detail)) if err != nil { return nil, err } - p.Details = append(p.Details, any) + p.Details = append(p.Details, m) } return &Status{s: p}, nil } diff --git a/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go b/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go index 999f52cd7..54c24c2ff 100644 --- a/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go +++ b/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go @@ -58,20 +58,20 @@ func GetRusage() *Rusage { // CPUTimeDiff returns the differences of user CPU time and system CPU time used // between two Rusage structs. It a no-op function for non-linux environments. -func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) { +func CPUTimeDiff(*Rusage, *Rusage) (float64, float64) { log() return 0, 0 } // SetTCPUserTimeout is a no-op function under non-linux environments. -func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error { +func SetTCPUserTimeout(net.Conn, time.Duration) error { log() return nil } // GetTCPUserTimeout is a no-op function under non-linux environments. // A negative return value indicates the operation is not supported -func GetTCPUserTimeout(conn net.Conn) (int, error) { +func GetTCPUserTimeout(net.Conn) (int, error) { log() return -1, nil } diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go index ea0633bbd..ef72fbb3a 100644 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -1033,10 +1033,3 @@ func (l *loopyWriter) processData() (bool, error) { } return false, nil } - -func min(a, b int) int { - if a < b { - return a - } - return b -} diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index e1cd86b2f..ce878693b 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -333,7 +333,7 @@ func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) { s.hdrMu.Unlock() } -func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error { +func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data mem.BufferSlice, _ *Options) error { // Always take a reference because otherwise there is no guarantee the data will // be available after this function returns. This is what callers to Write // expect. @@ -475,7 +475,7 @@ func (ht *serverHandlerTransport) IncrMsgSent() {} func (ht *serverHandlerTransport) IncrMsgRecv() {} -func (ht *serverHandlerTransport) Drain(debugData string) { +func (ht *serverHandlerTransport) Drain(string) { panic("Drain() is not implemented") } diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index f46194fdc..c769deab5 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -772,7 +772,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, hdr := &headerFrame{ hf: headerFields, endStream: false, - initStream: func(id uint32) error { + initStream: func(uint32) error { t.mu.Lock() // TODO: handle transport closure in loopy instead and remove this // initStream is never called when transport is draining. @@ -1667,11 +1667,10 @@ func (t *http2Client) reader(errCh chan<- error) { t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false) } continue - } else { - // Transport error. - t.Close(connectionErrorf(true, err, "error reading from server: %v", err)) - return } + // Transport error. + t.Close(connectionErrorf(true, err, "error reading from server: %v", err)) + return } switch frame := frame.(type) { case *http2.MetaHeadersFrame: @@ -1696,13 +1695,6 @@ func (t *http2Client) reader(errCh chan<- error) { } } -func minTime(a, b time.Duration) time.Duration { - if a < b { - return a - } - return b -} - // keepalive running in a separate goroutine makes sure the connection is alive by sending pings. func (t *http2Client) keepalive() { p := &ping{data: [8]byte{}} @@ -1770,7 +1762,7 @@ func (t *http2Client) keepalive() { // timeoutLeft. This will ensure that we wait only for kp.Time // before sending out the next ping (for cases where the ping is // acked). - sleepDuration := minTime(t.kp.Time, timeoutLeft) + sleepDuration := min(t.kp.Time, timeoutLeft) timeoutLeft -= sleepDuration timer.Reset(sleepDuration) case <-t.ctx.Done(): diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index f5163f770..584b50fe5 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -1117,7 +1117,7 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { // Write converts the data into HTTP2 data frame and sends it out. Non-nil error // is returns if it fails (e.g., framing error, transport error). -func (t *http2Server) Write(s *Stream, hdr []byte, data mem.BufferSlice, opts *Options) error { +func (t *http2Server) Write(s *Stream, hdr []byte, data mem.BufferSlice, _ *Options) error { reader := data.Reader() if !s.isHeaderSent() { // Headers haven't been written yet. @@ -1238,7 +1238,7 @@ func (t *http2Server) keepalive() { // timeoutLeft. This will ensure that we wait only for kp.Time // before sending out the next ping (for cases where the ping is // acked). - sleepDuration := minTime(t.kp.Time, kpTimeoutLeft) + sleepDuration := min(t.kp.Time, kpTimeoutLeft) kpTimeoutLeft -= sleepDuration kpTimer.Reset(sleepDuration) case <-t.done: diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index f609c6c66..3613d7b64 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -393,7 +393,7 @@ type framer struct { fr *http2.Framer } -var writeBufferPoolMap map[int]*sync.Pool = make(map[int]*sync.Pool) +var writeBufferPoolMap = make(map[int]*sync.Pool) var writeBufferMutex sync.Mutex func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBuffer bool, maxHeaderListSize uint32) *framer { diff --git a/vendor/google.golang.org/grpc/keepalive/keepalive.go b/vendor/google.golang.org/grpc/keepalive/keepalive.go index 34d31b5e7..eb42b19fb 100644 --- a/vendor/google.golang.org/grpc/keepalive/keepalive.go +++ b/vendor/google.golang.org/grpc/keepalive/keepalive.go @@ -34,15 +34,29 @@ type ClientParameters struct { // After a duration of this time if the client doesn't see any activity it // pings the server to see if the transport is still alive. // If set below 10s, a minimum value of 10s will be used instead. - Time time.Duration // The current default value is infinity. + // + // Note that gRPC servers have a default EnforcementPolicy.MinTime of 5 + // minutes (which means the client shouldn't ping more frequently than every + // 5 minutes). + // + // Though not ideal, it's not a strong requirement for Time to be less than + // EnforcementPolicy.MinTime. Time will automatically double if the server + // disconnects due to its enforcement policy. + // + // For more details, see + // https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md + Time time.Duration // After having pinged for keepalive check, the client waits for a duration // of Timeout and if no activity is seen even after that the connection is // closed. - Timeout time.Duration // The current default value is 20 seconds. + // + // If keepalive is enabled, and this value is not explicitly set, the default + // is 20 seconds. + Timeout time.Duration // If true, client sends keepalive pings even with no active RPCs. If false, // when there are no active RPCs, Time and Timeout will be ignored and no // keepalive pings will be sent. - PermitWithoutStream bool // false by default. + PermitWithoutStream bool } // ServerParameters is used to set keepalive and max-age parameters on the diff --git a/vendor/google.golang.org/grpc/mem/buffers.go b/vendor/google.golang.org/grpc/mem/buffers.go index 975ceb718..4d66b2ccc 100644 --- a/vendor/google.golang.org/grpc/mem/buffers.go +++ b/vendor/google.golang.org/grpc/mem/buffers.go @@ -224,11 +224,11 @@ func (e emptyBuffer) Len() int { return 0 } -func (e emptyBuffer) split(n int) (left, right Buffer) { +func (e emptyBuffer) split(int) (left, right Buffer) { return e, e } -func (e emptyBuffer) read(buf []byte) (int, Buffer) { +func (e emptyBuffer) read([]byte) (int, Buffer) { return 0, e } diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index db8865ec3..2d96f1405 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -220,8 +220,8 @@ type HeaderCallOption struct { HeaderAddr *metadata.MD } -func (o HeaderCallOption) before(c *callInfo) error { return nil } -func (o HeaderCallOption) after(c *callInfo, attempt *csAttempt) { +func (o HeaderCallOption) before(*callInfo) error { return nil } +func (o HeaderCallOption) after(_ *callInfo, attempt *csAttempt) { *o.HeaderAddr, _ = attempt.s.Header() } @@ -242,8 +242,8 @@ type TrailerCallOption struct { TrailerAddr *metadata.MD } -func (o TrailerCallOption) before(c *callInfo) error { return nil } -func (o TrailerCallOption) after(c *callInfo, attempt *csAttempt) { +func (o TrailerCallOption) before(*callInfo) error { return nil } +func (o TrailerCallOption) after(_ *callInfo, attempt *csAttempt) { *o.TrailerAddr = attempt.s.Trailer() } @@ -264,8 +264,8 @@ type PeerCallOption struct { PeerAddr *peer.Peer } -func (o PeerCallOption) before(c *callInfo) error { return nil } -func (o PeerCallOption) after(c *callInfo, attempt *csAttempt) { +func (o PeerCallOption) before(*callInfo) error { return nil } +func (o PeerCallOption) after(_ *callInfo, attempt *csAttempt) { if x, ok := peer.FromContext(attempt.s.Context()); ok { *o.PeerAddr = *x } @@ -304,7 +304,7 @@ func (o FailFastCallOption) before(c *callInfo) error { c.failFast = o.FailFast return nil } -func (o FailFastCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o FailFastCallOption) after(*callInfo, *csAttempt) {} // OnFinish returns a CallOption that configures a callback to be called when // the call completes. The error passed to the callback is the status of the @@ -339,7 +339,7 @@ func (o OnFinishCallOption) before(c *callInfo) error { return nil } -func (o OnFinishCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o OnFinishCallOption) after(*callInfo, *csAttempt) {} // MaxCallRecvMsgSize returns a CallOption which sets the maximum message size // in bytes the client can receive. If this is not set, gRPC uses the default @@ -363,7 +363,7 @@ func (o MaxRecvMsgSizeCallOption) before(c *callInfo) error { c.maxReceiveMessageSize = &o.MaxRecvMsgSize return nil } -func (o MaxRecvMsgSizeCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o MaxRecvMsgSizeCallOption) after(*callInfo, *csAttempt) {} // MaxCallSendMsgSize returns a CallOption which sets the maximum message size // in bytes the client can send. If this is not set, gRPC uses the default @@ -387,7 +387,7 @@ func (o MaxSendMsgSizeCallOption) before(c *callInfo) error { c.maxSendMessageSize = &o.MaxSendMsgSize return nil } -func (o MaxSendMsgSizeCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o MaxSendMsgSizeCallOption) after(*callInfo, *csAttempt) {} // PerRPCCredentials returns a CallOption that sets credentials.PerRPCCredentials // for a call. @@ -410,7 +410,7 @@ func (o PerRPCCredsCallOption) before(c *callInfo) error { c.creds = o.Creds return nil } -func (o PerRPCCredsCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o PerRPCCredsCallOption) after(*callInfo, *csAttempt) {} // UseCompressor returns a CallOption which sets the compressor used when // sending the request. If WithCompressor is also set, UseCompressor has @@ -438,7 +438,7 @@ func (o CompressorCallOption) before(c *callInfo) error { c.compressorType = o.CompressorType return nil } -func (o CompressorCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o CompressorCallOption) after(*callInfo, *csAttempt) {} // CallContentSubtype returns a CallOption that will set the content-subtype // for a call. For example, if content-subtype is "json", the Content-Type over @@ -475,7 +475,7 @@ func (o ContentSubtypeCallOption) before(c *callInfo) error { c.contentSubtype = o.ContentSubtype return nil } -func (o ContentSubtypeCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o ContentSubtypeCallOption) after(*callInfo, *csAttempt) {} // ForceCodec returns a CallOption that will set codec to be used for all // request and response messages for a call. The result of calling Name() will @@ -514,7 +514,7 @@ func (o ForceCodecCallOption) before(c *callInfo) error { c.codec = newCodecV1Bridge(o.Codec) return nil } -func (o ForceCodecCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o ForceCodecCallOption) after(*callInfo, *csAttempt) {} // ForceCodecV2 returns a CallOption that will set codec to be used for all // request and response messages for a call. The result of calling Name() will @@ -554,7 +554,7 @@ func (o ForceCodecV2CallOption) before(c *callInfo) error { return nil } -func (o ForceCodecV2CallOption) after(c *callInfo, attempt *csAttempt) {} +func (o ForceCodecV2CallOption) after(*callInfo, *csAttempt) {} // CallCustomCodec behaves like ForceCodec, but accepts a grpc.Codec instead of // an encoding.Codec. @@ -579,7 +579,7 @@ func (o CustomCodecCallOption) before(c *callInfo) error { c.codec = newCodecV0Bridge(o.Codec) return nil } -func (o CustomCodecCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o CustomCodecCallOption) after(*callInfo, *csAttempt) {} // MaxRetryRPCBufferSize returns a CallOption that limits the amount of memory // used for buffering this RPC's requests for retry purposes. @@ -607,7 +607,7 @@ func (o MaxRetryRPCBufferSizeCallOption) before(c *callInfo) error { c.maxRetryRPCBufferSize = o.MaxRetryRPCBufferSize return nil } -func (o MaxRetryRPCBufferSizeCallOption) after(c *callInfo, attempt *csAttempt) {} +func (o MaxRetryRPCBufferSizeCallOption) after(*callInfo, *csAttempt) {} // The format of the payload: compressed or not? type payloadFormat uint8 diff --git a/vendor/google.golang.org/grpc/stream_interfaces.go b/vendor/google.golang.org/grpc/stream_interfaces.go index 8b813529c..0037fee0b 100644 --- a/vendor/google.golang.org/grpc/stream_interfaces.go +++ b/vendor/google.golang.org/grpc/stream_interfaces.go @@ -22,15 +22,35 @@ package grpc // request, many responses) RPC. It is generic over the type of the response // message. It is used in generated code. type ServerStreamingClient[Res any] interface { + // Recv receives the next response message from the server. The client may + // repeatedly call Recv to read messages from the response stream. If + // io.EOF is returned, the stream has terminated with an OK status. Any + // other error is compatible with the status package and indicates the + // RPC's status code and message. Recv() (*Res, error) + + // ClientStream is embedded to provide Context, Header, and Trailer + // functionality. No other methods in the ClientStream should be called + // directly. ClientStream } // ServerStreamingServer represents the server side of a server-streaming (one // request, many responses) RPC. It is generic over the type of the response // message. It is used in generated code. +// +// To terminate the response stream, return from the handler method and return +// an error from the status package, or use nil to indicate an OK status code. type ServerStreamingServer[Res any] interface { + // Send sends a response message to the client. The server handler may + // call Send multiple times to send multiple messages to the client. An + // error is returned if the stream was terminated unexpectedly, and the + // handler method should return, as the stream is no longer usable. Send(*Res) error + + // ServerStream is embedded to provide Context, SetHeader, SendHeader, and + // SetTrailer functionality. No other methods in the ServerStream should + // be called directly. ServerStream } @@ -39,8 +59,22 @@ type ServerStreamingServer[Res any] interface { // message stream and the type of the unary response message. It is used in // generated code. type ClientStreamingClient[Req any, Res any] interface { + // Send sends a request message to the server. The client may call Send + // multiple times to send multiple messages to the server. On error, Send + // aborts the stream. If the error was generated by the client, the status + // is returned directly. Otherwise, io.EOF is returned, and the status of + // the stream may be discovered using CloseAndRecv(). Send(*Req) error + + // CloseAndRecv closes the request stream and waits for the server's + // response. This method must be called once and only once after sending + // all request messages. Any error returned is implemented by the status + // package. CloseAndRecv() (*Res, error) + + // ClientStream is embedded to provide Context, Header, and Trailer + // functionality. No other methods in the ClientStream should be called + // directly. ClientStream } @@ -48,9 +82,28 @@ type ClientStreamingClient[Req any, Res any] interface { // requests, one response) RPC. It is generic over both the type of the request // message stream and the type of the unary response message. It is used in // generated code. +// +// To terminate the RPC, call SendAndClose and return nil from the method +// handler or do not call SendAndClose and return an error from the status +// package. type ClientStreamingServer[Req any, Res any] interface { + // Recv receives the next request message from the client. The server may + // repeatedly call Recv to read messages from the request stream. If + // io.EOF is returned, it indicates the client called CloseAndRecv on its + // ClientStreamingClient. Any other error indicates the stream was + // terminated unexpectedly, and the handler method should return, as the + // stream is no longer usable. Recv() (*Req, error) + + // SendAndClose sends a single response message to the client and closes + // the stream. This method must be called once and only once after all + // request messages have been processed. Recv should not be called after + // calling SendAndClose. SendAndClose(*Res) error + + // ServerStream is embedded to provide Context, SetHeader, SendHeader, and + // SetTrailer functionality. No other methods in the ServerStream should + // be called directly. ServerStream } @@ -59,8 +112,23 @@ type ClientStreamingServer[Req any, Res any] interface { // request message stream and the type of the response message stream. It is // used in generated code. type BidiStreamingClient[Req any, Res any] interface { + // Send sends a request message to the server. The client may call Send + // multiple times to send multiple messages to the server. On error, Send + // aborts the stream. If the error was generated by the client, the status + // is returned directly. Otherwise, io.EOF is returned, and the status of + // the stream may be discovered using Recv(). Send(*Req) error + + // Recv receives the next response message from the server. The client may + // repeatedly call Recv to read messages from the response stream. If + // io.EOF is returned, the stream has terminated with an OK status. Any + // other error is compatible with the status package and indicates the + // RPC's status code and message. Recv() (*Res, error) + + // ClientStream is embedded to provide Context, Header, Trailer, and + // CloseSend functionality. No other methods in the ClientStream should be + // called directly. ClientStream } @@ -68,9 +136,27 @@ type BidiStreamingClient[Req any, Res any] interface { // (many requests, many responses) RPC. It is generic over both the type of the // request message stream and the type of the response message stream. It is // used in generated code. +// +// To terminate the stream, return from the handler method and return +// an error from the status package, or use nil to indicate an OK status code. type BidiStreamingServer[Req any, Res any] interface { + // Recv receives the next request message from the client. The server may + // repeatedly call Recv to read messages from the request stream. If + // io.EOF is returned, it indicates the client called CloseSend on its + // BidiStreamingClient. Any other error indicates the stream was + // terminated unexpectedly, and the handler method should return, as the + // stream is no longer usable. Recv() (*Req, error) + + // Send sends a response message to the client. The server handler may + // call Send multiple times to send multiple messages to the client. An + // error is returned if the stream was terminated unexpectedly, and the + // handler method should return, as the stream is no longer usable. Send(*Res) error + + // ServerStream is embedded to provide Context, SetHeader, SendHeader, and + // SetTrailer functionality. No other methods in the ServerStream should + // be called directly. ServerStream } diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 7c70005d0..187fbf119 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.66.2" +const Version = "1.67.0" diff --git a/vendor/modules.txt b/vendor/modules.txt index 9ba7282f4..1cf1159f2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -256,7 +256,7 @@ golang.org/x/net/http2/hpack golang.org/x/net/idna golang.org/x/net/internal/timeseries golang.org/x/net/trace -# golang.org/x/oauth2 v0.21.0 +# golang.org/x/oauth2 v0.22.0 ## explicit; go 1.18 golang.org/x/oauth2 golang.org/x/oauth2/internal @@ -300,10 +300,10 @@ golang.org/x/tools/go/ast/inspector # gomodules.xyz/jsonpatch/v2 v2.4.0 ## explicit; go 1.20 gomodules.xyz/jsonpatch/v2 -# google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 -## explicit; go 1.20 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 +## explicit; go 1.21 google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.66.2 +# google.golang.org/grpc v1.67.0 ## explicit; go 1.21 google.golang.org/grpc google.golang.org/grpc/attributes From df8c0482a2c55bbf220d6469f6144496a05c19cb Mon Sep 17 00:00:00 2001 From: Rakshith R Date: Tue, 24 Sep 2024 12:35:09 +0530 Subject: [PATCH 3/3] controller/pvc: add checks for nil/empty pvc.Spec.StorageClassName `pvc.Spec.StorageClassName` is a string pointer and can be nil or empty. This commit adds check for both nil and empty. Signed-off-by: Rakshith R --- .../csiaddons/persistentvolumeclaim_controller.go | 13 +++++++------ .../persistentvolumeclaim_controller_test.go | 8 ++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/internal/controller/csiaddons/persistentvolumeclaim_controller.go b/internal/controller/csiaddons/persistentvolumeclaim_controller.go index 66e9ded25..d591ed8e3 100644 --- a/internal/controller/csiaddons/persistentvolumeclaim_controller.go +++ b/internal/controller/csiaddons/persistentvolumeclaim_controller.go @@ -277,22 +277,23 @@ func (r *PersistentVolumeClaimReconciler) determineScheduleAndRequeue( } } - // For static provisioned PVs, StorageClassName is empty. - if len(*pvc.Spec.StorageClassName) == 0 { + // For static provisioned PVs, StorageClassName is nil or empty. + if pvc.Spec.StorageClassName == nil || len(*pvc.Spec.StorageClassName) == 0 { logger.Info("StorageClassName is empty") return "", ErrScheduleNotFound } + storageClassName := *pvc.Spec.StorageClassName // check for storageclass schedule annotation. sc := &storagev1.StorageClass{} - err = r.Client.Get(ctx, types.NamespacedName{Name: *pvc.Spec.StorageClassName}, sc) + err = r.Client.Get(ctx, types.NamespacedName{Name: storageClassName}, sc) if err != nil { if apierrors.IsNotFound(err) { - logger.Error(err, "StorageClass not found", "StorageClass", *pvc.Spec.StorageClassName) + logger.Error(err, "StorageClass not found", "StorageClass", storageClassName) return "", ErrScheduleNotFound } - logger.Error(err, "Failed to get StorageClass", "StorageClass", *pvc.Spec.StorageClassName) + logger.Error(err, "Failed to get StorageClass", "StorageClass", storageClassName) return "", err } schedule, scheduleFound = getScheduleFromAnnotation(annotationKey, logger, sc.Annotations) @@ -376,7 +377,7 @@ func (r *PersistentVolumeClaimReconciler) setupIndexers(mgr ctrl.Manager) error field: "spec.storageClassName", indexFn: func(rawObj client.Object) []string { pvc, ok := rawObj.(*corev1.PersistentVolumeClaim) - if !ok { + if !ok || (pvc.Spec.StorageClassName == nil) || len(*pvc.Spec.StorageClassName) == 0 { return nil } return []string{*pvc.Spec.StorageClassName} diff --git a/internal/controller/csiaddons/persistentvolumeclaim_controller_test.go b/internal/controller/csiaddons/persistentvolumeclaim_controller_test.go index 7dae5ed19..9396447e7 100644 --- a/internal/controller/csiaddons/persistentvolumeclaim_controller_test.go +++ b/internal/controller/csiaddons/persistentvolumeclaim_controller_test.go @@ -323,6 +323,14 @@ func TestDetermineScheduleAndRequeue(t *testing.T) { assert.Equal(t, "", schedule) }) + // test for StorageClassName is nil + t.Run("StorageClassName is nil", func(t *testing.T) { + pvc.Spec.StorageClassName = nil + pvc.Annotations = nil + schedule, error := r.determineScheduleAndRequeue(ctx, &logger, pvc, driverName, rsCronJobScheduleTimeAnnotation) + assert.ErrorIs(t, error, ErrScheduleNotFound) + assert.Equal(t, "", schedule) + }) } func TestAnnotationValueMissing(t *testing.T) {