From e60525e1b03b58d46ac58973d78130f7711f8ab3 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Fri, 6 Dec 2024 11:05:59 +0100 Subject: [PATCH 01/38] add dependabot config (#31) Signed-off-by: Augustin Husson --- .github/dependabot.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..428bc26 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +updates: +- package-ecosystem: "gomod" + directory: "/" + open-pull-requests-limit: 10 + schedule: + interval: "weekly" + groups: + k8s.io: + patterns: + - "k8s.io/*" +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From 13a6a54c93231d400371882bdef9d595731eb685 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:22:09 +0100 Subject: [PATCH 02/38] Bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 (#32) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.1.0 to 6.1.1. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6.1.0...v6.1.1) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 504cb7f..cce1e26 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -55,7 +55,7 @@ jobs: - name: generate files run: make generate - name: golangci-lint - uses: golangci/golangci-lint-action@v6.1.0 + uses: golangci/golangci-lint-action@v6.1.1 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.61.0 From 6dc9daaf4e0dc7ad3f278e5747cbe6cce23f49cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:24:15 +0100 Subject: [PATCH 03/38] Bump sigs.k8s.io/controller-runtime from 0.19.0 to 0.19.3 (#33) Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.19.0 to 0.19.3. - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.19.0...v0.19.3) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index edb9a65..0c87335 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( k8s.io/api v0.31.3 k8s.io/apimachinery v0.31.3 k8s.io/client-go v0.31.3 - sigs.k8s.io/controller-runtime v0.19.0 + sigs.k8s.io/controller-runtime v0.19.3 ) require ( diff --git a/go.sum b/go.sum index 8dcd615..45c21ea 100644 --- a/go.sum +++ b/go.sum @@ -399,8 +399,8 @@ k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 h1:MErs8YA0abvOqJ8gIupA1T k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094/go.mod h1:7ioBJr1A6igWjsR2fxq2EZ0mlMwYLejazSIc2bzMp2U= k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI= k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= -sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= +sigs.k8s.io/controller-runtime v0.19.3 h1:XO2GvC9OPftRst6xWCpTgBZO04S2cbp0Qqkj8bX1sPw= +sigs.k8s.io/controller-runtime v0.19.3/go.mod h1:j4j87DqtsThvwTv5/Tc5NFRyyF/RF0ip4+62tbTSIUM= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= From 17738164dc2ca5bfbb76be1d23ae272a86c97e9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:24:32 +0100 Subject: [PATCH 04/38] Bump github.com/onsi/gomega from 1.33.1 to 1.36.0 (#34) Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.33.1 to 1.36.0. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/gomega/compare/v1.33.1...v1.36.0) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 0c87335..365a0b8 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ toolchain go1.23.0 require ( github.com/brunoga/deep v1.2.4 - github.com/onsi/ginkgo/v2 v2.19.0 - github.com/onsi/gomega v1.33.1 + github.com/onsi/ginkgo/v2 v2.20.1 + github.com/onsi/gomega v1.36.0 github.com/perses/perses v0.49.1-0.20241126140800-e31e2915b6f2 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 @@ -60,7 +60,7 @@ require ( github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect + github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect github.com/google/uuid v1.6.0 // indirect github.com/goreleaser/chglog v0.6.1 // indirect github.com/goreleaser/fileglob v1.3.0 // indirect diff --git a/go.sum b/go.sum index 45c21ea..41a2841 100644 --- a/go.sum +++ b/go.sum @@ -110,8 +110,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a h1:JJBdjSfqSy3mnDT0940ASQFghwcZ4y4cb6ttjAoXqwE= github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a/go.mod h1:uqVAUVQLq8UY2hCDfmJ/+rtO3aw7qyhc90rCVEabEfI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -198,10 +198,10 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nexucis/lamenv v0.5.2 h1:tK/u3XGhCq9qIoVNcXsK9LZb8fKopm0A5weqSRvHd7M= github.com/nexucis/lamenv v0.5.2/go.mod h1:HusJm6ltmmT7FMG8A750mOLuME6SHCsr2iFYxp5fFi0= -github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= -github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= -github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= -github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= +github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y= +github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/perses/common v0.26.0 h1:szF3GFTUgsCts3VYU3QY9OfgnYerjzHl9bo9pk4ZGyM= github.com/perses/common v0.26.0/go.mod h1:5vlqNPN6i73VJprx7XA7EulzcbKmnV63jrqnyT27B+E= github.com/perses/perses v0.49.1-0.20241126140800-e31e2915b6f2 h1:F/6Oo+09Y27pb3/6eMuklrNHUSZxVJx9fs17hBlMhC0= From 2ac4adad35e9a2ae3e51909f358395ff80d9cc81 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:38:34 +0100 Subject: [PATCH 05/38] Bump github.com/onsi/ginkgo/v2 from 2.19.0 to 2.22.0 (#35) Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.19.0 to 2.22.0. - [Release notes](https://github.com/onsi/ginkgo/releases) - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/ginkgo/compare/v2.19.0...v2.22.0) --- updated-dependencies: - dependency-name: github.com/onsi/ginkgo/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 365a0b8..182f508 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.23.0 require ( github.com/brunoga/deep v1.2.4 - github.com/onsi/ginkgo/v2 v2.20.1 + github.com/onsi/ginkgo/v2 v2.22.0 github.com/onsi/gomega v1.36.0 github.com/perses/perses v0.49.1-0.20241126140800-e31e2915b6f2 github.com/sirupsen/logrus v1.9.3 @@ -60,7 +60,7 @@ require ( github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect + github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect github.com/google/uuid v1.6.0 // indirect github.com/goreleaser/chglog v0.6.1 // indirect github.com/goreleaser/fileglob v1.3.0 // indirect diff --git a/go.sum b/go.sum index 41a2841..0c45c0d 100644 --- a/go.sum +++ b/go.sum @@ -110,8 +110,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a h1:JJBdjSfqSy3mnDT0940ASQFghwcZ4y4cb6ttjAoXqwE= github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a/go.mod h1:uqVAUVQLq8UY2hCDfmJ/+rtO3aw7qyhc90rCVEabEfI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -198,8 +198,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nexucis/lamenv v0.5.2 h1:tK/u3XGhCq9qIoVNcXsK9LZb8fKopm0A5weqSRvHd7M= github.com/nexucis/lamenv v0.5.2/go.mod h1:HusJm6ltmmT7FMG8A750mOLuME6SHCsr2iFYxp5fFi0= -github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= -github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= +github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y= github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/perses/common v0.26.0 h1:szF3GFTUgsCts3VYU3QY9OfgnYerjzHl9bo9pk4ZGyM= From b85ad8e50b098782741438c26eb1fa852f3d0531 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Tue, 17 Dec 2024 11:32:51 +0100 Subject: [PATCH 06/38] Add CNCF code of conduct Signed-off-by: Augustin Husson --- CODE_OF_CONDUCT.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..4668333 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Perses Community Code of Conduct + +Perses follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md). From f5bafb092f4a5339944df26f6c0002ec671b47ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:48:51 +0100 Subject: [PATCH 07/38] Bump the k8s-io group with 2 updates (#36) * Bump the k8s-io group with 2 updates Bumps the k8s-io group with 2 updates: [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go). Updates `k8s.io/apimachinery` from 0.31.3 to 0.32.0 - [Commits](https://github.com/kubernetes/apimachinery/compare/v0.31.3...v0.32.0) Updates `k8s.io/client-go` from 0.31.3 to 0.32.0 - [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/kubernetes/client-go/compare/v0.31.3...v0.32.0) --- updated-dependencies: - dependency-name: k8s.io/apimachinery dependency-type: direct:production update-type: version-update:semver-minor dependency-group: k8s-io - dependency-name: k8s.io/client-go dependency-type: direct:production update-type: version-update:semver-minor dependency-group: k8s-io ... Signed-off-by: dependabot[bot] * fix go mod Signed-off-by: Augustin Husson --------- Signed-off-by: dependabot[bot] Signed-off-by: Augustin Husson Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Augustin Husson --- go.mod | 17 +++++++++-------- go.sum | 25 ++++++++++++------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index 182f508..053911e 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/perses/perses-operator -go 1.23 +go 1.23.0 -toolchain go1.23.0 +toolchain go1.23.4 require ( github.com/brunoga/deep v1.2.4 @@ -12,9 +12,9 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 gopkg.in/yaml.v2 v2.4.0 - k8s.io/api v0.31.3 - k8s.io/apimachinery v0.31.3 - k8s.io/client-go v0.31.3 + k8s.io/api v0.32.0 + k8s.io/apimachinery v0.32.0 + k8s.io/client-go v0.32.0 sigs.k8s.io/controller-runtime v0.19.3 ) @@ -126,14 +126,15 @@ require ( golang.org/x/tools v0.26.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/protobuf v1.35.1 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.31.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 // indirect - k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect + k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect + k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 0c45c0d..9faf189 100644 --- a/go.sum +++ b/go.sum @@ -378,32 +378,31 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.31.3 h1:umzm5o8lFbdN/hIXbrK9oRpOproJO62CV1zqxXrLgk8= -k8s.io/api v0.31.3/go.mod h1:UJrkIp9pnMOI9K2nlL6vwpxRzzEX5sWgn8kGQe92kCE= +k8s.io/api v0.32.0 h1:OL9JpbvAU5ny9ga2fb24X8H6xQlVp+aJMFlgtQjR9CE= +k8s.io/api v0.32.0/go.mod h1:4LEwHZEf6Q/cG96F3dqR965sYOfmPM7rq81BLgsE0p0= k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40= k8s.io/apiextensions-apiserver v0.31.1/go.mod h1:tWMPR3sgW+jsl2xm9v7lAyRF1rYEK71i9G5dRtkknoQ= -k8s.io/apimachinery v0.31.3 h1:6l0WhcYgasZ/wk9ktLq5vLaoXJJr5ts6lkaQzgeYPq4= -k8s.io/apimachinery v0.31.3/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/client-go v0.31.3 h1:CAlZuM+PH2cm+86LOBemaJI/lQ5linJ6UFxKX/SoG+4= -k8s.io/client-go v0.31.3/go.mod h1:2CgjPUTpv3fE5dNygAr2NcM8nhHzXvxB8KL5gYc3kJs= +k8s.io/apimachinery v0.32.0 h1:cFSE7N3rmEEtv4ei5X6DaJPHHX0C+upp+v5lVPiEwpg= +k8s.io/apimachinery v0.32.0/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= +k8s.io/client-go v0.32.0 h1:DimtMcnN/JIKZcrSrstiwvvZvLjG0aSxy8PxN8IChp8= +k8s.io/client-go v0.32.0/go.mod h1:boDWvdM1Drk4NJj/VddSLnx59X3OPgwrOo0vGbtq9+8= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 h1:MErs8YA0abvOqJ8gIupA1Tz6PKXYUw34XsGlA7uSL1k= -k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094/go.mod h1:7ioBJr1A6igWjsR2fxq2EZ0mlMwYLejazSIc2bzMp2U= -k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI= -k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/controller-runtime v0.19.3 h1:XO2GvC9OPftRst6xWCpTgBZO04S2cbp0Qqkj8bX1sPw= sigs.k8s.io/controller-runtime v0.19.3/go.mod h1:j4j87DqtsThvwTv5/Tc5NFRyyF/RF0ip4+62tbTSIUM= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= -sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= From 744e5702852e2da38b2842c5d5be10b90a2fcc79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:49:41 +0100 Subject: [PATCH 08/38] Bump github.com/onsi/gomega from 1.36.0 to 1.36.1 (#37) Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.36.0 to 1.36.1. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/gomega/compare/v1.36.0...v1.36.1) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 053911e..7f01bae 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.23.4 require ( github.com/brunoga/deep v1.2.4 github.com/onsi/ginkgo/v2 v2.22.0 - github.com/onsi/gomega v1.36.0 + github.com/onsi/gomega v1.36.1 github.com/perses/perses v0.49.1-0.20241126140800-e31e2915b6f2 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 diff --git a/go.sum b/go.sum index 9faf189..9f0c70d 100644 --- a/go.sum +++ b/go.sum @@ -200,8 +200,8 @@ github.com/nexucis/lamenv v0.5.2 h1:tK/u3XGhCq9qIoVNcXsK9LZb8fKopm0A5weqSRvHd7M= github.com/nexucis/lamenv v0.5.2/go.mod h1:HusJm6ltmmT7FMG8A750mOLuME6SHCsr2iFYxp5fFi0= github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= -github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y= -github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw= +github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/perses/common v0.26.0 h1:szF3GFTUgsCts3VYU3QY9OfgnYerjzHl9bo9pk4ZGyM= github.com/perses/common v0.26.0/go.mod h1:5vlqNPN6i73VJprx7XA7EulzcbKmnV63jrqnyT27B+E= github.com/perses/perses v0.49.1-0.20241126140800-e31e2915b6f2 h1:F/6Oo+09Y27pb3/6eMuklrNHUSZxVJx9fs17hBlMhC0= From 02d00793b82af83116510a5079ec4fff35bc1a9b Mon Sep 17 00:00:00 2001 From: Gabriel Bernal Date: Thu, 19 Dec 2024 13:57:31 +0100 Subject: [PATCH 09/38] fix local development documentation and setup Signed-off-by: Gabriel Bernal --- Dockerfile.dev | 35 +++++++++++++++++++++++++++++++++++ Makefile | 4 ++-- README.md | 8 +++++++- config/manager/manager.yaml | 8 +------- 4 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 Dockerfile.dev diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..bd217d3 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,35 @@ +# Build the manager binary +FROM golang:1.23 as builder +ARG TARGETOS +ARG TARGETARCH + +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 main.go main.go +COPY api/ api/ +COPY controllers/ controllers/ +COPY internal/ internal/ + +# Build +# the GOARCH has not a default value to allow the binary be built according to the host where the command +# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO +# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, +# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go + +FROM gcr.io/distroless/static:nonroot +WORKDIR / + +COPY --from=builder /workspace/manager . +COPY --chown=nobody:nobody LICENSE /LICENSE + +USER 65532:65532 + +ENTRYPOINT ["/manager"] diff --git a/Makefile b/Makefile index 819387d..82ce838 100644 --- a/Makefile +++ b/Makefile @@ -151,7 +151,7 @@ run: manifests generate fmt vet ## Run a controller from your host. # More info: https://docs.docker.com/develop/develop-images/build_enhancements/ .PHONY: image-build image-build: test ## Build docker image with the manager. - ${CONTAINER_RUNTIME} build -t ${IMG} . + ${CONTAINER_RUNTIME} build -f Dockerfile.dev -t ${IMG} . .PHONY: image-push image-push: ## Push docker image with the manager. @@ -326,7 +326,7 @@ endef generate-goreleaser: go run ./scripts/generate-goreleaser/generate-goreleaser.go -## Cross build binaries for all platforms (Use "make build" in development) +## Cross build binaries for all platforms (Use "make image-build" in development) .PHONY: cross-build cross-build: generate-goreleaser manifests generate fmt vet ## Cross build binaries for all platforms (Use "make build" in development) goreleaser release --snapshot --clean diff --git a/README.md b/README.md index c932c89..162ff1f 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ kubectl apply -k config/samples 3. Build and push your image to the location specified by `IMG`: ```sh -make docker-build docker-push IMG=/perses-operator:tag +make image-build image-push IMG=/perses-operator:tag ``` 4. Deploy the controller to the cluster with the image specified by `IMG`: @@ -32,6 +32,12 @@ make docker-build docker-push IMG=/perses-operator:tag make deploy IMG=/perses-operator:tag ``` +6. Access the Perses UI at `http://localhost:8080` + +```sh +kubectl port-forward svc/perses-sample 8080:8080 +``` + ### Uninstall CRDs To delete the CRDs from the cluster: diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index a9c33a7..79a5874 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -58,19 +58,13 @@ spec: # - linux securityContext: runAsNonRoot: true - # TODO(user): For common cases that do not require escalating privileges - # it is recommended to ensure that all your Pods/Containers are restrictive. - # More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted - # Please uncomment the following code if your project does NOT have to work on old Kubernetes - # versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ). - # seccompProfile: - # type: RuntimeDefault containers: - command: - /manager args: - --leader-elect image: controller:latest + imagePullPolicy: Always name: manager securityContext: allowPrivilegeEscalation: false From da213717fea8845037deabf7e1337f46cfa7ff04 Mon Sep 17 00:00:00 2001 From: Gabriel Bernal Date: Mon, 23 Dec 2024 12:37:38 +0100 Subject: [PATCH 10/38] use the distroless image for development with a cluster (#41) Signed-off-by: Gabriel Bernal --- .dockerignore | 1 + Dockerfile | 4 +-- Dockerfile.dev | 35 ------------------- Makefile | 4 +-- README.md | 12 ++----- config/default/manager_auth_proxy_patch.yaml | 2 +- config/manager/manager.yaml | 6 ++-- distroless-debug.Dockerfile | 4 +-- main.go | 2 +- .../generate-goreleaser/.goreleaser.base.yaml | 2 +- 10 files changed, 16 insertions(+), 56 deletions(-) delete mode 100644 Dockerfile.dev diff --git a/.dockerignore b/.dockerignore index 0f04682..432d960 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,5 @@ # More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file # Ignore build and test binaries. bin/ +!bin/manager testbin/ diff --git a/Dockerfile b/Dockerfile index 5ac6697..07ff50f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,9 +7,9 @@ LABEL maintainer="The Perses Authors " USER nobody -COPY --chown=nobody:nobody operator /bin/operator +COPY --chown=nobody:nobody bin/manager /bin/manager COPY --chown=nobody:nobody LICENSE /LICENSE COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types EXPOSE 8080 -ENTRYPOINT [ "/bin/operator" ] +ENTRYPOINT [ "/bin/manager" ] diff --git a/Dockerfile.dev b/Dockerfile.dev deleted file mode 100644 index bd217d3..0000000 --- a/Dockerfile.dev +++ /dev/null @@ -1,35 +0,0 @@ -# Build the manager binary -FROM golang:1.23 as builder -ARG TARGETOS -ARG TARGETARCH - -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 main.go main.go -COPY api/ api/ -COPY controllers/ controllers/ -COPY internal/ internal/ - -# Build -# the GOARCH has not a default value to allow the binary be built according to the host where the command -# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO -# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, -# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go - -FROM gcr.io/distroless/static:nonroot -WORKDIR / - -COPY --from=builder /workspace/manager . -COPY --chown=nobody:nobody LICENSE /LICENSE - -USER 65532:65532 - -ENTRYPOINT ["/manager"] diff --git a/Makefile b/Makefile index 82ce838..4f2d571 100644 --- a/Makefile +++ b/Makefile @@ -150,8 +150,8 @@ run: manifests generate fmt vet ## Run a controller from your host. # (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it. # More info: https://docs.docker.com/develop/develop-images/build_enhancements/ .PHONY: image-build -image-build: test ## Build docker image with the manager. - ${CONTAINER_RUNTIME} build -f Dockerfile.dev -t ${IMG} . +image-build: build test ## Build docker image with the manager. + ${CONTAINER_RUNTIME} build -f Dockerfile -t ${IMG} . .PHONY: image-push image-push: ## Push docker image with the manager. diff --git a/README.md b/README.md index 162ff1f..78bd1a9 100644 --- a/README.md +++ b/README.md @@ -20,19 +20,13 @@ make install kubectl apply -k config/samples ``` -3. Build and push your image to the location specified by `IMG`: +3. Usint the the location specified by `IMG`, build and push the image to the registry, then deploy the controller to the cluster: ```sh -make image-build image-push IMG=/perses-operator:tag +IMG=/perses-operator:tag make image-build image-push deploy ``` -4. Deploy the controller to the cluster with the image specified by `IMG`: - -```sh -make deploy IMG=/perses-operator:tag -``` - -6. Access the Perses UI at `http://localhost:8080` +5. Access the Perses UI at `http://localhost:8080` by port-forwarding the service: ```sh kubectl port-forward svc/perses-sample 8080:8080 diff --git a/config/default/manager_auth_proxy_patch.yaml b/config/default/manager_auth_proxy_patch.yaml index b751266..24d2228 100644 --- a/config/default/manager_auth_proxy_patch.yaml +++ b/config/default/manager_auth_proxy_patch.yaml @@ -51,5 +51,5 @@ spec: - name: manager args: - "--health-probe-bind-address=:8081" - - "--metrics-bind-address=127.0.0.1:8080" + - "--metrics-bind-address=127.0.0.1:8082" - "--leader-elect" diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 79a5874..1938bc5 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -58,10 +58,10 @@ spec: # - linux securityContext: runAsNonRoot: true + runAsGroup: 65532 + runAsUser: 65532 containers: - - command: - - /manager - args: + - args: - --leader-elect image: controller:latest imagePullPolicy: Always diff --git a/distroless-debug.Dockerfile b/distroless-debug.Dockerfile index 9620086..bfd170b 100644 --- a/distroless-debug.Dockerfile +++ b/distroless-debug.Dockerfile @@ -7,9 +7,9 @@ LABEL maintainer="The Perses Authors " USER nobody -COPY --chown=nobody:nobody operator /bin/operator +COPY --chown=nobody:nobody bin/manager /bin/manager COPY --chown=nobody:nobody LICENSE /LICENSE COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types EXPOSE 8080 -ENTRYPOINT [ "/bin/operator" ] +ENTRYPOINT [ "/bin/manager" ] diff --git a/main.go b/main.go index 53de9b0..715c617 100644 --- a/main.go +++ b/main.go @@ -62,7 +62,7 @@ func main() { var enableHTTP2 bool var persesServerURL string - flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") + flag.StringVar(&metricsAddr, "metrics-bind-address", ":8082", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ diff --git a/scripts/generate-goreleaser/.goreleaser.base.yaml b/scripts/generate-goreleaser/.goreleaser.base.yaml index 32b8130..7c26dc1 100644 --- a/scripts/generate-goreleaser/.goreleaser.base.yaml +++ b/scripts/generate-goreleaser/.goreleaser.base.yaml @@ -2,7 +2,7 @@ version: 2 builds: - id: "operator" main: ./main.go - binary: "operator" + binary: "/bin/manager" goos: - linux - windows From 91aff6bad649e636720e7d5f296e81f539bb38dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:14:42 +0100 Subject: [PATCH 11/38] Bump github.com/perses/perses (#42) Bumps [github.com/perses/perses](https://github.com/perses/perses) from 0.49.1-0.20241126140800-e31e2915b6f2 to 0.50.0-rc.0. - [Release notes](https://github.com/perses/perses/releases) - [Changelog](https://github.com/perses/perses/blob/v0.50.0-rc.0/CHANGELOG.md) - [Commits](https://github.com/perses/perses/commits/v0.50.0-rc.0) --- updated-dependencies: - dependency-name: github.com/perses/perses dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 36 ++++++++++++++--------------- go.sum | 72 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/go.mod b/go.mod index 7f01bae..ec2f170 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/brunoga/deep v1.2.4 github.com/onsi/ginkgo/v2 v2.22.0 github.com/onsi/gomega v1.36.1 - github.com/perses/perses v0.49.1-0.20241126140800-e31e2915b6f2 + github.com/perses/perses v0.50.0-rc.0 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 gopkg.in/yaml.v2 v2.4.0 @@ -19,10 +19,10 @@ require ( ) require ( - dario.cat/mergo v1.0.0 // indirect + dario.cat/mergo v1.0.1 // indirect github.com/AlekSi/pointer v1.2.0 // indirect github.com/Masterminds/goutils v1.1.1 // indirect - github.com/Masterminds/semver/v3 v3.2.1 // indirect + github.com/Masterminds/semver/v3 v3.3.1 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/ProtonMail/go-crypto v1.0.0 // indirect @@ -32,8 +32,8 @@ require ( github.com/buger/jsonparser v1.1.1 // indirect github.com/caarlos0/log v0.4.6 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/charmbracelet/lipgloss v0.13.0 // indirect - github.com/charmbracelet/x/ansi v0.2.3 // indirect + github.com/charmbracelet/lipgloss v1.0.0 // indirect + github.com/charmbracelet/x/ansi v0.4.2 // indirect github.com/cloudflare/circl v1.3.8 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -64,8 +64,8 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/goreleaser/chglog v0.6.1 // indirect github.com/goreleaser/fileglob v1.3.0 // indirect - github.com/goreleaser/goreleaser/v2 v2.2.0 // indirect - github.com/goreleaser/nfpm/v2 v2.39.0 // indirect + github.com/goreleaser/goreleaser/v2 v2.5.0 // indirect + github.com/goreleaser/nfpm/v2 v2.41.1 // indirect github.com/huandu/xstrings v1.4.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/invopop/jsonschema v0.12.0 // indirect @@ -75,7 +75,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/klauspost/compress v1.17.11 // indirect - github.com/labstack/echo/v4 v4.12.0 // indirect + github.com/labstack/echo/v4 v4.13.2 // indirect github.com/labstack/gommon v0.4.2 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -96,7 +96,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.60.1 // indirect + github.com/prometheus/common v0.61.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect @@ -115,17 +115,17 @@ require ( gitlab.com/digitalxero/go-conventional-commit v1.0.7 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.29.0 // indirect - golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect - golang.org/x/net v0.30.0 // indirect + golang.org/x/crypto v0.31.0 // indirect + golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e // indirect + golang.org/x/net v0.32.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect - golang.org/x/sys v0.27.0 // indirect - golang.org/x/term v0.26.0 // indirect - golang.org/x/text v0.20.0 // indirect - golang.org/x/time v0.7.0 // indirect - golang.org/x/tools v0.26.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/time v0.8.0 // indirect + golang.org/x/tools v0.28.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/protobuf v1.35.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 9f0c70d..56fb066 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,12 @@ -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/AlekSi/pointer v1.2.0 h1:glcy/gc4h8HnG2Z3ZECSzZ1IX1x2JxRVuDzaJwQE0+w= github.com/AlekSi/pointer v1.2.0/go.mod h1:gZGfd3dpW4vEc/UlyfKKi1roIqcCgwOIvb0tSNSBle0= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= -github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= +github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= @@ -39,10 +39,10 @@ github.com/cavaliergopher/cpio v1.0.1 h1:KQFSeKmZhv0cr+kawA3a0xTQCU4QxXF1vhU7P7a github.com/cavaliergopher/cpio v1.0.1/go.mod h1:pBdaqQjnvXxdS/6CvNDwIANIFSP0xRKI16PX4xejRQc= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw= -github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY= -github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY= -github.com/charmbracelet/x/ansi v0.2.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= +github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg= +github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo= +github.com/charmbracelet/x/ansi v0.4.2 h1:0JM6Aj/g/KC154/gOP4vfxun0ff6itogDYk41kof+qk= +github.com/charmbracelet/x/ansi v0.4.2/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI= github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= @@ -123,10 +123,10 @@ github.com/goreleaser/chglog v0.6.1 h1:NZKiX8l0FTQPRzBgKST7knvNZmZ04f7PEGkN2wInf github.com/goreleaser/chglog v0.6.1/go.mod h1:Bnnfo07jMZkaAb0uRNASMZyOsX6ROW6X1qbXqN3guUo= github.com/goreleaser/fileglob v1.3.0 h1:/X6J7U8lbDpQtBvGcwwPS6OpzkNVlVEsFUVRx9+k+7I= github.com/goreleaser/fileglob v1.3.0/go.mod h1:Jx6BoXv3mbYkEzwm9THo7xbr5egkAraxkGorbJb4RxU= -github.com/goreleaser/goreleaser/v2 v2.2.0 h1:IKWOpyx4A9gG/8o2AEN46PlV3qR/HqXVTHT6W+G8Qi0= -github.com/goreleaser/goreleaser/v2 v2.2.0/go.mod h1:Rz/Xj/utLNN5812fvPSV3bqc35qKenmoeLN5kaiIy9I= -github.com/goreleaser/nfpm/v2 v2.39.0 h1:nfBLGq7sBQgTx3LIlgwuw3PQU+VaOEKCFGC3w6CN7Ko= -github.com/goreleaser/nfpm/v2 v2.39.0/go.mod h1:hDDz0+HR1fWzrytFond4+9/w+ONJvGwR01hBkYEJrBc= +github.com/goreleaser/goreleaser/v2 v2.5.0 h1:5iYVmfKlZyudkEj71EdbHqIxSWXh5srXxiF1A7e2644= +github.com/goreleaser/goreleaser/v2 v2.5.0/go.mod h1:GfqRbUxAlnX/lxZubsfo9rs8GX7j0NfjW68p31RUuHA= +github.com/goreleaser/nfpm/v2 v2.41.1 h1:4tyZ9b817msLuyGKw53ed3suZNApkGHVZDekdGe8ZEE= +github.com/goreleaser/nfpm/v2 v2.41.1/go.mod h1:VPc5kF5OgfA+BosV/A2aB+Vg34honjWvp0Vt8ogsSi0= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -162,8 +162,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0= -github.com/labstack/echo/v4 v4.12.0/go.mod h1:UP9Cr2DJXbOK3Kr9ONYzNowSh7HP0aG0ShAyycHSJvM= +github.com/labstack/echo/v4 v4.13.2 h1:9aAt4hstpH54qIcqkuUXRLTf+v7yOTfMPWzDtuqLmtA= +github.com/labstack/echo/v4 v4.13.2/go.mod h1:uc9gDtHB8UWt3FfbYx0HyxcCuvR4YuPYOxF/1QjoV/c= github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= @@ -204,8 +204,8 @@ github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw= github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/perses/common v0.26.0 h1:szF3GFTUgsCts3VYU3QY9OfgnYerjzHl9bo9pk4ZGyM= github.com/perses/common v0.26.0/go.mod h1:5vlqNPN6i73VJprx7XA7EulzcbKmnV63jrqnyT27B+E= -github.com/perses/perses v0.49.1-0.20241126140800-e31e2915b6f2 h1:F/6Oo+09Y27pb3/6eMuklrNHUSZxVJx9fs17hBlMhC0= -github.com/perses/perses v0.49.1-0.20241126140800-e31e2915b6f2/go.mod h1:tElar8bunq4nRxZXw2hOcjSNwY0cOjMBFWt4tfjE4U0= +github.com/perses/perses v0.50.0-rc.0 h1:EfLEqqy2hMF9ymGkvsgCodCPg8o3Xcl9F715t6IRql0= +github.com/perses/perses v0.50.0-rc.0/go.mod h1:L6bykOUCMAI6CzGSMpK5EWT9ghBUHKxRP91LDCPpXW4= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -217,8 +217,8 @@ github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+ github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= -github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= +github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ= +github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= @@ -288,10 +288,10 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= -golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e h1:4qufH0hlUYs6AO6XmZC3GqfDPGSXHVXUFR6OND+iJX4= +golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -306,8 +306,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -331,15 +331,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= -golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -347,26 +347,26 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= -golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= -golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From ddae621abb3ac2092fa00205c4e2ab1170506310 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:14:57 +0100 Subject: [PATCH 12/38] Bump perses/github-actions from 0.7.1 to 0.8.0 (#44) Bumps [perses/github-actions](https://github.com/perses/github-actions) from 0.7.1 to 0.8.0. - [Release notes](https://github.com/perses/github-actions/releases) - [Changelog](https://github.com/perses/github-actions/blob/main/RELEASE.md) - [Commits](https://github.com/perses/github-actions/compare/v0.7.1...v0.8.0) --- updated-dependencies: - dependency-name: perses/github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- .github/workflows/go.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 70e8ba9..b6541b0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: perses/github-actions@v0.7.1 + - uses: perses/github-actions@v0.8.0 - uses: ./.github/perses-ci/actions/setup_environment with: enable_go: true diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cce1e26..4d8ec46 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,7 +20,7 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - - uses: perses/github-actions@v0.7.1 + - uses: perses/github-actions@v0.8.0 - uses: ./.github/perses-ci/actions/setup_environment with: enable_go: true @@ -34,7 +34,7 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - - uses: perses/github-actions@v0.7.1 + - uses: perses/github-actions@v0.8.0 - uses: ./.github/perses-ci/actions/setup_environment with: enable_go: true @@ -46,7 +46,7 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - - uses: perses/github-actions@v0.7.1 + - uses: perses/github-actions@v0.8.0 - uses: ./.github/perses-ci/actions/setup_environment with: enable_go: true From 642d55a1def4819966e1468a7a5910891fc59e3d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:16:17 +0000 Subject: [PATCH 13/38] Bump github.com/onsi/gomega from 1.36.1 to 1.36.2 Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.36.1 to 1.36.2. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/gomega/compare/v1.36.1...v1.36.2) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index ec2f170..26f1751 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ toolchain go1.23.4 require ( github.com/brunoga/deep v1.2.4 - github.com/onsi/ginkgo/v2 v2.22.0 - github.com/onsi/gomega v1.36.1 + github.com/onsi/ginkgo/v2 v2.22.1 + github.com/onsi/gomega v1.36.2 github.com/perses/perses v0.50.0-rc.0 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 @@ -60,7 +60,7 @@ require ( github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect + github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect github.com/google/uuid v1.6.0 // indirect github.com/goreleaser/chglog v0.6.1 // indirect github.com/goreleaser/fileglob v1.3.0 // indirect @@ -117,7 +117,7 @@ require ( go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e // indirect - golang.org/x/net v0.32.0 // indirect + golang.org/x/net v0.33.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/term v0.27.0 // indirect @@ -125,7 +125,7 @@ require ( golang.org/x/time v0.8.0 // indirect golang.org/x/tools v0.28.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/protobuf v1.35.2 // indirect + google.golang.org/protobuf v1.36.1 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 56fb066..8fa86ab 100644 --- a/go.sum +++ b/go.sum @@ -110,8 +110,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= -github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a h1:JJBdjSfqSy3mnDT0940ASQFghwcZ4y4cb6ttjAoXqwE= github.com/google/rpmpack v0.6.1-0.20240329070804-c2247cbb881a/go.mod h1:uqVAUVQLq8UY2hCDfmJ/+rtO3aw7qyhc90rCVEabEfI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -198,10 +198,10 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nexucis/lamenv v0.5.2 h1:tK/u3XGhCq9qIoVNcXsK9LZb8fKopm0A5weqSRvHd7M= github.com/nexucis/lamenv v0.5.2/go.mod h1:HusJm6ltmmT7FMG8A750mOLuME6SHCsr2iFYxp5fFi0= -github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= -github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= -github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw= -github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/onsi/ginkgo/v2 v2.22.1 h1:QW7tbJAUDyVDVOM5dFa7qaybo+CRfR7bemlQUN6Z8aM= +github.com/onsi/ginkgo/v2 v2.22.1/go.mod h1:S6aTpoRsSq2cZOd+pssHAlKW/Q/jZt6cPrPlnj4a1xM= +github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= +github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/perses/common v0.26.0 h1:szF3GFTUgsCts3VYU3QY9OfgnYerjzHl9bo9pk4ZGyM= github.com/perses/common v0.26.0/go.mod h1:5vlqNPN6i73VJprx7XA7EulzcbKmnV63jrqnyT27B+E= github.com/perses/perses v0.50.0-rc.0 h1:EfLEqqy2hMF9ymGkvsgCodCPg8o3Xcl9F715t6IRql0= @@ -306,8 +306,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -365,8 +365,8 @@ 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/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= -google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From 2198a2ac9b2d38f85414220173618e6cc315540d Mon Sep 17 00:00:00 2001 From: Gabriel Bernal Date: Wed, 8 Jan 2025 11:13:31 +0100 Subject: [PATCH 14/38] add testing docker image for local tests Signed-off-by: Gabriel Bernal --- Dockerfile.dev | 21 +++++++++++++++++++++ Makefile | 4 ++++ README.md | 10 ++++++---- 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 Dockerfile.dev diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..5031c59 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,21 @@ +FROM golang:1.23-alpine AS build-env + +RUN apk add --update --no-cache make bash mailcap + +WORKDIR /app +COPY . . + +RUN make build + +FROM gcr.io/distroless/static-debian12 + +LABEL maintainer="The Perses Authors " + +USER nobody + +COPY --from=build-env --chown=nobody:nobody /app/bin/manager /bin/manager +COPY --chown=nobody:nobody LICENSE /LICENSE +COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types + +EXPOSE 8080 +ENTRYPOINT [ "/bin/manager" ] diff --git a/Makefile b/Makefile index 4f2d571..abca920 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,10 @@ run: manifests generate fmt vet ## Run a controller from your host. image-build: build test ## Build docker image with the manager. ${CONTAINER_RUNTIME} build -f Dockerfile -t ${IMG} . +.PHONY: test-image-build +test-image-build: test ## Build a testing docker image with the manager. + ${CONTAINER_RUNTIME} build -f Dockerfile.dev -t ${IMG} . + .PHONY: image-push image-push: ## Push docker image with the manager. ${CONTAINER_RUNTIME} push ${IMG} diff --git a/README.md b/README.md index 78bd1a9..1e77b53 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ An operator to install [Perses](https://github.com/perses/perses) in a k8s clust ## Getting Started -You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster. +You’ll need: +- a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster. **Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows). +- [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) installed and configured to use your cluster. ### Running on the cluster @@ -20,13 +22,13 @@ make install kubectl apply -k config/samples ``` -3. Usint the the location specified by `IMG`, build and push the image to the registry, then deploy the controller to the cluster: +3. Using the the location specified by `IMG`, build a testing image and push it to the registry, then deploy the controller to the cluster: ```sh -IMG=/perses-operator:tag make image-build image-push deploy +IMG=/perses-operator:tag make test-image-build image-push deploy ``` -5. Access the Perses UI at `http://localhost:8080` by port-forwarding the service: +4. Port forward the service so you can access the Perses UI at `http://localhost:8080`: ```sh kubectl port-forward svc/perses-sample 8080:8080 From bbb4c74317662abb8fdb23d5ae7e7b39c4b82e77 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:26:11 +0000 Subject: [PATCH 15/38] Bump github.com/onsi/ginkgo/v2 from 2.22.0 to 2.22.2 Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.22.0 to 2.22.2. - [Release notes](https://github.com/onsi/ginkgo/releases) - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/ginkgo/compare/v2.22.0...v2.22.2) --- updated-dependencies: - dependency-name: github.com/onsi/ginkgo/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 26f1751..a7cd567 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.23.4 require ( github.com/brunoga/deep v1.2.4 - github.com/onsi/ginkgo/v2 v2.22.1 + github.com/onsi/ginkgo/v2 v2.22.2 github.com/onsi/gomega v1.36.2 github.com/perses/perses v0.50.0-rc.0 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index 8fa86ab..43e5ea6 100644 --- a/go.sum +++ b/go.sum @@ -198,8 +198,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nexucis/lamenv v0.5.2 h1:tK/u3XGhCq9qIoVNcXsK9LZb8fKopm0A5weqSRvHd7M= github.com/nexucis/lamenv v0.5.2/go.mod h1:HusJm6ltmmT7FMG8A750mOLuME6SHCsr2iFYxp5fFi0= -github.com/onsi/ginkgo/v2 v2.22.1 h1:QW7tbJAUDyVDVOM5dFa7qaybo+CRfR7bemlQUN6Z8aM= -github.com/onsi/ginkgo/v2 v2.22.1/go.mod h1:S6aTpoRsSq2cZOd+pssHAlKW/Q/jZt6cPrPlnj4a1xM= +github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU= +github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk= github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/perses/common v0.26.0 h1:szF3GFTUgsCts3VYU3QY9OfgnYerjzHl9bo9pk4ZGyM= From 4ea293a39675f5ff18cee64fe87999010bfc7f97 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 22:23:44 +0000 Subject: [PATCH 16/38] Bump sigs.k8s.io/controller-runtime from 0.19.3 to 0.19.4 Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.19.3 to 0.19.4. - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.19.3...v0.19.4) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 26f1751..e8858b0 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( k8s.io/api v0.32.0 k8s.io/apimachinery v0.32.0 k8s.io/client-go v0.32.0 - sigs.k8s.io/controller-runtime v0.19.3 + sigs.k8s.io/controller-runtime v0.19.4 ) require ( diff --git a/go.sum b/go.sum index 8fa86ab..46578ee 100644 --- a/go.sum +++ b/go.sum @@ -398,8 +398,8 @@ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.19.3 h1:XO2GvC9OPftRst6xWCpTgBZO04S2cbp0Qqkj8bX1sPw= -sigs.k8s.io/controller-runtime v0.19.3/go.mod h1:j4j87DqtsThvwTv5/Tc5NFRyyF/RF0ip4+62tbTSIUM= +sigs.k8s.io/controller-runtime v0.19.4 h1:SUmheabttt0nx8uJtoII4oIP27BVVvAKFvdvGFwV/Qo= +sigs.k8s.io/controller-runtime v0.19.4/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= From 121ed46a0876d0f3599ea6ba946f4a3d3ddcab0b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:08:16 +0100 Subject: [PATCH 17/38] Bump github.com/perses/perses from 0.50.0-rc.0 to 0.50.0 (#52) Bumps [github.com/perses/perses](https://github.com/perses/perses) from 0.50.0-rc.0 to 0.50.0. - [Release notes](https://github.com/perses/perses/releases) - [Changelog](https://github.com/perses/perses/blob/main/CHANGELOG.md) - [Commits](https://github.com/perses/perses/compare/v0.50.0-rc.0...v0.50.0) --- updated-dependencies: - dependency-name: github.com/perses/perses dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5518fe1..a12b92b 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/brunoga/deep v1.2.4 github.com/onsi/ginkgo/v2 v2.22.2 github.com/onsi/gomega v1.36.2 - github.com/perses/perses v0.50.0-rc.0 + github.com/perses/perses v0.50.0 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index cb748c0..c898f75 100644 --- a/go.sum +++ b/go.sum @@ -204,8 +204,8 @@ github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/perses/common v0.26.0 h1:szF3GFTUgsCts3VYU3QY9OfgnYerjzHl9bo9pk4ZGyM= github.com/perses/common v0.26.0/go.mod h1:5vlqNPN6i73VJprx7XA7EulzcbKmnV63jrqnyT27B+E= -github.com/perses/perses v0.50.0-rc.0 h1:EfLEqqy2hMF9ymGkvsgCodCPg8o3Xcl9F715t6IRql0= -github.com/perses/perses v0.50.0-rc.0/go.mod h1:L6bykOUCMAI6CzGSMpK5EWT9ghBUHKxRP91LDCPpXW4= +github.com/perses/perses v0.50.0 h1:u3xDtHqZOEnPLCccEP27BrHhB7ELAlzkJJlc3afWvFA= +github.com/perses/perses v0.50.0/go.mod h1:L6bykOUCMAI6CzGSMpK5EWT9ghBUHKxRP91LDCPpXW4= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= From efba345d5887381a1b26af54cf3f2b849e3060a3 Mon Sep 17 00:00:00 2001 From: Akshay Iyyadurai Balasundaram Date: Sun, 19 Jan 2025 12:40:23 +0100 Subject: [PATCH 18/38] chore(local-setup) use podman only when it is running Signed-off-by: Akshay Iyyadurai Balasundaram --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index abca920..5778a4d 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ DATE := $(shell date +%Y-%m-%d) export DATE # CONTAINER_RUNTIME defines the container runtime to use for building the bundle image. -CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker) +CONTAINER_RUNTIME := $(shell if podman ps >/dev/null 2>&1; then echo podman; else echo docker; fi) # 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") From 8c92f87f8f5462575e4136207ee9b33bff685f2b Mon Sep 17 00:00:00 2001 From: Akshay Iyyadurai Balasundaram Date: Sun, 19 Jan 2025 13:01:31 +0100 Subject: [PATCH 19/38] feat(local-setup) add container runtime check and fallback mechanism Signed-off-by: Akshay Iyyadurai Balasundaram --- Makefile | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5778a4d..bfa2306 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,20 @@ DATE := $(shell date +%Y-%m-%d) export DATE # CONTAINER_RUNTIME defines the container runtime to use for building the bundle image. -CONTAINER_RUNTIME := $(shell if podman ps >/dev/null 2>&1; then echo podman; else echo docker; fi) +.PHONY: check-container-runtime +check-container-runtime: + @if podman ps >/dev/null 2>&1; then \ + echo "Using podman as container runtime"; \ + echo podman > .container_runtime; \ + elif docker ps >/dev/null 2>&1; then \ + echo "Using docker as container runtime"; \ + echo docker > .container_runtime; \ + else \ + echo "Error: Neither podman nor docker daemon is running" >&2; \ + exit 1; \ + fi + +CONTAINER_RUNTIME := $(shell cat .container_runtime 2>/dev/null || echo docker) # 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") @@ -154,7 +167,7 @@ image-build: build test ## Build docker image with the manager. ${CONTAINER_RUNTIME} build -f Dockerfile -t ${IMG} . .PHONY: test-image-build -test-image-build: test ## Build a testing docker image with the manager. +test-image-build: check-container-runtime test ## Build a testing docker image with the manager. ${CONTAINER_RUNTIME} build -f Dockerfile.dev -t ${IMG} . .PHONY: image-push From 3f17c3da11a6da3ecaef804811ad9a7acccd42cf Mon Sep 17 00:00:00 2001 From: Akshay Iyyadurai Balasundaram Date: Mon, 20 Jan 2025 10:15:28 +0100 Subject: [PATCH 20/38] feat(local-setup) enhance container runtime check output and formatting Signed-off-by: Akshay Iyyadurai Balasundaram --- Makefile | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index bfa2306..225b6d2 100644 --- a/Makefile +++ b/Makefile @@ -13,16 +13,26 @@ export DATE .PHONY: check-container-runtime check-container-runtime: @if podman ps >/dev/null 2>&1; then \ - echo "Using podman as container runtime"; \ - echo podman > .container_runtime; \ + echo ""; \ + echo "============================================"; \ + echo " ✅ Using Podman the container runtime"; \ + echo "============================================"; \ + CONTAINER_RUNTIME=podman; \ elif docker ps >/dev/null 2>&1; then \ - echo "Using docker as container runtime"; \ - echo docker > .container_runtime; \ + echo ""; \ + echo "============================================"; \ + echo " ✅ Using Docker the container runtime"; \ + echo "============================================"; \ + CONTAINER_RUNTIME=docker; \ else \ - echo "Error: Neither podman nor docker daemon is running" >&2; \ + echo ""; \ + echo "============================================"; \ + echo " ❌ Neither Podman nor Docker daemon is running"; \ + echo "============================================"; \ exit 1; \ fi + CONTAINER_RUNTIME := $(shell cat .container_runtime 2>/dev/null || echo docker) # CHANNELS define the bundle channels used in the bundle. From 06346eeab659b544a977f1530d1adc3414925a85 Mon Sep 17 00:00:00 2001 From: Gabriel Bernal Date: Thu, 16 Jan 2025 15:40:40 +0100 Subject: [PATCH 21/38] add PVC, fix security defaults and add testing namespace Signed-off-by: Gabriel Bernal --- Makefile | 2 - README.md | 17 +- config/manager/manager.yaml | 4 - config/rbac/role.yaml | 2 +- .../samples/perses.dev_v1alpha1_perses.yaml | 1 + .../perses.dev_v1alpha1_persesdashboard.yaml | 1 + .../perses.dev_v1alpha1_persesdatasource.yaml | 1 + .../dashboards/dashboard_controller.go | 6 +- .../dashboards/persesdashboard_controller.go | 4 +- .../datasources/datasource_controller.go | 6 +- controllers/perses/deployment_controller.go | 33 ++- controllers/perses/perses_controller.go | 5 +- controllers/perses/statefulset_controller.go | 253 ++++++++++++++++++ controllers/perses_controller_test.go | 30 ++- go.mod | 2 +- internal/perses/common/labels.go | 4 + main.go | 2 +- 17 files changed, 335 insertions(+), 38 deletions(-) create mode 100644 controllers/perses/statefulset_controller.go diff --git a/Makefile b/Makefile index abca920..e6a03e5 100644 --- a/Makefile +++ b/Makefile @@ -178,8 +178,6 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla - docker buildx rm project-v3-builder rm Dockerfile.cross -##@ Deployment - ifndef ignore-not-found ignore-not-found = false endif diff --git a/README.md b/README.md index 1e77b53..2ae0a66 100644 --- a/README.md +++ b/README.md @@ -16,22 +16,29 @@ You’ll need: make install ``` -2. Install custom resources: +2. Create a namespace for the resources: +```sh +kubectl create namespace perses-dev +``` + +3. Install custom resources: ```sh kubectl apply -k config/samples ``` -3. Using the the location specified by `IMG`, build a testing image and push it to the registry, then deploy the controller to the cluster: +4. Using the the location specified by `IMG`, build a testing image and push it to the registry, then deploy the controller to the cluster: ```sh IMG=/perses-operator:tag make test-image-build image-push deploy ``` -4. Port forward the service so you can access the Perses UI at `http://localhost:8080`: +> **Note:** If you already have an image built, you can deploy it to the cluster using `IMG=/perses-operator:tag make deploy`. + +5. Port forward the service so you can access the Perses UI at `http://localhost:8080`: ```sh -kubectl port-forward svc/perses-sample 8080:8080 +kubectl -n perses-dev port-forward svc/perses-sample 8080:8080 ``` ### Uninstall CRDs @@ -102,7 +109,7 @@ More information can be found via the [Kubebuilder Documentation](https://book.k ## License -Copyright 2023 The Perses Authors. +Copyright 2025 The Perses Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 1938bc5..67cbc34 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -56,10 +56,6 @@ spec: # operator: In # values: # - linux - securityContext: - runAsNonRoot: true - runAsGroup: 65532 - runAsUser: 65532 containers: - args: - --leader-elect diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index c8b14ef..541dd71 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -9,6 +9,7 @@ rules: - apps resources: - deployments + - statefulsets verbs: - create - delete @@ -27,7 +28,6 @@ rules: - apiGroups: - "" resources: - - deployments - services - configmaps verbs: diff --git a/config/samples/perses.dev_v1alpha1_perses.yaml b/config/samples/perses.dev_v1alpha1_perses.yaml index c653ebc..5ce57a0 100644 --- a/config/samples/perses.dev_v1alpha1_perses.yaml +++ b/config/samples/perses.dev_v1alpha1_perses.yaml @@ -8,6 +8,7 @@ metadata: app.kubernetes.io/managed-by: kustomize app.kubernetes.io/created-by: perses-operator name: perses-sample + namespace: perses-dev spec: config: database: diff --git a/config/samples/perses.dev_v1alpha1_persesdashboard.yaml b/config/samples/perses.dev_v1alpha1_persesdashboard.yaml index 6a7d9e6..92cf90b 100644 --- a/config/samples/perses.dev_v1alpha1_persesdashboard.yaml +++ b/config/samples/perses.dev_v1alpha1_persesdashboard.yaml @@ -8,6 +8,7 @@ metadata: app.kubernetes.io/managed-by: kustomize app.kubernetes.io/created-by: perses-operator name: perses-dashboard-sample + namespace: perses-dev spec: display: name: Perses Dashboard Sample diff --git a/config/samples/perses.dev_v1alpha1_persesdatasource.yaml b/config/samples/perses.dev_v1alpha1_persesdatasource.yaml index e77a944..83a71ef 100644 --- a/config/samples/perses.dev_v1alpha1_persesdatasource.yaml +++ b/config/samples/perses.dev_v1alpha1_persesdatasource.yaml @@ -8,6 +8,7 @@ metadata: app.kubernetes.io/managed-by: kustomize app.kubernetes.io/created-by: perses-operator name: perses-datasource-sample + namespace: perses-dev spec: display: name: "Default Datasource" diff --git a/controllers/dashboards/dashboard_controller.go b/controllers/dashboards/dashboard_controller.go index 5600858..ab406dd 100644 --- a/controllers/dashboards/dashboard_controller.go +++ b/controllers/dashboards/dashboard_controller.go @@ -39,12 +39,12 @@ func (r *PersesDashboardReconciler) reconcileDashboardInAllInstances(ctx context err := r.Client.List(ctx, persesInstances, opts...) if err != nil { dlog.WithError(err).Error("Failed to get perses instances") - return subreconciler.RequeueWithError(err) + return subreconciler.RequeueWithDelayAndError(time.Minute, err) } if len(persesInstances.Items) == 0 { - dlog.Info("No Perses instances found") - return subreconciler.DoNotRequeue() + dlog.Info("No Perses instances found, retrying in 1 minute") + return subreconciler.RequeueWithDelay(time.Minute) } dashboard := &persesv1alpha1.PersesDashboard{} diff --git a/controllers/dashboards/persesdashboard_controller.go b/controllers/dashboards/persesdashboard_controller.go index 6386d00..bd9984e 100644 --- a/controllers/dashboards/persesdashboard_controller.go +++ b/controllers/dashboards/persesdashboard_controller.go @@ -84,8 +84,8 @@ func (r *PersesDashboardReconciler) handleDelete(ctx context.Context, req ctrl.R if err := r.Get(ctx, req.NamespacedName, dashboard); err != nil { if !apierrors.IsNotFound(err) { - log.WithError(err).Error("Failed to get perses dashboard") - return subreconciler.RequeueWithError(err) + dlog.Info("No Perses instances found, retrying in 1 minute") + return subreconciler.RequeueWithDelay(time.Minute) } log.Infof("perses dashboard resource not found. Deleting '%s' in '%s'", req.Name, req.Namespace) diff --git a/controllers/datasources/datasource_controller.go b/controllers/datasources/datasource_controller.go index 305d0ad..e40caa8 100644 --- a/controllers/datasources/datasource_controller.go +++ b/controllers/datasources/datasource_controller.go @@ -39,12 +39,12 @@ func (r *PersesDatasourceReconciler) reconcileDatasourcesInAllInstances(ctx cont err := r.Client.List(ctx, persesInstances, opts...) if err != nil { dlog.WithError(err).Error("Failed to get perses instances") - return subreconciler.RequeueWithError(err) + return subreconciler.RequeueWithDelayAndError(time.Minute, err) } if len(persesInstances.Items) == 0 { - dlog.Info("No Perses instances found") - return subreconciler.DoNotRequeue() + dlog.Info("No Perses instances found, requeue in 1 minute") + return subreconciler.RequeueWithDelay(time.Minute) } datasource := &persesv1alpha1.PersesDatasource{} diff --git a/controllers/perses/deployment_controller.go b/controllers/perses/deployment_controller.go index 8d87f5d..9604127 100644 --- a/controllers/perses/deployment_controller.go +++ b/controllers/perses/deployment_controller.go @@ -32,6 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" ) @@ -44,6 +45,22 @@ func (r *PersesReconciler) reconcileDeployment(ctx context.Context, req ctrl.Req return r, err } + if perses.Spec.Config.Database.SQL == nil { + stlog.Info("Database SQL configuration is not set, skipping Deployment creation") + + found := &appsv1.Deployment{} + err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found) + if err == nil { + stlog.Info("Deleting Deployment since database configuration changed") + if err := r.Delete(ctx, found); err != nil { + stlog.WithError(err).Error("Failed to delete Deployment") + return subreconciler.RequeueWithError(err) + } + } + + return subreconciler.ContinueReconciling() + } + found := &appsv1.Deployment{} err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found) if err != nil && apierrors.IsNotFound(err) { @@ -139,8 +156,6 @@ func (r *PersesReconciler) createPersesDeployment( // }, //}, SecurityContext: &corev1.PodSecurityContext{ - RunAsNonRoot: &[]bool{true}[0], - RunAsUser: &[]int64{65534}[0], SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, }, @@ -150,7 +165,6 @@ func (r *PersesReconciler) createPersesDeployment( Name: "perses", ImagePullPolicy: corev1.PullIfNotPresent, SecurityContext: &corev1.SecurityContext{ - RunAsNonRoot: &[]bool{true}[0], AllowPrivilegeEscalation: &[]bool{false}[0], Capabilities: &corev1.Capabilities{ Drop: []corev1.Capability{ @@ -174,6 +188,11 @@ func (r *PersesReconciler) createPersesDeployment( ReadOnly: true, MountPath: "/perses/config", }, + { + Name: "storage", + ReadOnly: false, + MountPath: "/etc/perses/storage", + }, }, Args: []string{"--config=/perses/config/config.yaml"}, }}, @@ -185,10 +204,16 @@ func (r *PersesReconciler) createPersesDeployment( LocalObjectReference: corev1.LocalObjectReference{ Name: configName, }, - DefaultMode: &[]int32{420}[0], + DefaultMode: ptr.To[int32](420), }, }, }, + { + Name: "storage", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, + }, // { // Name: "serving-cert", // VolumeSource: corev1.VolumeSource{ diff --git a/controllers/perses/perses_controller.go b/controllers/perses/perses_controller.go index 7286011..8bb5062 100644 --- a/controllers/perses/perses_controller.go +++ b/controllers/perses/perses_controller.go @@ -56,10 +56,9 @@ var log = logger.WithField("module", "perses_controller") // +kubebuilder:rbac:groups=perses.dev,resources=perses/status,verbs=get;update;patch // +kubebuilder:rbac:groups=perses.dev,resources=perses/finalizers,verbs=update // +kubebuilder:rbac:groups=core,resources=events,verbs=create;patch -// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=apps,resources=deployments;statefulsets,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=core,resources=pods,verbs=get;list;watch func (r *PersesReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - subreconcilersForPerses := []subreconciler.FnWithRequest{ r.setStatusToUnknown, r.addFinalizer, @@ -67,6 +66,7 @@ func (r *PersesReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr r.reconcileService, r.reconcileConfigMap, r.reconcileDeployment, + r.reconcileStatefulSet, } // Run all subreconcilers sequentially @@ -241,6 +241,7 @@ func (r *PersesReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&v1alpha1.Perses{}). Owns(&appsv1.Deployment{}). + Owns(&appsv1.StatefulSet{}). Owns(&corev1.ConfigMap{}). Owns(&corev1.Service{}). Complete(r) diff --git a/controllers/perses/statefulset_controller.go b/controllers/perses/statefulset_controller.go new file mode 100644 index 0000000..72b6ba4 --- /dev/null +++ b/controllers/perses/statefulset_controller.go @@ -0,0 +1,253 @@ +/* +Copyright 2025 The Perses 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 perses + +import ( + "context" + "fmt" + "time" + + "github.com/perses/perses-operator/api/v1alpha1" + "github.com/perses/perses-operator/internal/perses/common" + "github.com/perses/perses-operator/internal/subreconciler" + logger "github.com/sirupsen/logrus" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" + ctrl "sigs.k8s.io/controller-runtime" +) + +var stlog = logger.WithField("module", "statefulset_controller") + +func (r *PersesReconciler) reconcileStatefulSet(ctx context.Context, req ctrl.Request) (*ctrl.Result, error) { + perses := &v1alpha1.Perses{} + + if r, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(r, err) { + return r, err + } + + if perses.Spec.Config.Database.File == nil { + stlog.Info("Database file configuration is not set, skipping StatefulSet creation") + + found := &appsv1.StatefulSet{} + err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found) + if err == nil { + stlog.Info("Deleting StatefulSet since database configuration changed") + if err := r.Delete(ctx, found); err != nil { + stlog.WithError(err).Error("Failed to delete StatefulSet") + return subreconciler.RequeueWithError(err) + } + } + + return subreconciler.ContinueReconciling() + } + + found := &appsv1.StatefulSet{} + err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found) + if err != nil && apierrors.IsNotFound(err) { + + dep, err := r.createPersesStatefulSet(perses) + if err != nil { + stlog.WithError(err).Error("Failed to define new StatefulSet resource for perses") + + meta.SetStatusCondition(&perses.Status.Conditions, metav1.Condition{Type: common.TypeAvailablePerses, + Status: metav1.ConditionFalse, Reason: "Reconciling", + Message: fmt.Sprintf("Failed to create StatefulSet for the custom resource (%s): (%s)", perses.Name, err)}) + + if err := r.Status().Update(ctx, perses); err != nil { + stlog.Error(err, "Failed to update perses status") + return subreconciler.RequeueWithError(err) + } + + return subreconciler.RequeueWithError(err) + } + + stlog.Infof("Creating a new StatefulSet: StatefulSet.Namespace %s StatefulSet.Name %s", dep.Namespace, dep.Name) + if err = r.Create(ctx, dep); err != nil { + stlog.WithError(err).Errorf("Failed to create new StatefulSet: StatefulSet.Namespace %s StatefulSet.Name %s", dep.Namespace, dep.Name) + return subreconciler.RequeueWithError(err) + } + + return subreconciler.RequeueWithDelay(time.Minute) + } else if err != nil { + stlog.WithError(err).Error("Failed to get StatefulSet") + + return subreconciler.RequeueWithError(err) + } + + return subreconciler.ContinueReconciling() +} + +func (r *PersesReconciler) createPersesStatefulSet( + perses *v1alpha1.Perses) (*appsv1.StatefulSet, error) { + configName := common.GetConfigName(perses.Name) + + ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name) + if err != nil { + return nil, err + } + + // Get the Operand image + image, err := common.ImageForPerses(r.Config.PersesImage) + if err != nil { + return nil, err + } + + storageName := common.GetStorageName(perses.Name) + + dep := &appsv1.StatefulSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: perses.Name, + Namespace: perses.Namespace, + Labels: ls, + }, + Spec: appsv1.StatefulSetSpec{ + Selector: &metav1.LabelSelector{ + MatchLabels: ls, + }, + Template: corev1.PodTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ + Labels: ls, + }, + Spec: corev1.PodSpec{ + // TODO(user): Uncomment the following code to configure the nodeAffinity expression + // according to the platforms which are supported by your solution. It is considered + // best practice to support multiple architectures. build your manager image using the + // makefile target docker-buildx. Also, you can use docker manifest inspect + // to check what are the platforms supported. + // More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity + //Affinity: &corev1.Affinity{ + // NodeAffinity: &corev1.NodeAffinity{ + // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ + // NodeSelectorTerms: []corev1.NodeSelectorTerm{ + // { + // MatchExpressions: []corev1.NodeSelectorRequirement{ + // { + // Key: "kubernetes.io/arch", + // Operator: "In", + // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, + // }, + // { + // Key: "kubernetes.io/os", + // Operator: "In", + // Values: []string{"linux"}, + // }, + // }, + // }, + // }, + // }, + // }, + //}, + SecurityContext: &corev1.PodSecurityContext{ + SeccompProfile: &corev1.SeccompProfile{ + Type: corev1.SeccompProfileTypeRuntimeDefault, + }, + }, + Containers: []corev1.Container{{ + Image: image, + Name: "perses", + ImagePullPolicy: corev1.PullIfNotPresent, + SecurityContext: &corev1.SecurityContext{ + AllowPrivilegeEscalation: &[]bool{false}[0], + Capabilities: &corev1.Capabilities{ + Drop: []corev1.Capability{ + "ALL", + }, + }, + }, + Ports: []corev1.ContainerPort{{ + ContainerPort: perses.Spec.ContainerPort, + Name: "perses", + }}, + VolumeMounts: []corev1.VolumeMount{ + // TODO: check if perses supports passing certificates for TLS + // { + // Name: "serving-cert", + // ReadOnly: true, + // MountPath: "/var/serving-cert", + // }, + { + Name: "config", + ReadOnly: true, + MountPath: "/perses/config", + }, + { + Name: storageName, + ReadOnly: false, + MountPath: "/etc/perses/storage", + }, + }, + Args: []string{"--config=/perses/config/config.yaml"}, + }}, + Volumes: []corev1.Volume{ + { + Name: "config", + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: configName, + }, + DefaultMode: ptr.To[int32](420), + }, + }, + }, + // { + // Name: "serving-cert", + // VolumeSource: corev1.VolumeSource{ + // Secret: &corev1.SecretVolumeSource{ + // SecretName: "perses-serving-cert", + // DefaultMode: &[]int32{420}[0], + // }, + // }, + // }, + }, + RestartPolicy: "Always", + DNSPolicy: "ClusterFirst", + }, + }, + VolumeClaimTemplates: []corev1.PersistentVolumeClaim{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: storageName, + }, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{ + corev1.ReadWriteOnce, + }, + Resources: corev1.VolumeResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceStorage: resource.MustParse("1Gi"), + }, + }, + }, + }, + }, + }, + } + + // Set the ownerRef for the StatefulSet + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/ + if err := ctrl.SetControllerReference(perses, dep, r.Scheme); err != nil { + return nil, err + } + return dep, nil +} diff --git a/controllers/perses_controller_test.go b/controllers/perses_controller_test.go index 536daa8..b3d5445 100644 --- a/controllers/perses_controller_test.go +++ b/controllers/perses_controller_test.go @@ -11,6 +11,7 @@ import ( persesv1alpha1 "github.com/perses/perses-operator/api/v1alpha1" persescontroller "github.com/perses/perses-operator/controllers/perses" "github.com/perses/perses-operator/internal/perses/common" + persesconfig "github.com/perses/perses/pkg/model/api/config" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -66,6 +67,15 @@ var _ = Describe("Perses controller", func() { }, Spec: persesv1alpha1.PersesSpec{ ContainerPort: 8080, + Config: persesv1alpha1.PersesConfig{ + Config: persesconfig.Config{ + Database: persesconfig.Database{ + File: &persesconfig.File{ + Folder: "/etc/perses/storage", + }, + }, + }, + }, }, } @@ -119,23 +129,23 @@ var _ = Describe("Perses controller", func() { return k8sClient.Get(ctx, configMapNamespaceName, found) }, time.Minute*3, time.Second).Should(Succeed()) - By("Checking if Deployment was successfully created in the reconciliation") + By("Checking if StatefulSet was successfully created in the reconciliation") Eventually(func() error { - found := &appsv1.Deployment{} + found := &appsv1.StatefulSet{} err = k8sClient.Get(ctx, typeNamespaceName, found) if err == nil { if len(found.Spec.Template.Spec.Containers) < 1 { - return fmt.Errorf("The number of containers used in the deployment is not the one expected") + return fmt.Errorf("The number of containers used in the StatefulSet is not the one expected") } if found.Spec.Template.Spec.Containers[0].Image != persesImage { - return fmt.Errorf("The image used in the deployment is not the one expected") + return fmt.Errorf("The image used in the StatefulSet is not the one expected") } if len(found.Spec.Template.Spec.Containers[0].Ports) < 1 && found.Spec.Template.Spec.Containers[0].Ports[0].ContainerPort != 8080 { - return fmt.Errorf("The port used in the deployment is not the one defined in the custom resource") + return fmt.Errorf("The port used in the StatefulSet is not the one defined in the custom resource") } if len(found.Spec.Template.Spec.Containers[0].Args) < 1 && found.Spec.Template.Spec.Containers[0].Args[0] != "--config=/etc/perses/config/config.yaml" { - return fmt.Errorf("The config path used in the deployment is not the one defined in the custom resource") + return fmt.Errorf("The config path used in the StatefulSet is not the one defined in the custom resource") } } @@ -148,7 +158,7 @@ var _ = Describe("Perses controller", func() { latestStatusCondition := perses.Status.Conditions[len(perses.Status.Conditions)-1] expectedLatestStatusCondition := metav1.Condition{Type: common.TypeAvailablePerses, Status: metav1.ConditionTrue, Reason: "Reconciling", - Message: fmt.Sprintf("Deployment for custom resource (%s) created successfully", perses.Name)} + Message: fmt.Sprintf("StatefulSet for custom resource (%s) created successfully", perses.Name)} if latestStatusCondition != expectedLatestStatusCondition { return fmt.Errorf("The latest status condition added to the perses instance is not as expected") } @@ -164,15 +174,15 @@ var _ = Describe("Perses controller", func() { err = k8sClient.Delete(ctx, persesToDelete) Expect(err).To(Not(HaveOccurred())) - By("Checking if Deployment was successfully deleted in the reconciliation") + By("Checking if StatefulSet was successfully deleted in the reconciliation") Eventually(func() error { - found := &appsv1.Deployment{} + found := &appsv1.StatefulSet{} return k8sClient.Get(ctx, typeNamespaceName, found) }, time.Minute, time.Second).Should(Succeed()) By("Checking if Service was successfully deleted in the reconciliation") Eventually(func() error { - found := &appsv1.Deployment{} + found := &corev1.Service{} return k8sClient.Get(ctx, typeNamespaceName, found) }, time.Minute, time.Second).Should(Succeed()) diff --git a/go.mod b/go.mod index 5518fe1..1a32ee7 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,7 @@ require ( k8s.io/api v0.32.0 k8s.io/apimachinery v0.32.0 k8s.io/client-go v0.32.0 + k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 sigs.k8s.io/controller-runtime v0.19.4 ) @@ -133,7 +134,6 @@ require ( k8s.io/apiextensions-apiserver v0.31.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect - k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect sigs.k8s.io/yaml v1.4.0 // indirect diff --git a/internal/perses/common/labels.go b/internal/perses/common/labels.go index 30295fe..99abc47 100644 --- a/internal/perses/common/labels.go +++ b/internal/perses/common/labels.go @@ -70,3 +70,7 @@ func ImageForPerses(persesImageFromFlags string) (string, error) { func GetConfigName(instanceName string) string { return fmt.Sprintf("%s-config", instanceName) } + +func GetStorageName(instanceName string) string { + return fmt.Sprintf("%s-storage", instanceName) +} diff --git a/main.go b/main.go index 715c617..ce80f98 100644 --- a/main.go +++ b/main.go @@ -67,7 +67,7 @@ func main() { flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") - flag.StringVar(&persesImage, "perses-default-base-image", "docker.io/persesdev/perses:latest", "The default image used for the Perses deployment operands") + flag.StringVar(&persesImage, "perses-default-base-image", "docker.io/persesdev/perses:latest", "The default image used for the Perses Deployment or StatefulSet operands") flag.StringVar(&persesServerURL, "perses-server-url", "", "The Perses backend server URL") flag.BoolVar(&enableHTTP2, "enable-http2", enableHTTP2, "If HTTP/2 should be enabled for the metrics and webhook servers.") opts := zap.Options{ From d7039703c3e52a871d3fe1ae2aa9861c648bc012 Mon Sep 17 00:00:00 2001 From: Akshay Iyyadurai Balasundaram Date: Mon, 20 Jan 2025 16:51:22 +0100 Subject: [PATCH 22/38] feat(local-setup) streamline container runtime detection and usage in Makefile Signed-off-by: Akshay Iyyadurai Balasundaram --- Makefile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 225b6d2..ea6a7c3 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ VERSION ?= 0.1.0 DATE := $(shell date +%Y-%m-%d) export DATE -# CONTAINER_RUNTIME defines the container runtime to use for building the bundle image. + .PHONY: check-container-runtime check-container-runtime: @if podman ps >/dev/null 2>&1; then \ @@ -17,13 +17,11 @@ check-container-runtime: echo "============================================"; \ echo " ✅ Using Podman the container runtime"; \ echo "============================================"; \ - CONTAINER_RUNTIME=podman; \ elif docker ps >/dev/null 2>&1; then \ echo ""; \ echo "============================================"; \ echo " ✅ Using Docker the container runtime"; \ echo "============================================"; \ - CONTAINER_RUNTIME=docker; \ else \ echo ""; \ echo "============================================"; \ @@ -32,8 +30,8 @@ check-container-runtime: exit 1; \ fi - -CONTAINER_RUNTIME := $(shell cat .container_runtime 2>/dev/null || echo docker) +# CONTAINER_RUNTIME defines the container runtime to use for building the bundle image. +CONTAINER_RUNTIME := $(shell if podman ps >/dev/null 2>&1; then echo podman; elif docker ps >/dev/null 2>&1; then echo docker; fi) # 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") @@ -173,7 +171,7 @@ run: manifests generate fmt vet ## Run a controller from your host. # (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it. # More info: https://docs.docker.com/develop/develop-images/build_enhancements/ .PHONY: image-build -image-build: build test ## Build docker image with the manager. +image-build: check-container-runtime build test ## Build docker image with the manager. ${CONTAINER_RUNTIME} build -f Dockerfile -t ${IMG} . .PHONY: test-image-build @@ -327,7 +325,7 @@ endif # This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see: # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator .PHONY: catalog-build -catalog-build: opm ## Build a catalog image. +catalog-build: check-container-runtime opm ## Build a catalog image. $(OPM) index add --container-tool $(CONTAINER_RUNTIME) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) # Push the catalog image. From 23e4475c6d15045cd41b410146318a8135791e98 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 22:34:59 +0000 Subject: [PATCH 23/38] Bump golangci/golangci-lint-action from 6.1.1 to 6.2.0 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.1.1 to 6.2.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6.1.1...v6.2.0) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4d8ec46..ec45b1e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -55,7 +55,7 @@ jobs: - name: generate files run: make generate - name: golangci-lint - uses: golangci/golangci-lint-action@v6.1.1 + uses: golangci/golangci-lint-action@v6.2.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.61.0 From ed61e5829002d739e6542bda82b5da456bf42a19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 08:23:30 +0000 Subject: [PATCH 24/38] Bump the k8s-io group with 3 updates Bumps the k8s-io group with 3 updates: [k8s.io/api](https://github.com/kubernetes/api), [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go). Updates `k8s.io/api` from 0.32.0 to 0.32.1 - [Commits](https://github.com/kubernetes/api/compare/v0.32.0...v0.32.1) Updates `k8s.io/apimachinery` from 0.32.0 to 0.32.1 - [Commits](https://github.com/kubernetes/apimachinery/compare/v0.32.0...v0.32.1) Updates `k8s.io/client-go` from 0.32.0 to 0.32.1 - [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/kubernetes/client-go/compare/v0.32.0...v0.32.1) --- updated-dependencies: - dependency-name: k8s.io/api dependency-type: direct:production update-type: version-update:semver-patch dependency-group: k8s-io - dependency-name: k8s.io/apimachinery dependency-type: direct:production update-type: version-update:semver-patch dependency-group: k8s-io - dependency-name: k8s.io/client-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: k8s-io ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 779ac7d..6b161bf 100644 --- a/go.mod +++ b/go.mod @@ -12,9 +12,9 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 gopkg.in/yaml.v2 v2.4.0 - k8s.io/api v0.32.0 - k8s.io/apimachinery v0.32.0 - k8s.io/client-go v0.32.0 + k8s.io/api v0.32.1 + k8s.io/apimachinery v0.32.1 + k8s.io/client-go v0.32.1 k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 sigs.k8s.io/controller-runtime v0.19.4 ) diff --git a/go.sum b/go.sum index c898f75..5af73cb 100644 --- a/go.sum +++ b/go.sum @@ -384,14 +384,14 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.32.0 h1:OL9JpbvAU5ny9ga2fb24X8H6xQlVp+aJMFlgtQjR9CE= -k8s.io/api v0.32.0/go.mod h1:4LEwHZEf6Q/cG96F3dqR965sYOfmPM7rq81BLgsE0p0= +k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc= +k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k= k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40= k8s.io/apiextensions-apiserver v0.31.1/go.mod h1:tWMPR3sgW+jsl2xm9v7lAyRF1rYEK71i9G5dRtkknoQ= -k8s.io/apimachinery v0.32.0 h1:cFSE7N3rmEEtv4ei5X6DaJPHHX0C+upp+v5lVPiEwpg= -k8s.io/apimachinery v0.32.0/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= -k8s.io/client-go v0.32.0 h1:DimtMcnN/JIKZcrSrstiwvvZvLjG0aSxy8PxN8IChp8= -k8s.io/client-go v0.32.0/go.mod h1:boDWvdM1Drk4NJj/VddSLnx59X3OPgwrOo0vGbtq9+8= +k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= +k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= +k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU= +k8s.io/client-go v0.32.1/go.mod h1:aTTKZY7MdxUaJ/KiUs8D+GssR9zJZi77ZqtzcGXIiDg= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= From 0452ed39c04f6c3c4ba5fa835b21b547d36d07ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 12:50:57 +0000 Subject: [PATCH 25/38] Bump sigs.k8s.io/controller-runtime from 0.19.4 to 0.20.0 Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.19.4 to 0.20.0. - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.19.4...v0.20.0) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 7 ++++--- go.sum | 12 ++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 6b161bf..2288b89 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( k8s.io/apimachinery v0.32.1 k8s.io/client-go v0.32.1 k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 - sigs.k8s.io/controller-runtime v0.19.4 + sigs.k8s.io/controller-runtime v0.20.0 ) require ( @@ -58,6 +58,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect + github.com/google/btree v1.1.3 // indirect github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -117,9 +118,9 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.31.0 // indirect - golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e // indirect golang.org/x/net v0.33.0 // indirect golang.org/x/oauth2 v0.24.0 // indirect + golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/term v0.27.0 // indirect golang.org/x/text v0.21.0 // indirect @@ -131,7 +132,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.31.1 // indirect + k8s.io/apiextensions-apiserver v0.32.0 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect diff --git a/go.sum b/go.sum index 5af73cb..c1c5b17 100644 --- a/go.sum +++ b/go.sum @@ -102,6 +102,8 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 h1:0VpGH+cDhbDtdcweoyCVsF3fhN8kejK6rFe/2FFX2nU= github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49/go.mod h1:BkkQ4L1KS1xMt2aWSPStnn55ChGC0DPOn2FQYj+f25M= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -315,6 +317,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -386,8 +390,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc= k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k= -k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40= -k8s.io/apiextensions-apiserver v0.31.1/go.mod h1:tWMPR3sgW+jsl2xm9v7lAyRF1rYEK71i9G5dRtkknoQ= +k8s.io/apiextensions-apiserver v0.32.0 h1:S0Xlqt51qzzqjKPxfgX1xh4HBZE+p8KKBq+k2SWNOE0= +k8s.io/apiextensions-apiserver v0.32.0/go.mod h1:86hblMvN5yxMvZrZFX2OhIHAuFIMJIZ19bTvzkP+Fmw= k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU= @@ -398,8 +402,8 @@ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.19.4 h1:SUmheabttt0nx8uJtoII4oIP27BVVvAKFvdvGFwV/Qo= -sigs.k8s.io/controller-runtime v0.19.4/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= +sigs.k8s.io/controller-runtime v0.20.0 h1:jjkMo29xEXH+02Md9qaVXfEIaMESSpy3TBWPrsfQkQs= +sigs.k8s.io/controller-runtime v0.20.0/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= From 11a129d6a639e04922d205bd3933394275bfea8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:11:16 +0000 Subject: [PATCH 26/38] Bump github.com/perses/perses from 0.50.0 to 0.50.1 Bumps [github.com/perses/perses](https://github.com/perses/perses) from 0.50.0 to 0.50.1. - [Release notes](https://github.com/perses/perses/releases) - [Changelog](https://github.com/perses/perses/blob/main/CHANGELOG.md) - [Commits](https://github.com/perses/perses/compare/v0.50.0...v0.50.1) --- updated-dependencies: - dependency-name: github.com/perses/perses dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2288b89..1ec104e 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/brunoga/deep v1.2.4 github.com/onsi/ginkgo/v2 v2.22.2 github.com/onsi/gomega v1.36.2 - github.com/perses/perses v0.50.0 + github.com/perses/perses v0.50.1 github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index c1c5b17..adb9ad8 100644 --- a/go.sum +++ b/go.sum @@ -206,8 +206,8 @@ github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/perses/common v0.26.0 h1:szF3GFTUgsCts3VYU3QY9OfgnYerjzHl9bo9pk4ZGyM= github.com/perses/common v0.26.0/go.mod h1:5vlqNPN6i73VJprx7XA7EulzcbKmnV63jrqnyT27B+E= -github.com/perses/perses v0.50.0 h1:u3xDtHqZOEnPLCccEP27BrHhB7ELAlzkJJlc3afWvFA= -github.com/perses/perses v0.50.0/go.mod h1:L6bykOUCMAI6CzGSMpK5EWT9ghBUHKxRP91LDCPpXW4= +github.com/perses/perses v0.50.1 h1:ySqFYu+/WXVWpDfSBZISN49m5docbrnNvjom7Ym9iNg= +github.com/perses/perses v0.50.1/go.mod h1:L6bykOUCMAI6CzGSMpK5EWT9ghBUHKxRP91LDCPpXW4= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= From dc1a01e3818dcb483ba3ecbf6b79101aad6eca13 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 23:11:22 +0000 Subject: [PATCH 27/38] Bump sigs.k8s.io/controller-runtime from 0.20.0 to 0.20.1 Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.20.0 to 0.20.1. - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.20.0...v0.20.1) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2288b89..40c55c8 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( k8s.io/apimachinery v0.32.1 k8s.io/client-go v0.32.1 k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 - sigs.k8s.io/controller-runtime v0.20.0 + sigs.k8s.io/controller-runtime v0.20.1 ) require ( diff --git a/go.sum b/go.sum index c1c5b17..3861626 100644 --- a/go.sum +++ b/go.sum @@ -402,8 +402,8 @@ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.20.0 h1:jjkMo29xEXH+02Md9qaVXfEIaMESSpy3TBWPrsfQkQs= -sigs.k8s.io/controller-runtime v0.20.0/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU= +sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE= +sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= From 0b3c878a39be92c651a8b5eefb10af2fb2003472 Mon Sep 17 00:00:00 2001 From: Gabriel Bernal Date: Thu, 6 Feb 2025 14:38:34 +0100 Subject: [PATCH 28/38] small installation doc fix Signed-off-by: Gabriel Bernal --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2ae0a66..407a6de 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ kubectl apply -k config/samples ``` 4. Using the the location specified by `IMG`, build a testing image and push it to the registry, then deploy the controller to the cluster: +> **Note:** Make sure the image is accessible either publicly or from the cluster internal registry. ```sh IMG=/perses-operator:tag make test-image-build image-push deploy From 11bc04b1796da73d1f348fd0630ebdddd9d4025b Mon Sep 17 00:00:00 2001 From: Douglass Kirkley Date: Wed, 5 Feb 2025 19:28:42 -0500 Subject: [PATCH 29/38] Add workload configurations to Perses CR Signed-off-by: Douglass Kirkley --- api/v1alpha1/perses_types.go | 17 + api/v1alpha1/zz_generated.deepcopy.go | 67 +- config/crd/bases/perses.dev_perses.yaml | 977 ++++++++++++++++++ .../samples/perses.dev_v1alpha1_perses.yaml | 3 + controllers/perses/configmap_controller.go | 14 +- controllers/perses/deployment_controller.go | 49 +- controllers/perses/service_controller.go | 14 +- controllers/perses/statefulset_controller.go | 49 +- controllers/perses_controller_test.go | 30 + internal/perses/common/labels.go | 20 +- 10 files changed, 1159 insertions(+), 81 deletions(-) diff --git a/api/v1alpha1/perses_types.go b/api/v1alpha1/perses_types.go index aeb87ad..a46c2fd 100644 --- a/api/v1alpha1/perses_types.go +++ b/api/v1alpha1/perses_types.go @@ -17,15 +17,32 @@ limitations under the License. package v1alpha1 import ( + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // PersesSpec defines the desired state of Perses type PersesSpec struct { + // +operator-sdk:csv:customresourcedefinitions:type=spec + Metadata *Metadata `json:"metadata,omitempty"` // +operator-sdk:csv:customresourcedefinitions:type=spec Config PersesConfig `json:"config,omitempty"` // +operator-sdk:csv:customresourcedefinitions:type=spec ContainerPort int32 `json:"containerPort,omitempty"` + // +operator-sdk:csv:customresourcedefinitions:type=spec + Replicas *int32 `json:"replicas,omitempty"` + // +operator-sdk:csv:customresourcedefinitions:type=spec + NodeSelector map[string]string `json:"nodeSelector,omitempty"` + // +operator-sdk:csv:customresourcedefinitions:type=spec + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + // +operator-sdk:csv:customresourcedefinitions:type=spec + Affinity *corev1.Affinity `json:"affinity,omitempty"` +} + +// Metadata to add to deployed pods +type Metadata struct { + Labels map[string]string `json:"labels,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` } // PersesStatus defines the observed state of Perses diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 2b8286d..8ad8e49 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -21,7 +21,8 @@ limitations under the License. package v1alpha1 import ( - "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -45,6 +46,35 @@ func (in *Datasource) DeepCopy() *Datasource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Metadata) DeepCopyInto(out *Metadata) { + *out = *in + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metadata. +func (in *Metadata) DeepCopy() *Metadata { + if in == nil { + return nil + } + out := new(Metadata) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Perses) DeepCopyInto(out *Perses) { *out = *in @@ -146,7 +176,7 @@ func (in *PersesDashboardStatus) DeepCopyInto(out *PersesDashboardStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) + *out = make([]metav1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -227,7 +257,7 @@ func (in *PersesDatasourceStatus) DeepCopyInto(out *PersesDatasourceStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) + *out = make([]metav1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -279,7 +309,36 @@ func (in *PersesList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PersesSpec) DeepCopyInto(out *PersesSpec) { *out = *in + if in.Metadata != nil { + in, out := &in.Metadata, &out.Metadata + *out = new(Metadata) + (*in).DeepCopyInto(*out) + } in.Config.DeepCopyInto(&out.Config) + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + if in.NodeSelector != nil { + in, out := &in.NodeSelector, &out.NodeSelector + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersesSpec. @@ -297,7 +356,7 @@ func (in *PersesStatus) DeepCopyInto(out *PersesStatus) { *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) + *out = make([]metav1.Condition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } diff --git a/config/crd/bases/perses.dev_perses.yaml b/config/crd/bases/perses.dev_perses.yaml index ff6a149..5177283 100644 --- a/config/crd/bases/perses.dev_perses.yaml +++ b/config/crd/bases/perses.dev_perses.yaml @@ -39,6 +39,926 @@ spec: spec: description: PersesSpec defines the desired state of Perses properties: + affinity: + description: Affinity is a group of affinity scheduling rules. + properties: + nodeAffinity: + description: Describes node affinity scheduling rules for the + pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node matches the corresponding matchExpressions; the + node(s) with the highest sum are the most preferred. + items: + description: |- + An empty preferred scheduling term matches all objects with implicit weight 0 + (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated with the + corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching the corresponding + nodeSelectorTerm, in the range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to an update), the system + may or may not try to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector terms. + The terms are ORed. + items: + description: |- + A null or empty node selector term matches no objects. The requirements of + them are ANDed. + The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: |- + A node selector requirement is a selector that contains values, a key, and an operator + that relates the key and values. + properties: + key: + description: The label key that the selector + applies to. + type: string + operator: + description: |- + Represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. + type: string + values: + description: |- + An array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. If the operator is Gt or Lt, the values + array must have a single element, which will be interpreted as an integer. + This array is replaced during a strategic merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + type: object + x-kubernetes-map-type: atomic + type: array + x-kubernetes-list-type: atomic + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. co-locate + this pod in the same node, zone, etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules (e.g. + avoid putting this pod in the same node, zone, etc. as some + other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: |- + The scheduler will prefer to schedule pods to nodes that satisfy + the anti-affinity expressions specified by this field, but it may choose + a node that violates one or more of the expressions. The node that is + most preferred is the one with the greatest sum of weights, i.e. + for each node that meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity expressions, etc.), + compute a sum by iterating through the elements of this field and adding + "weight" to the sum if the node has pods which matches the corresponding podAffinityTerm; the + node(s) with the highest sum are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, associated + with the corresponding weight. + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are + ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that + the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: |- + weight associated with matching the corresponding podAffinityTerm, + in the range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + x-kubernetes-list-type: atomic + requiredDuringSchedulingIgnoredDuringExecution: + description: |- + If the anti-affinity requirements specified by this field are not met at + scheduling time, the pod will not be scheduled onto the node. + If the anti-affinity requirements specified by this field cease to be met + at some point during pod execution (e.g. due to a pod label update), the + system may or may not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes corresponding to each + podAffinityTerm are intersected, i.e. all terms must be satisfied. + items: + description: |- + Defines a set of pods (namely those matching the labelSelector + relative to the given namespace(s)) that this pod should be + co-located (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node whose value of + the label with key matches that of any node on which + a pod of the set of pods is running + properties: + labelSelector: + description: |- + A label query over a set of resources, in this case pods. + If it's null, this PodAffinityTerm matches with no Pods. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: |- + MatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both matchLabelKeys and labelSelector. + Also, matchLabelKeys cannot be set when labelSelector isn't set. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + description: |- + MismatchLabelKeys is a set of pod label keys to select which pods will + be taken into consideration. The keys are used to lookup values from the + incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` + to select the group of existing pods which pods will be taken into consideration + for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming + pod labels will be ignored. The default value is empty. + The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. + Also, mismatchLabelKeys cannot be set when labelSelector isn't set. + This is a beta field and requires enabling MatchLabelKeysInPodAffinity feature gate (enabled by default). + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + description: |- + A label query over the set of namespaces that the term applies to. + The term is applied to the union of the namespaces selected by this field + and the ones listed in the namespaces field. + null selector and null or empty namespaces list means "this pod's namespace". + An empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: |- + namespaces specifies a static list of namespace names that the term applies to. + The term is applied to the union of the namespaces listed in this field + and the ones selected by namespaceSelector. + null or empty namespaces list and null namespaceSelector means "this pod's namespace". + items: + type: string + type: array + x-kubernetes-list-type: atomic + topologyKey: + description: |- + This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching + the labelSelector in the specified namespaces, where co-located is defined as running on a node + whose value of the label with key topologyKey matches that of any node on which any of the + selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: object config: properties: api_prefix: @@ -923,6 +1843,63 @@ spec: containerPort: format: int32 type: integer + metadata: + description: Metadata to add to deployed pods + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + nodeSelector: + additionalProperties: + type: string + type: object + replicas: + format: int32 + type: integer + tolerations: + items: + description: |- + The pod this Toleration is attached to tolerates any taint that matches + the triple using the matching operator . + properties: + effect: + description: |- + Effect indicates the taint effect to match. Empty means match all taint effects. + When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute. + type: string + key: + description: |- + Key is the taint key that the toleration applies to. Empty means match all taint keys. + If the key is empty, operator must be Exists; this combination means to match all values and all keys. + type: string + operator: + description: |- + Operator represents a key's relationship to the value. + Valid operators are Exists and Equal. Defaults to Equal. + Exists is equivalent to wildcard for value, so that a pod can + tolerate all taints of a particular category. + type: string + tolerationSeconds: + description: |- + TolerationSeconds represents the period of time the toleration (which must be + of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, + it is not set, which means tolerate the taint forever (do not evict). Zero and + negative values will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: |- + Value is the taint value the toleration matches to. + If the operator is Exists, the value should be empty, otherwise just a regular string. + type: string + type: object + type: array type: object status: description: PersesStatus defines the observed state of Perses diff --git a/config/samples/perses.dev_v1alpha1_perses.yaml b/config/samples/perses.dev_v1alpha1_perses.yaml index 5ce57a0..ead1e23 100644 --- a/config/samples/perses.dev_v1alpha1_perses.yaml +++ b/config/samples/perses.dev_v1alpha1_perses.yaml @@ -10,6 +10,9 @@ metadata: name: perses-sample namespace: perses-dev spec: + metadata: + labels: + instance: perses-sample config: database: file: diff --git a/controllers/perses/configmap_controller.go b/controllers/perses/configmap_controller.go index 5909a6f..31d239f 100644 --- a/controllers/perses/configmap_controller.go +++ b/controllers/perses/configmap_controller.go @@ -83,12 +83,17 @@ func (r *PersesReconciler) reconcileConfigMap(ctx context.Context, req ctrl.Requ func createPersesConfigMap(r *PersesReconciler, perses *v1alpha1.Perses) (*corev1.ConfigMap, error) { configName := common.GetConfigName(perses.Name) - ls, err := common.LabelsForPerses(r.Config.PersesImage, configName, perses.Name) + ls, err := common.LabelsForPerses(r.Config.PersesImage, configName, perses.Name, perses.Spec.Metadata) if err != nil { return nil, err } + annotations := map[string]string{} + if perses.Spec.Metadata != nil && perses.Spec.Metadata.Annotations != nil { + annotations = perses.Spec.Metadata.Annotations + } + persesConfig, err := yaml.Marshal(perses.Spec.Config.Config) if err != nil { @@ -102,9 +107,10 @@ func createPersesConfigMap(r *PersesReconciler, perses *v1alpha1.Perses) (*corev cm := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ - Name: configName, - Namespace: perses.Namespace, - Labels: ls, + Name: configName, + Namespace: perses.Namespace, + Annotations: annotations, + Labels: ls, }, Data: configData, } diff --git a/controllers/perses/deployment_controller.go b/controllers/perses/deployment_controller.go index 9604127..4a91ce9 100644 --- a/controllers/perses/deployment_controller.go +++ b/controllers/perses/deployment_controller.go @@ -101,11 +101,16 @@ func (r *PersesReconciler) createPersesDeployment( perses *v1alpha1.Perses) (*appsv1.Deployment, error) { configName := common.GetConfigName(perses.Name) - ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name) + ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name, perses.Spec.Metadata) if err != nil { return nil, err } + annotations := map[string]string{} + if perses.Spec.Metadata != nil && perses.Spec.Metadata.Annotations != nil { + annotations = perses.Spec.Metadata.Annotations + } + // Get the Operand image image, err := common.ImageForPerses(r.Config.PersesImage) if err != nil { @@ -114,47 +119,25 @@ func (r *PersesReconciler) createPersesDeployment( dep := &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ - Name: perses.Name, - Namespace: perses.Namespace, - Labels: ls, + Name: perses.Name, + Namespace: perses.Namespace, + Annotations: annotations, + Labels: ls, }, Spec: appsv1.DeploymentSpec{ Selector: &metav1.LabelSelector{ MatchLabels: ls, }, + Replicas: perses.Spec.Replicas, Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: ls, + Annotations: annotations, + Labels: ls, }, Spec: corev1.PodSpec{ - // TODO(user): Uncomment the following code to configure the nodeAffinity expression - // according to the platforms which are supported by your solution. It is considered - // best practice to support multiple architectures. build your manager image using the - // makefile target docker-buildx. Also, you can use docker manifest inspect - // to check what are the platforms supported. - // More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity - //Affinity: &corev1.Affinity{ - // NodeAffinity: &corev1.NodeAffinity{ - // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ - // NodeSelectorTerms: []corev1.NodeSelectorTerm{ - // { - // MatchExpressions: []corev1.NodeSelectorRequirement{ - // { - // Key: "kubernetes.io/arch", - // Operator: "In", - // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, - // }, - // { - // Key: "kubernetes.io/os", - // Operator: "In", - // Values: []string{"linux"}, - // }, - // }, - // }, - // }, - // }, - // }, - //}, + NodeSelector: perses.Spec.NodeSelector, + Tolerations: perses.Spec.Tolerations, + Affinity: perses.Spec.Affinity, SecurityContext: &corev1.PodSecurityContext{ SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, diff --git a/controllers/perses/service_controller.go b/controllers/perses/service_controller.go index 69b4866..10efb19 100644 --- a/controllers/perses/service_controller.go +++ b/controllers/perses/service_controller.go @@ -81,17 +81,23 @@ func (r *PersesReconciler) reconcileService(ctx context.Context, req ctrl.Reques func (r *PersesReconciler) createPersesService( perses *v1alpha1.Perses) (*corev1.Service, error) { - ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name) + ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name, perses.Spec.Metadata) if err != nil { return nil, err } + annotations := map[string]string{} + if perses.Spec.Metadata != nil && perses.Spec.Metadata.Annotations != nil { + annotations = perses.Spec.Metadata.Annotations + } + ser := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: perses.Name, - Namespace: perses.Namespace, - Labels: ls, + Name: perses.Name, + Namespace: perses.Namespace, + Annotations: annotations, + Labels: ls, }, Spec: corev1.ServiceSpec{ Type: corev1.ServiceTypeClusterIP, diff --git a/controllers/perses/statefulset_controller.go b/controllers/perses/statefulset_controller.go index 72b6ba4..ee02562 100644 --- a/controllers/perses/statefulset_controller.go +++ b/controllers/perses/statefulset_controller.go @@ -101,11 +101,16 @@ func (r *PersesReconciler) createPersesStatefulSet( perses *v1alpha1.Perses) (*appsv1.StatefulSet, error) { configName := common.GetConfigName(perses.Name) - ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name) + ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name, perses.Spec.Metadata) if err != nil { return nil, err } + annotations := map[string]string{} + if perses.Spec.Metadata != nil && perses.Spec.Metadata.Annotations != nil { + annotations = perses.Spec.Metadata.Annotations + } + // Get the Operand image image, err := common.ImageForPerses(r.Config.PersesImage) if err != nil { @@ -116,47 +121,25 @@ func (r *PersesReconciler) createPersesStatefulSet( dep := &appsv1.StatefulSet{ ObjectMeta: metav1.ObjectMeta{ - Name: perses.Name, - Namespace: perses.Namespace, - Labels: ls, + Name: perses.Name, + Namespace: perses.Namespace, + Annotations: annotations, + Labels: ls, }, Spec: appsv1.StatefulSetSpec{ Selector: &metav1.LabelSelector{ MatchLabels: ls, }, + Replicas: perses.Spec.Replicas, Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: ls, + Annotations: annotations, + Labels: ls, }, Spec: corev1.PodSpec{ - // TODO(user): Uncomment the following code to configure the nodeAffinity expression - // according to the platforms which are supported by your solution. It is considered - // best practice to support multiple architectures. build your manager image using the - // makefile target docker-buildx. Also, you can use docker manifest inspect - // to check what are the platforms supported. - // More info: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity - //Affinity: &corev1.Affinity{ - // NodeAffinity: &corev1.NodeAffinity{ - // RequiredDuringSchedulingIgnoredDuringExecution: &corev1.NodeSelector{ - // NodeSelectorTerms: []corev1.NodeSelectorTerm{ - // { - // MatchExpressions: []corev1.NodeSelectorRequirement{ - // { - // Key: "kubernetes.io/arch", - // Operator: "In", - // Values: []string{"amd64", "arm64", "ppc64le", "s390x"}, - // }, - // { - // Key: "kubernetes.io/os", - // Operator: "In", - // Values: []string{"linux"}, - // }, - // }, - // }, - // }, - // }, - // }, - //}, + NodeSelector: perses.Spec.NodeSelector, + Tolerations: perses.Spec.Tolerations, + Affinity: perses.Spec.Affinity, SecurityContext: &corev1.PodSecurityContext{ SeccompProfile: &corev1.SeccompProfile{ Type: corev1.SeccompProfileTypeRuntimeDefault, diff --git a/controllers/perses_controller_test.go b/controllers/perses_controller_test.go index b3d5445..5a1973b 100644 --- a/controllers/perses_controller_test.go +++ b/controllers/perses_controller_test.go @@ -60,12 +60,22 @@ var _ = Describe("Perses controller", func() { perses := &persesv1alpha1.Perses{} err := k8sClient.Get(ctx, typeNamespaceName, perses) if err != nil && errors.IsNotFound(err) { + replicas := int32(2) perses := &persesv1alpha1.Perses{ ObjectMeta: metav1.ObjectMeta{ Name: PersesName, Namespace: namespace.Name, }, Spec: persesv1alpha1.PersesSpec{ + Metadata: &persesv1alpha1.Metadata{ + Annotations: map[string]string{ + "testing": "true", + }, + Labels: map[string]string{ + "instance": PersesName, + }, + }, + Replicas: &replicas, ContainerPort: 8080, Config: persesv1alpha1.PersesConfig{ Config: persesconfig.Config{ @@ -118,6 +128,16 @@ var _ = Describe("Perses controller", func() { if found.Spec.Selector["app.kubernetes.io/instance"] != PersesName { return fmt.Errorf("The selector used in the service is not the one defined in the custom resource") } + if value, ok := found.ObjectMeta.Annotations["testing"]; ok { + if value != "true" { + return fmt.Errorf("The annotation in the service is not the one defined in the custom resource") + } + } + if value, ok := found.ObjectMeta.Labels["instance"]; ok { + if value != PersesName { + return fmt.Errorf("The label in the service is not the one defined in the custom resource") + } + } } return err @@ -147,6 +167,16 @@ var _ = Describe("Perses controller", func() { if len(found.Spec.Template.Spec.Containers[0].Args) < 1 && found.Spec.Template.Spec.Containers[0].Args[0] != "--config=/etc/perses/config/config.yaml" { return fmt.Errorf("The config path used in the StatefulSet is not the one defined in the custom resource") } + if value, ok := found.ObjectMeta.Annotations["testing"]; ok { + if value != "true" { + return fmt.Errorf("The annotation in the StatefulSet is not the one defined in the custom resource") + } + } + if value, ok := found.ObjectMeta.Labels["instance"]; ok { + if value != PersesName { + return fmt.Errorf("The label in the StatefulSet is not the one defined in the custom resource") + } + } } return err diff --git a/internal/perses/common/labels.go b/internal/perses/common/labels.go index 99abc47..ec669f8 100644 --- a/internal/perses/common/labels.go +++ b/internal/perses/common/labels.go @@ -18,11 +18,12 @@ package common import ( "fmt" + persesv1alpha1 "github.com/perses/perses-operator/api/v1alpha1" "os" "strings" ) -func LabelsForPerses(persesImageFromFlags string, name string, instanceName string) (map[string]string, error) { +func LabelsForPerses(persesImageFromFlags string, name string, instanceName string, metadata *persesv1alpha1.Metadata) (map[string]string, error) { var imageTag string image, err := ImageForPerses(persesImageFromFlags) @@ -36,13 +37,26 @@ func LabelsForPerses(persesImageFromFlags string, name string, instanceName stri imageTag = "latest" } - return map[string]string{"app.kubernetes.io/name": name, + persesLabels := map[string]string{ + "app.kubernetes.io/name": name, "app.kubernetes.io/instance": instanceName, "app.kubernetes.io/version": imageTag, "app.kubernetes.io/part-of": "perses-operator", "app.kubernetes.io/created-by": "controller-manager", "app.kubernetes.io/managed-by": "perses-operator", - }, nil + } + + if metadata != nil { + for label, value := range metadata.Labels { + // don't overwrite default labels + if _, ok := persesLabels[label]; !ok { + persesLabels[label] = value + } + } + } + + return persesLabels, nil + } // imageForPerses gets the Operand image which is managed by this controller From dfcbe6840161a0d409b3728cd0ac91aaff3699a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:35:20 +0100 Subject: [PATCH 30/38] Bump golangci/golangci-lint-action from 6.2.0 to 6.3.2 (#69) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.2.0 to 6.3.2. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6.2.0...v6.3.2) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ec45b1e..cdf8abe 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -55,7 +55,7 @@ jobs: - name: generate files run: make generate - name: golangci-lint - uses: golangci/golangci-lint-action@v6.2.0 + uses: golangci/golangci-lint-action@v6.3.2 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.61.0 From 5c8654243860580b49f0e15ab39fc2d875a0e8e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:35:29 +0100 Subject: [PATCH 31/38] Bump perses/github-actions from 0.8.0 to 0.9.0 (#68) Bumps [perses/github-actions](https://github.com/perses/github-actions) from 0.8.0 to 0.9.0. - [Release notes](https://github.com/perses/github-actions/releases) - [Changelog](https://github.com/perses/github-actions/blob/main/RELEASE.md) - [Commits](https://github.com/perses/github-actions/compare/v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: perses/github-actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- .github/workflows/go.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b6541b0..84415ec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: perses/github-actions@v0.8.0 + - uses: perses/github-actions@v0.9.0 - uses: ./.github/perses-ci/actions/setup_environment with: enable_go: true diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index cdf8abe..14baf62 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,7 +20,7 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - - uses: perses/github-actions@v0.8.0 + - uses: perses/github-actions@v0.9.0 - uses: ./.github/perses-ci/actions/setup_environment with: enable_go: true @@ -34,7 +34,7 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - - uses: perses/github-actions@v0.8.0 + - uses: perses/github-actions@v0.9.0 - uses: ./.github/perses-ci/actions/setup_environment with: enable_go: true @@ -46,7 +46,7 @@ jobs: steps: - name: checkout uses: actions/checkout@v4 - - uses: perses/github-actions@v0.8.0 + - uses: perses/github-actions@v0.9.0 - uses: ./.github/perses-ci/actions/setup_environment with: enable_go: true From 9c039f207ed31f5120023d9f499054fae7815632 Mon Sep 17 00:00:00 2001 From: Douglass Kirkley Date: Tue, 11 Feb 2025 08:17:45 -0500 Subject: [PATCH 32/38] feat: Trigger instance updates when Perses CR changes Signed-off-by: Douglass Kirkley --- controllers/perses/configmap_controller.go | 54 +++++++++++++------ controllers/perses/deployment_controller.go | 46 +++++++++++----- controllers/perses/service_controller.go | 57 +++++++++++++------- controllers/perses/statefulset_controller.go | 50 ++++++++++++----- 4 files changed, 145 insertions(+), 62 deletions(-) diff --git a/controllers/perses/configmap_controller.go b/controllers/perses/configmap_controller.go index 31d239f..ecb5c59 100644 --- a/controllers/perses/configmap_controller.go +++ b/controllers/perses/configmap_controller.go @@ -19,19 +19,21 @@ package perses import ( "context" "fmt" - "time" - "github.com/perses/perses-operator/api/v1alpha1" - "github.com/perses/perses-operator/internal/perses/common" - "github.com/perses/perses-operator/internal/subreconciler" logger "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/perses/perses-operator/api/v1alpha1" + "github.com/perses/perses-operator/internal/perses/common" + "github.com/perses/perses-operator/internal/subreconciler" ) var cmlog = logger.WithField("module", "configmap_controller") @@ -39,29 +41,33 @@ var cmlog = logger.WithField("module", "configmap_controller") func (r *PersesReconciler) reconcileConfigMap(ctx context.Context, req ctrl.Request) (*ctrl.Result, error) { perses := &v1alpha1.Perses{} - if r, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(r, err) { - return r, err + if result, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(result, err) { + return result, err } configName := common.GetConfigName(perses.Name) found := &corev1.ConfigMap{} - err := r.Get(ctx, types.NamespacedName{Name: configName, Namespace: perses.Namespace}, found) - if err != nil && apierrors.IsNotFound(err) { - cm, err := createPersesConfigMap(r, perses) - if err != nil { - cmlog.WithError(err).Error("Failed to define new ConfigMap resource for perses") + if err := r.Get(ctx, types.NamespacedName{Name: configName, Namespace: perses.Namespace}, found); err != nil { + if !apierrors.IsNotFound(err) { + cmlog.WithError(err).Error("Failed to get ConfigMap") + return subreconciler.RequeueWithError(err) + } + + cm, err2 := r.createPersesConfigMap(perses) + if err2 != nil { + cmlog.WithError(err2).Error("Failed to define new ConfigMap resource for perses") meta.SetStatusCondition(&perses.Status.Conditions, metav1.Condition{Type: common.TypeAvailablePerses, Status: metav1.ConditionFalse, Reason: "Reconciling", - Message: fmt.Sprintf("Failed to create ConfigMap for the custom resource (%s): (%s)", perses.Name, err)}) + Message: fmt.Sprintf("Failed to create ConfigMap for the custom resource (%s): (%s)", perses.Name, err2)}) - if err := r.Status().Update(ctx, perses); err != nil { + if err = r.Status().Update(ctx, perses); err != nil { cmlog.WithError(err).Error("Failed to update perses status") return subreconciler.RequeueWithError(err) } - return subreconciler.RequeueWithError(err) + return subreconciler.RequeueWithError(err2) } cmlog.Infof("Creating a new ConfigMap: ConfigMap.Namespace %s ConfigMap.Name %s", cm.Namespace, cm.Name) @@ -70,18 +76,32 @@ func (r *PersesReconciler) reconcileConfigMap(ctx context.Context, req ctrl.Requ return subreconciler.RequeueWithError(err) } - return subreconciler.RequeueWithDelay(time.Minute) + return subreconciler.ContinueReconciling() } + cm, err := r.createPersesConfigMap(perses) if err != nil { - cmlog.WithError(err).Error("Failed to get ConfigMap") + cmlog.WithError(err).Error("Failed to define new ConfigMap resource for perses") + return subreconciler.RequeueWithError(err) + } + + // call update with dry run to fill out fields that are also returned via the k8s api + if err := r.Update(ctx, cm, client.DryRunAll); err != nil { + cmlog.Error(err, "Failed to update ConfigMap with dry run") return subreconciler.RequeueWithError(err) } + if !equality.Semantic.DeepEqual(found, cm) { + if err := r.Update(ctx, cm); err != nil { + cmlog.Error(err, "Failed to update ConfigMap") + return subreconciler.RequeueWithError(err) + } + } + return subreconciler.ContinueReconciling() } -func createPersesConfigMap(r *PersesReconciler, perses *v1alpha1.Perses) (*corev1.ConfigMap, error) { +func (r *PersesReconciler) createPersesConfigMap(perses *v1alpha1.Perses) (*corev1.ConfigMap, error) { configName := common.GetConfigName(perses.Name) ls, err := common.LabelsForPerses(r.Config.PersesImage, configName, perses.Name, perses.Spec.Metadata) diff --git a/controllers/perses/deployment_controller.go b/controllers/perses/deployment_controller.go index 4a91ce9..1c177a4 100644 --- a/controllers/perses/deployment_controller.go +++ b/controllers/perses/deployment_controller.go @@ -19,14 +19,11 @@ package perses import ( "context" "fmt" - "time" - "github.com/perses/perses-operator/api/v1alpha1" - "github.com/perses/perses-operator/internal/perses/common" - "github.com/perses/perses-operator/internal/subreconciler" logger "github.com/sirupsen/logrus" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,6 +31,11 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/perses/perses-operator/api/v1alpha1" + "github.com/perses/perses-operator/internal/perses/common" + "github.com/perses/perses-operator/internal/subreconciler" ) var dlog = logger.WithField("module", "deployment_controller") @@ -41,8 +43,8 @@ var dlog = logger.WithField("module", "deployment_controller") func (r *PersesReconciler) reconcileDeployment(ctx context.Context, req ctrl.Request) (*ctrl.Result, error) { perses := &v1alpha1.Perses{} - if r, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(r, err) { - return r, err + if result, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(result, err) { + return result, err } if perses.Spec.Config.Database.SQL == nil { @@ -62,11 +64,14 @@ func (r *PersesReconciler) reconcileDeployment(ctx context.Context, req ctrl.Req } found := &appsv1.Deployment{} - err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found) - if err != nil && apierrors.IsNotFound(err) { + if err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found); err != nil { + if !apierrors.IsNotFound(err) { + dlog.WithError(err).Error("Failed to get Deployment") + return subreconciler.RequeueWithError(err) + } - dep, err := r.createPersesDeployment(perses) - if err != nil { + dep, err2 := r.createPersesDeployment(perses) + if err2 != nil { dlog.WithError(err).Error("Failed to define new Deployment resource for perses") meta.SetStatusCondition(&perses.Status.Conditions, metav1.Condition{Type: common.TypeAvailablePerses, @@ -87,13 +92,28 @@ func (r *PersesReconciler) reconcileDeployment(ctx context.Context, req ctrl.Req return subreconciler.RequeueWithError(err) } - return subreconciler.RequeueWithDelay(time.Minute) - } else if err != nil { - dlog.WithError(err).Error("Failed to get Deployment") + return subreconciler.ContinueReconciling() + } + + dep, err := r.createPersesDeployment(perses) + if err != nil { + dlog.WithError(err).Error("Failed to define new Deployment resource for perses") + return subreconciler.RequeueWithError(err) + } + // call update with dry run to fill out fields that are also returned via the k8s api + if err = r.Update(ctx, dep, client.DryRunAll); err != nil { + dlog.Error(err, "Failed to update Deployment with dry run") return subreconciler.RequeueWithError(err) } + if !equality.Semantic.DeepEqual(found.Spec, dep.Spec) { + if err = r.Update(ctx, dep); err != nil { + dlog.Error(err, "Failed to update Deployment") + return subreconciler.RequeueWithError(err) + } + } + return subreconciler.ContinueReconciling() } diff --git a/controllers/perses/service_controller.go b/controllers/perses/service_controller.go index 10efb19..3b433db 100644 --- a/controllers/perses/service_controller.go +++ b/controllers/perses/service_controller.go @@ -19,19 +19,21 @@ package perses import ( "context" "fmt" - "time" - "github.com/perses/perses-operator/api/v1alpha1" - "github.com/perses/perses-operator/internal/perses/common" - "github.com/perses/perses-operator/internal/subreconciler" logger "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/perses/perses-operator/api/v1alpha1" + "github.com/perses/perses-operator/internal/perses/common" + "github.com/perses/perses-operator/internal/subreconciler" ) var slog = logger.WithField("module", "service_controller") @@ -39,28 +41,32 @@ var slog = logger.WithField("module", "service_controller") func (r *PersesReconciler) reconcileService(ctx context.Context, req ctrl.Request) (*ctrl.Result, error) { perses := &v1alpha1.Perses{} - if r, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(r, err) { - return r, err + if result, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(result, err) { + return result, err } found := &corev1.Service{} - err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found) - if err != nil && apierrors.IsNotFound(err) { + if err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found); err != nil { + if !apierrors.IsNotFound(err) { + log.WithError(err).Error("Failed to get Service") + + return subreconciler.RequeueWithError(err) + } - ser, err := r.createPersesService(perses) - if err != nil { - slog.WithError(err).Error("Failed to define new Service resource for perses") + ser, err2 := r.createPersesService(perses) + if err2 != nil { + slog.WithError(err2).Error("Failed to define new Service resource for perses") meta.SetStatusCondition(&perses.Status.Conditions, metav1.Condition{Type: common.TypeAvailablePerses, Status: metav1.ConditionFalse, Reason: "Reconciling", - Message: fmt.Sprintf("Failed to create Service for the custom resource (%s): (%s)", perses.Name, err)}) + Message: fmt.Sprintf("Failed to create Service for the custom resource (%s): (%s)", perses.Name, err2)}) - if err := r.Status().Update(ctx, perses); err != nil { + if err = r.Status().Update(ctx, perses); err != nil { slog.Error(err, "Failed to update perses status") return subreconciler.RequeueWithError(err) } - return subreconciler.RequeueWithError(err) + return subreconciler.RequeueWithError(err2) } slog.Infof("Creating a new Service: Service.Namespace %s Service.Name %s", ser.Namespace, ser.Name) @@ -69,13 +75,28 @@ func (r *PersesReconciler) reconcileService(ctx context.Context, req ctrl.Reques return subreconciler.RequeueWithError(err) } - return subreconciler.RequeueWithDelay(time.Minute) - } else if err != nil { - slog.WithError(err).Error("Failed to get Service") + return subreconciler.ContinueReconciling() + } + + svc, err := r.createPersesService(perses) + if err != nil { + slog.WithError(err).Error("Failed to define new Service resource for perses") + return subreconciler.RequeueWithError(err) + } + // call update with dry run to fill out fields that are also returned via the k8s api + if err = r.Update(ctx, svc, client.DryRunAll); err != nil { + slog.Error(err, "Failed to update Service with dry run") return subreconciler.RequeueWithError(err) } + if !equality.Semantic.DeepEqual(found, svc) { + if err = r.Update(ctx, svc); err != nil { + slog.Error(err, "Failed to update Service") + return subreconciler.RequeueWithError(err) + } + } + return subreconciler.ContinueReconciling() } @@ -105,7 +126,7 @@ func (r *PersesReconciler) createPersesService( Name: "http", Port: 8080, Protocol: corev1.ProtocolTCP, - TargetPort: intstr.FromInt(8080), + TargetPort: intstr.FromInt32(8080), }}, Selector: ls, }, diff --git a/controllers/perses/statefulset_controller.go b/controllers/perses/statefulset_controller.go index ee02562..ab50c1d 100644 --- a/controllers/perses/statefulset_controller.go +++ b/controllers/perses/statefulset_controller.go @@ -21,12 +21,10 @@ import ( "fmt" "time" - "github.com/perses/perses-operator/api/v1alpha1" - "github.com/perses/perses-operator/internal/perses/common" - "github.com/perses/perses-operator/internal/subreconciler" logger "github.com/sirupsen/logrus" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/api/resource" @@ -34,6 +32,11 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + + "github.com/perses/perses-operator/api/v1alpha1" + "github.com/perses/perses-operator/internal/perses/common" + "github.com/perses/perses-operator/internal/subreconciler" ) var stlog = logger.WithField("module", "statefulset_controller") @@ -41,8 +44,8 @@ var stlog = logger.WithField("module", "statefulset_controller") func (r *PersesReconciler) reconcileStatefulSet(ctx context.Context, req ctrl.Request) (*ctrl.Result, error) { perses := &v1alpha1.Perses{} - if r, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(r, err) { - return r, err + if result, err := r.getLatestPerses(ctx, req, perses); subreconciler.ShouldHaltOrRequeue(result, err) { + return result, err } if perses.Spec.Config.Database.File == nil { @@ -62,23 +65,27 @@ func (r *PersesReconciler) reconcileStatefulSet(ctx context.Context, req ctrl.Re } found := &appsv1.StatefulSet{} - err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found) - if err != nil && apierrors.IsNotFound(err) { + if err := r.Get(ctx, types.NamespacedName{Name: perses.Name, Namespace: perses.Namespace}, found); err != nil { + if !apierrors.IsNotFound(err) { + stlog.WithError(err).Error("Failed to get StatefulSet") + + return subreconciler.RequeueWithError(err) + } - dep, err := r.createPersesStatefulSet(perses) - if err != nil { - stlog.WithError(err).Error("Failed to define new StatefulSet resource for perses") + dep, err2 := r.createPersesStatefulSet(perses) + if err2 != nil { + stlog.WithError(err2).Error("Failed to define new StatefulSet resource for perses") meta.SetStatusCondition(&perses.Status.Conditions, metav1.Condition{Type: common.TypeAvailablePerses, Status: metav1.ConditionFalse, Reason: "Reconciling", Message: fmt.Sprintf("Failed to create StatefulSet for the custom resource (%s): (%s)", perses.Name, err)}) - if err := r.Status().Update(ctx, perses); err != nil { + if err = r.Status().Update(ctx, perses); err != nil { stlog.Error(err, "Failed to update perses status") return subreconciler.RequeueWithError(err) } - return subreconciler.RequeueWithError(err) + return subreconciler.RequeueWithError(err2) } stlog.Infof("Creating a new StatefulSet: StatefulSet.Namespace %s StatefulSet.Name %s", dep.Namespace, dep.Name) @@ -88,12 +95,27 @@ func (r *PersesReconciler) reconcileStatefulSet(ctx context.Context, req ctrl.Re } return subreconciler.RequeueWithDelay(time.Minute) - } else if err != nil { - stlog.WithError(err).Error("Failed to get StatefulSet") + } + + sts, err := r.createPersesStatefulSet(perses) + if err != nil { + stlog.WithError(err).Error("Failed to define new StatefulSet resource for perses") + return subreconciler.RequeueWithError(err) + } + // call update with dry run to fill out fields that are also returned via the k8s api + if err = r.Update(ctx, sts, client.DryRunAll); err != nil { + stlog.Error(err, "Failed to update StatefulSet with dry run") return subreconciler.RequeueWithError(err) } + if !equality.Semantic.DeepEqual(found, sts) { + if err = r.Update(ctx, sts); err != nil { + stlog.Error(err, "Failed to update StatefulSet") + return subreconciler.RequeueWithError(err) + } + } + return subreconciler.ContinueReconciling() } From dc433d252519a79510d6301d5b225c5492ab77dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2025 22:53:19 +0000 Subject: [PATCH 33/38] Bump golangci/golangci-lint-action from 6.3.2 to 6.5.0 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.3.2 to 6.5.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6.3.2...v6.5.0) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 14baf62..4150993 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -55,7 +55,7 @@ jobs: - name: generate files run: make generate - name: golangci-lint - uses: golangci/golangci-lint-action@v6.3.2 + uses: golangci/golangci-lint-action@v6.5.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.61.0 From 21503f3752c3e67ee8d57face71e9499c409eba1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2025 23:01:26 +0000 Subject: [PATCH 34/38] Bump sigs.k8s.io/controller-runtime from 0.20.1 to 0.20.2 Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.20.1 to 0.20.2. - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.20.1...v0.20.2) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index c17c8f4..9f9fc98 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( k8s.io/apimachinery v0.32.1 k8s.io/client-go v0.32.1 k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 - sigs.k8s.io/controller-runtime v0.20.1 + sigs.k8s.io/controller-runtime v0.20.2 ) require ( @@ -41,7 +41,7 @@ require ( github.com/elliotchance/orderedmap/v2 v2.2.0 // indirect github.com/emicklei/go-restful/v3 v3.12.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect - github.com/evanphx/json-patch/v5 v5.9.0 // indirect + github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/fxamacker/cbor/v2 v2.7.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect @@ -132,7 +132,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.32.0 // indirect + k8s.io/apiextensions-apiserver v0.32.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect diff --git a/go.sum b/go.sum index 3c22e1e..0ea3a7a 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= -github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= -github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= +github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= @@ -390,8 +390,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc= k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k= -k8s.io/apiextensions-apiserver v0.32.0 h1:S0Xlqt51qzzqjKPxfgX1xh4HBZE+p8KKBq+k2SWNOE0= -k8s.io/apiextensions-apiserver v0.32.0/go.mod h1:86hblMvN5yxMvZrZFX2OhIHAuFIMJIZ19bTvzkP+Fmw= +k8s.io/apiextensions-apiserver v0.32.1 h1:hjkALhRUeCariC8DiVmb5jj0VjIc1N0DREP32+6UXZw= +k8s.io/apiextensions-apiserver v0.32.1/go.mod h1:sxWIGuGiYov7Io1fAS2X06NjMIk5CbRHc2StSmbaQto= k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU= @@ -402,8 +402,8 @@ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE= -sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU= +sigs.k8s.io/controller-runtime v0.20.2 h1:/439OZVxoEc02psi1h4QO3bHzTgu49bb347Xp4gW1pc= +sigs.k8s.io/controller-runtime v0.20.2/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= From a9e8de9bdfa39b57fd55fb3778ef8a44c75d2c5e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2025 12:38:09 +0000 Subject: [PATCH 35/38] Bump the k8s-io group with 3 updates Bumps the k8s-io group with 3 updates: [k8s.io/api](https://github.com/kubernetes/api), [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) and [k8s.io/client-go](https://github.com/kubernetes/client-go). Updates `k8s.io/api` from 0.32.1 to 0.32.2 - [Commits](https://github.com/kubernetes/api/compare/v0.32.1...v0.32.2) Updates `k8s.io/apimachinery` from 0.32.1 to 0.32.2 - [Commits](https://github.com/kubernetes/apimachinery/compare/v0.32.1...v0.32.2) Updates `k8s.io/client-go` from 0.32.1 to 0.32.2 - [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md) - [Commits](https://github.com/kubernetes/client-go/compare/v0.32.1...v0.32.2) --- updated-dependencies: - dependency-name: k8s.io/api dependency-type: direct:production update-type: version-update:semver-patch dependency-group: k8s-io - dependency-name: k8s.io/apimachinery dependency-type: direct:production update-type: version-update:semver-patch dependency-group: k8s-io - dependency-name: k8s.io/client-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: k8s-io ... Signed-off-by: dependabot[bot] --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 9f9fc98..49622ef 100644 --- a/go.mod +++ b/go.mod @@ -12,9 +12,9 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/stretchr/testify v1.10.0 gopkg.in/yaml.v2 v2.4.0 - k8s.io/api v0.32.1 - k8s.io/apimachinery v0.32.1 - k8s.io/client-go v0.32.1 + k8s.io/api v0.32.2 + k8s.io/apimachinery v0.32.2 + k8s.io/client-go v0.32.2 k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 sigs.k8s.io/controller-runtime v0.20.2 ) diff --git a/go.sum b/go.sum index 0ea3a7a..b75df1c 100644 --- a/go.sum +++ b/go.sum @@ -388,14 +388,14 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc= -k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k= +k8s.io/api v0.32.2 h1:bZrMLEkgizC24G9eViHGOPbW+aRo9duEISRIJKfdJuw= +k8s.io/api v0.32.2/go.mod h1:hKlhk4x1sJyYnHENsrdCWw31FEmCijNGPJO5WzHiJ6Y= k8s.io/apiextensions-apiserver v0.32.1 h1:hjkALhRUeCariC8DiVmb5jj0VjIc1N0DREP32+6UXZw= k8s.io/apiextensions-apiserver v0.32.1/go.mod h1:sxWIGuGiYov7Io1fAS2X06NjMIk5CbRHc2StSmbaQto= -k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= -k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= -k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU= -k8s.io/client-go v0.32.1/go.mod h1:aTTKZY7MdxUaJ/KiUs8D+GssR9zJZi77ZqtzcGXIiDg= +k8s.io/apimachinery v0.32.2 h1:yoQBR9ZGkA6Rgmhbp/yuT9/g+4lxtsGYwW6dR6BDPLQ= +k8s.io/apimachinery v0.32.2/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= +k8s.io/client-go v0.32.2 h1:4dYCD4Nz+9RApM2b/3BtVvBHw54QjMFUl1OLcJG5yOA= +k8s.io/client-go v0.32.2/go.mod h1:fpZ4oJXclZ3r2nDOv+Ux3XcJutfrwjKTCHz2H3sww94= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= From 8f14e5b1a38a20689ab60be98e65bf598954e714 Mon Sep 17 00:00:00 2001 From: Gabriel Bernal Date: Wed, 19 Feb 2025 16:35:28 +0100 Subject: [PATCH 36/38] use numeric user to avoid security errors, bump to 0.1.1 in preparation for operator hub sumbission Signed-off-by: Gabriel Bernal --- Dockerfile | 8 +- Dockerfile.dev | 8 +- Makefile | 2 +- api/v1alpha1/zz_generated.deepcopy.go | 2 +- config/manager/kustomization.yaml | 2 +- config/manager/manager.yaml | 38 +- ...perses-operator.clusterserviceversion.yaml | 1189 ++++++++++++++++- config/prometheus/monitor.yaml | 1 - .../rbac/auth_proxy_client_clusterrole.yaml | 1 - config/rbac/auth_proxy_role.yaml | 1 - config/rbac/auth_proxy_role_binding.yaml | 1 - config/rbac/auth_proxy_service.yaml | 1 - config/rbac/leader_election_role.yaml | 1 - config/rbac/leader_election_role_binding.yaml | 1 - config/rbac/perses_editor_role.yaml | 1 - config/rbac/perses_viewer_role.yaml | 1 - config/rbac/persesdashboard_editor_role.yaml | 1 - config/rbac/persesdashboard_viewer_role.yaml | 1 - config/rbac/persesdatasource_editor_role.yaml | 1 - config/rbac/persesdatasource_viewer_role.yaml | 1 - config/rbac/role_binding.yaml | 1 - config/rbac/service_account.yaml | 1 - .../samples/perses.dev_v1alpha1_perses.yaml | 1 - .../perses.dev_v1alpha1_persesdashboard.yaml | 1 - .../perses.dev_v1alpha1_persesdatasource.yaml | 1 - distroless-debug.Dockerfile | 8 +- hack/README.md | 32 + hack/boilerplate.go.txt | 2 +- hack/resources/catalog-source.yaml | 8 + hack/resources/operator-subscription.yaml | 11 + internal/perses/common/labels.go | 3 +- 31 files changed, 1268 insertions(+), 63 deletions(-) create mode 100644 hack/README.md create mode 100644 hack/resources/catalog-source.yaml create mode 100644 hack/resources/operator-subscription.yaml diff --git a/Dockerfile b/Dockerfile index 07ff50f..c715814 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,11 +5,11 @@ FROM gcr.io/distroless/static-debian12 LABEL maintainer="The Perses Authors " -USER nobody +USER 65532:65532 -COPY --chown=nobody:nobody bin/manager /bin/manager -COPY --chown=nobody:nobody LICENSE /LICENSE -COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types +COPY --chown=65532:65532 bin/manager /bin/manager +COPY --chown=65532:65532 LICENSE /LICENSE +COPY --from=build-env --chown=65532:65532 /etc/mime.types /etc/mime.types EXPOSE 8080 ENTRYPOINT [ "/bin/manager" ] diff --git a/Dockerfile.dev b/Dockerfile.dev index 5031c59..4785153 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -11,11 +11,11 @@ FROM gcr.io/distroless/static-debian12 LABEL maintainer="The Perses Authors " -USER nobody +USER 65532:65532 -COPY --from=build-env --chown=nobody:nobody /app/bin/manager /bin/manager -COPY --chown=nobody:nobody LICENSE /LICENSE -COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types +COPY --from=build-env --chown=65532:65532 /app/bin/manager /bin/manager +COPY --chown=65532:65532 LICENSE /LICENSE +COPY --from=build-env --chown=65532:65532 /etc/mime.types /etc/mime.types EXPOSE 8080 ENTRYPOINT [ "/bin/manager" ] diff --git a/Makefile b/Makefile index df1229e..e79f363 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 0.1.0 +VERSION ?= 0.1.1 # DATE defines the building date. It is used mainly for goreleaser when generating the GitHub release. DATE := $(shell date +%Y-%m-%d) diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 8ad8e49..ee5b611 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ //go:build !ignore_autogenerated /* -Copyright 2023 The Perses Authors. +Copyright 2025 The Perses Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 8d65eef..3f77a6f 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -5,4 +5,4 @@ kind: Kustomization images: - name: controller newName: docker.io/persesdev/perses-operator - newTag: v0.1.0 + newTag: v0.1.1 diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 67cbc34..93c038a 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: manager app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: system --- apiVersion: apps/v1 @@ -23,7 +22,6 @@ metadata: app.kubernetes.io/component: manager app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize spec: selector: matchLabels: @@ -36,26 +34,20 @@ spec: labels: control-plane: controller-manager spec: - # TODO(user): Uncomment the following code to configure the nodeAffinity expression - # according to the platforms which are supported by your solution. - # It is considered best practice to support multiple architectures. You can - # build your manager image using the makefile target docker-buildx. - # affinity: - # nodeAffinity: - # requiredDuringSchedulingIgnoredDuringExecution: - # nodeSelectorTerms: - # - matchExpressions: - # - key: kubernetes.io/arch - # operator: In - # values: - # - amd64 - # - arm64 - # - ppc64le - # - s390x - # - key: kubernetes.io/os - # operator: In - # values: - # - linux + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - arm64 + - key: kubernetes.io/os + operator: In + values: + - linux containers: - args: - --leader-elect @@ -79,8 +71,6 @@ spec: port: 8081 initialDelaySeconds: 5 periodSeconds: 10 - # TODO(user): Configure the resources accordingly based on the project requirements. - # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ resources: limits: cpu: 500m diff --git a/config/manifests/bases/perses-operator.clusterserviceversion.yaml b/config/manifests/bases/perses-operator.clusterserviceversion.yaml index 0d161b9..d4f7266 100644 --- a/config/manifests/bases/perses-operator.clusterserviceversion.yaml +++ b/config/manifests/bases/perses-operator.clusterserviceversion.yaml @@ -2,26 +2,1032 @@ apiVersion: operators.coreos.com/v1alpha1 kind: ClusterServiceVersion metadata: annotations: - alm-examples: '[]' + alm-examples: |- + [ + { + "apiVersion": "perses.dev/v1alpha1", + "kind": "Perses", + "metadata": { + "labels": { + "app.kubernetes.io/name": "perses", + "app.kubernetes.io/instance": "perses-sample", + "app.kubernetes.io/part-of": "perses-operator" + }, + "name": "perses-sample", + "namespace": "perses-dev" + }, + "spec": { + "metadata": { + "labels": { + "instance": "perses-sample" + } + }, + "config": { + "database": { + "file": { + "folder": "/etc/perses/storage", + "extension": "yaml" + } + }, + "schemas": { + "panels_path": "/etc/perses/cue/schemas/panels", + "queries_path": "/etc/perses/cue/schemas/queries", + "datasources_path": "/etc/perses/cue/schemas/datasources", + "variables_path": "/etc/perses/cue/schemas/variables" + }, + "ephemeral_dashboard": { + "enable": false, + "cleanup_interval": "1s" + } + }, + "containerPort": 8080 + } + }, + { + "apiVersion": "perses.dev/v1alpha1", + "kind": "PersesDashboard", + "metadata": { + "labels": { + "app.kubernetes.io/name": "perses-dashboard", + "app.kubernetes.io/instance": "perses-dashboard-sample", + "app.kubernetes.io/part-of": "perses-operator" + }, + "name": "perses-dashboard-sample", + "namespace": "perses-dev" + }, + "spec": { + "display": { + "name": "Perses Dashboard Sample", + "description": "This is a sample dashboard" + }, + "duration": "5m", + "datasources": { + "PrometheusLocal": { + "default": false, + "plugin": { + "kind": "PrometheusDatasource", + "spec": { + "proxy": { + "kind": "HTTPProxy", + "spec": { + "url": "http://localhost:9090" + } + } + } + } + } + }, + "variables": [ + { + "kind": "ListVariable", + "spec": { + "name": "job", + "allowMultiple": false, + "allowAllValue": false, + "plugin": { + "kind": "PrometheusLabelValuesVariable", + "spec": { + "labelName": "job" + } + } + } + }, + { + "kind": "ListVariable", + "spec": { + "name": "instance", + "allowMultiple": false, + "allowAllValue": false, + "plugin": { + "kind": "PrometheusLabelValuesVariable", + "spec": { + "labelName": "instance", + "matchers": [ + "up{job=~\"$job\"}" + ] + } + } + } + }, + { + "kind": "ListVariable", + "spec": { + "name": "interval", + "plugin": { + "kind": "StaticListVariable", + "spec": { + "values": [ + "1m", + "5m" + ] + } + } + } + }, + { + "kind": "TextVariable", + "spec": { + "name": "text", + "value": "test", + "constant": true + } + } + ], + "panels": { + "defaultTimeSeriesChart": { + "kind": "Panel", + "spec": { + "display": { + "name": "Default Time Series Panel" + }, + "plugin": { + "kind": "TimeSeriesChart", + "spec": {} + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "up" + } + } + } + } + ] + } + }, + "seriesTest": { + "kind": "Panel", + "spec": { + "display": { + "name": "~130 Series", + "description": "This is a line chart" + }, + "plugin": { + "kind": "TimeSeriesChart", + "spec": { + "yAxis": { + "format": { + "unit": "bytes", + "shortValues": true + } + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "rate(caddy_http_response_duration_seconds_sum[$interval])" + } + } + } + } + ] + } + }, + "basicEx": { + "kind": "Panel", + "spec": { + "display": { + "name": "Single Query" + }, + "plugin": { + "kind": "TimeSeriesChart", + "spec": { + "yAxis": { + "format": { + "unit": "decimal" + } + }, + "legend": { + "position": "right" + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "seriesNameFormat": "Node memory - {{device}} {{instance}}", + "query": "1 - node_filesystem_free_bytes{job='$job',instance=~'$instance',fstype!=\"rootfs\",mountpoint!~\"/(run|var).*\",mountpoint!=\"\"} / node_filesystem_size_bytes{job='$job',instance=~'$instance'}" + } + } + } + } + ] + } + }, + "legendEx": { + "kind": "Panel", + "spec": { + "display": { + "name": "Legend Example" + }, + "plugin": { + "kind": "TimeSeriesChart", + "spec": { + "legend": { + "position": "bottom" + }, + "yAxis": { + "show": true, + "format": { + "unit": "bytes", + "shortValues": true + } + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "seriesNameFormat": "Node memory total", + "query": "node_memory_MemTotal_bytes{job='$job',instance=~'$instance'} - node_memory_MemFree_bytes{job='$job',instance=~'$instance'} - node_memory_Buffers_bytes{job='$job',instance=~'$instance'} - node_memory_Cached_bytes{job='$job',instance=~'$instance'}" + } + } + } + }, + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "seriesNameFormat": "Memory (buffers) - {{instance}}", + "query": "node_memory_Buffers_bytes{job='$job',instance=~'$instance'}" + } + } + } + }, + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "seriesNameFormat": "Cached Bytes", + "query": "node_memory_Cached_bytes{job='$job',instance=~'$instance'}" + } + } + } + }, + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "seriesNameFormat": "MemFree Bytes", + "query": "node_memory_MemFree_bytes{job='$job',instance=~'$instance'}" + } + } + } + } + ] + } + }, + "testNodeQuery": { + "kind": "Panel", + "spec": { + "display": { + "name": "Test Query", + "description": "Description text" + }, + "plugin": { + "kind": "TimeSeriesChart", + "spec": { + "yAxis": { + "format": { + "unit": "decimal", + "decimalPlaces": 2 + } + }, + "legend": { + "position": "right" + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "node_load15{instance=~\"(demo.do.prometheus.io:9100)\",job='$job'}", + "seriesNameFormat": "Test {{job}} {{instance}}" + } + } + } + } + ] + } + }, + "testQueryAlt": { + "kind": "Panel", + "spec": { + "display": { + "name": "Test Query Alt", + "description": "Description text" + }, + "plugin": { + "kind": "TimeSeriesChart", + "spec": { + "legend": { + "position": "right" + }, + "yAxis": { + "format": { + "unit": "percent-decimal", + "decimalPlaces": 1 + } + }, + "thresholds": { + "steps": [ + { + "value": 0.4, + "name": "Alert: Warning condition example" + }, + { + "value": 0.75, + "name": "Alert: Critical condition example" + } + ] + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "node_load1{instance=~\"(demo.do.prometheus.io:9100)\",job='$job'}" + } + } + } + } + ] + } + }, + "cpuLine": { + "kind": "Panel", + "spec": { + "display": { + "name": "CPU - Line (Multi Series)", + "description": "This is a line chart test" + }, + "plugin": { + "kind": "TimeSeriesChart", + "spec": { + "yAxis": { + "show": false, + "label": "CPU Label", + "format": { + "unit": "percent-decimal", + "decimalPlaces": 0 + } + }, + "legend": { + "position": "bottom" + }, + "thresholds": { + "steps": [ + { + "value": 0.2 + }, + { + "value": 0.35 + } + ] + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "seriesNameFormat": "{{mode}} mode - {{job}} {{instance}}", + "query": "avg without (cpu)(rate(node_cpu_seconds_total{job='$job',instance=~'$instance',mode!=\"nice\",mode!=\"steal\",mode!=\"irq\"}[$interval]))" + } + } + } + } + ] + } + }, + "cpuGauge": { + "kind": "Panel", + "spec": { + "display": { + "name": "CPU - Gauge (Multi Series)", + "description": "This is a gauge chart test" + }, + "plugin": { + "kind": "GaugeChart", + "spec": { + "calculation": "last-number", + "format": { + "unit": "percent-decimal" + }, + "thresholds": { + "steps": [ + { + "value": 0.2 + }, + { + "value": 0.35 + } + ] + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "seriesNameFormat": "{{mode}} mode - {{job}} {{instance}}", + "query": "avg without (cpu)(rate(node_cpu_seconds_total{job='$job',instance=~'$instance',mode!=\"nice\",mode!=\"steal\",mode!=\"irq\"}[$interval]))" + } + } + } + } + ] + } + }, + "statSm": { + "kind": "Panel", + "spec": { + "display": { + "name": "Stat Sm" + }, + "plugin": { + "kind": "StatChart", + "spec": { + "calculation": "mean", + "format": { + "unit": "decimal", + "decimalPlaces": 1, + "shortValues": true + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "node_time_seconds{job='$job',instance=~'$instance'} - node_boot_time_seconds{job='$job',instance=~'$instance'}" + } + } + } + } + ] + } + }, + "gaugeRAM": { + "kind": "Panel", + "spec": { + "display": { + "name": "RAM Used", + "description": "This is a stat chart" + }, + "plugin": { + "kind": "GaugeChart", + "spec": { + "calculation": "last-number", + "format": { + "unit": "percent" + }, + "thresholds": { + "steps": [ + { + "value": 85 + }, + { + "value": 95 + } + ] + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "100 - ((node_memory_MemAvailable_bytes{job='$job',instance=~'$instance'} * 100) / node_memory_MemTotal_bytes{job='$job',instance=~'$instance'})" + } + } + } + } + ] + } + }, + "statRAM": { + "kind": "Panel", + "spec": { + "display": { + "name": "RAM Used", + "description": "This is a stat chart" + }, + "plugin": { + "kind": "StatChart", + "spec": { + "calculation": "last-number", + "format": { + "unit": "percent" + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "100 - ((node_memory_MemAvailable_bytes{job='$job',instance=~'$instance'} * 100) / node_memory_MemTotal_bytes{job='$job',instance=~'$instance'})" + } + } + } + } + ] + } + }, + "statTotalRAM": { + "kind": "Panel", + "spec": { + "display": { + "name": "RAM Total", + "description": "This is a stat chart" + }, + "plugin": { + "kind": "StatChart", + "spec": { + "calculation": "last-number", + "format": { + "unit": "bytes", + "decimalPlaces": 1 + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "node_memory_MemTotal_bytes{job='$job',instance=~'$instance'}" + } + } + } + } + ] + } + }, + "statMd": { + "kind": "Panel", + "spec": { + "display": { + "name": "Stat Md" + }, + "plugin": { + "kind": "StatChart", + "spec": { + "calculation": "sum", + "format": { + "unit": "decimal", + "decimalPlaces": 2, + "shortValues": true + }, + "sparkline": { + "color": "#e65013", + "width": 1.5 + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "avg(node_load15{job='node',instance=~'$instance'}) / count(count(node_cpu_seconds_total{job='node',instance=~'$instance'}) by (cpu)) * 100" + } + } + } + } + ] + } + }, + "statLg": { + "kind": "Panel", + "spec": { + "display": { + "name": "Stat Lg", + "description": "This is a stat chart" + }, + "plugin": { + "kind": "StatChart", + "spec": { + "calculation": "mean", + "format": { + "unit": "percent" + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "(((count(count(node_cpu_seconds_total{job='$job',instance=~'$instance'}) by (cpu))) - avg(sum by (mode)(rate(node_cpu_seconds_total{mode=\"idle\",job='$job',instance=~'$instance'}[$interval])))) * 100) / count(count(node_cpu_seconds_total{job='$job',instance=~'$instance'}) by (cpu))" + } + } + } + } + ] + } + }, + "gaugeEx": { + "kind": "Panel", + "spec": { + "display": { + "name": "Gauge Ex", + "description": "This is a gauge chart" + }, + "plugin": { + "kind": "GaugeChart", + "spec": { + "calculation": "last-number", + "format": { + "unit": "percent" + }, + "thresholds": { + "steps": [ + { + "value": 85 + }, + { + "value": 95 + } + ] + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "(((count(count(node_cpu_seconds_total{job='$job',instance=~'$instance'}) by (cpu))) - avg(sum by (mode)(rate(node_cpu_seconds_total{mode=\"idle\",job='$job',instance=~'$instance'}[$interval])))) * 100) / count(count(node_cpu_seconds_total{job='$job',instance=~'$instance'}) by (cpu))" + } + } + } + } + ] + } + }, + "gaugeAltEx": { + "kind": "Panel", + "spec": { + "display": { + "name": "Gauge Alt Ex", + "description": "GaugeChart description text" + }, + "plugin": { + "kind": "GaugeChart", + "spec": { + "calculation": "last-number", + "format": { + "unit": "percent-decimal", + "decimalPlaces": 1 + }, + "thresholds": { + "steps": [ + { + "value": 0.5, + "name": "Alert: Warning condition example" + }, + { + "value": 0.75, + "name": "Alert: Critical condition example" + } + ] + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "node_load15{instance=~'$instance',job='$job'}" + } + } + } + } + ] + } + }, + "gaugeFormatTest": { + "kind": "Panel", + "spec": { + "display": { + "name": "Gauge Format Test" + }, + "plugin": { + "kind": "GaugeChart", + "spec": { + "calculation": "last-number", + "format": { + "unit": "bytes" + }, + "max": 95000000, + "thresholds": { + "steps": [ + { + "value": 71000000 + }, + { + "value": 82000000 + } + ] + } + } + }, + "queries": [ + { + "kind": "TimeSeriesQuery", + "spec": { + "plugin": { + "kind": "PrometheusTimeSeriesQuery", + "spec": { + "query": "node_time_seconds{job='$job',instance=~'$instance'} - node_boot_time_seconds{job='$job',instance=~'$instance'}" + } + } + } + } + ] + } + } + }, + "layouts": [ + { + "kind": "Grid", + "spec": { + "display": { + "title": "Row 1", + "collapse": { + "open": true + } + }, + "items": [ + { + "x": 0, + "y": 0, + "width": 2, + "height": 3, + "content": { + "$ref": "#/spec/panels/statRAM" + } + }, + { + "x": 0, + "y": 4, + "width": 2, + "height": 3, + "content": { + "$ref": "#/spec/panels/statTotalRAM" + } + }, + { + "x": 2, + "y": 0, + "width": 4, + "height": 6, + "content": { + "$ref": "#/spec/panels/statMd" + } + }, + { + "x": 6, + "y": 0, + "width": 10, + "height": 6, + "content": { + "$ref": "#/spec/panels/statLg" + } + }, + { + "x": 16, + "y": 0, + "width": 4, + "height": 6, + "content": { + "$ref": "#/spec/panels/gaugeFormatTest" + } + }, + { + "x": 20, + "y": 0, + "width": 4, + "height": 6, + "content": { + "$ref": "#/spec/panels/gaugeRAM" + } + } + ] + } + }, + { + "kind": "Grid", + "spec": { + "display": { + "title": "Row 2", + "collapse": { + "open": true + } + }, + "items": [ + { + "x": 0, + "y": 0, + "width": 12, + "height": 6, + "content": { + "$ref": "#/spec/panels/legendEx" + } + }, + { + "x": 12, + "y": 0, + "width": 12, + "height": 6, + "content": { + "$ref": "#/spec/panels/basicEx" + } + } + ] + } + }, + { + "kind": "Grid", + "spec": { + "display": { + "title": "Row 3", + "collapse": { + "open": false + } + }, + "items": [ + { + "x": 0, + "y": 0, + "width": 24, + "height": 6, + "content": { + "$ref": "#/spec/panels/cpuGauge" + } + }, + { + "x": 0, + "y": 6, + "width": 12, + "height": 8, + "content": { + "$ref": "#/spec/panels/cpuLine" + } + }, + { + "x": 12, + "y": 0, + "width": 12, + "height": 8, + "content": { + "$ref": "#/spec/panels/defaultTimeSeriesChart" + } + } + ] + } + } + ] + } + }, + { + "apiVersion": "perses.dev/v1alpha1", + "kind": "PersesDatasource", + "metadata": { + "labels": { + "app.kubernetes.io/name": "perses-datasource", + "app.kubernetes.io/instance": "perses-prometheus-datasource", + "app.kubernetes.io/part-of": "perses-operator" + }, + "name": "perses-datasource-sample", + "namespace": "perses-dev" + }, + "spec": { + "display": { + "name": "Default Datasource" + }, + "default": true, + "plugin": { + "kind": "PrometheusDatasource", + "spec": { + "directUrl": "https://prometheus.demo.do.prometheus.io" + } + } + } + } + ] capabilities: Basic Install + categories: Monitoring + containerImage: docker.io/persesdev/perses-operator:v0.1.0 + repository: https://github.com/perses/perses-operator labels: operatorframework.io/arch.amd64: supported operatorframework.io/arch.arm64: supported name: perses-operator.v0.1.0 - namespace: perses + namespace: operators spec: apiservicedefinitions: {} customresourcedefinitions: owned: + - description: A Perses Dashboard + displayName: Perses Dashboard + kind: PersesDashboard + name: persesdashboards.perses.dev + specDescriptors: + - displayName: Spec + path: spec + statusDescriptors: + - displayName: Conditions + path: conditions + version: v1alpha1 + - description: A Perses Datasource + displayName: Perses Datasource + kind: PersesDatasource + name: persesdatasources.perses.dev + specDescriptors: + - displayName: Spec + path: spec + statusDescriptors: + - displayName: Conditions + path: conditions + version: v1alpha1 - description: Perses is the Schema for the perses API displayName: Perses kind: Perses name: perses.perses.dev specDescriptors: + - displayName: Affinity + path: affinity - displayName: Config path: config - displayName: Container Port path: containerPort + - displayName: Metadata + path: metadata + - displayName: Node Selector + path: nodeSelector + - displayName: Replicas + path: replicas + - displayName: Tolerations + path: tolerations statusDescriptors: - displayName: Conditions path: conditions @@ -34,8 +1040,182 @@ spec: mediatype: image/jpeg install: spec: - deployments: null - strategy: "" + clusterPermissions: + - rules: + - apiGroups: + - apps + resources: + - deployments + - statefulsets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - "" + resources: + - events + verbs: + - create + - patch + - apiGroups: + - "" + resources: + - services + - configmaps + verbs: + - get + - patch + - update + - create + - delete + - list + - watch + - apiGroups: + - perses.dev + resources: + - perses + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - perses.dev + resources: + - perses/finalizers + verbs: + - update + - apiGroups: + - perses.dev + resources: + - perses/status + verbs: + - get + - patch + - update + - apiGroups: + - perses.dev + resources: + - persesdashboards + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - perses.dev + resources: + - persesdashboards/finalizers + verbs: + - update + - apiGroups: + - perses.dev + resources: + - persesdashboards/status + verbs: + - get + - patch + - update + - apiGroups: + - perses.dev + resources: + - persesdatasources + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - perses.dev + resources: + - persesdatasources/finalizers + verbs: + - update + - apiGroups: + - perses.dev + resources: + - persesdatasources/status + verbs: + - get + - patch + - update + serviceAccountName: controller-manager + deployments: + - name: perses-operator + spec: + replicas: 1 + selector: + matchLabels: + control-plane: controller-manager + strategy: {} + template: + metadata: + annotations: + kubectl.kubernetes.io/default-container: manager + labels: + control-plane: controller-manager + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 + - arm64 + - key: kubernetes.io/os + operator: In + values: + - linux + containers: + - args: + - --leader-elect + image: docker.io/persesdev/perses-operator:v0.1.0 + imagePullPolicy: Always + livenessProbe: + httpGet: + path: /healthz + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 20 + name: manager + readinessProbe: + httpGet: + path: /readyz + port: 8081 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 10m + memory: 64Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + serviceAccountName: controller-manager + terminationGracePeriodSeconds: 10 + strategy: deployment installModes: - supported: false type: OwnNamespace @@ -60,6 +1240,7 @@ spec: - email: augustin.husson@amadeus.com name: Augustin Husson maturity: alpha + minKubeVersion: 1.25.0 provider: name: Perses url: perses.dev diff --git a/config/prometheus/monitor.yaml b/config/prometheus/monitor.yaml index 3e1a559..d66cf19 100644 --- a/config/prometheus/monitor.yaml +++ b/config/prometheus/monitor.yaml @@ -10,7 +10,6 @@ metadata: app.kubernetes.io/component: metrics app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-monitor namespace: system spec: diff --git a/config/rbac/auth_proxy_client_clusterrole.yaml b/config/rbac/auth_proxy_client_clusterrole.yaml index b2c234e..be2a9ba 100644 --- a/config/rbac/auth_proxy_client_clusterrole.yaml +++ b/config/rbac/auth_proxy_client_clusterrole.yaml @@ -7,7 +7,6 @@ metadata: app.kubernetes.io/component: kube-rbac-proxy app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: metrics-reader rules: - nonResourceURLs: diff --git a/config/rbac/auth_proxy_role.yaml b/config/rbac/auth_proxy_role.yaml index 080810e..1e8672c 100644 --- a/config/rbac/auth_proxy_role.yaml +++ b/config/rbac/auth_proxy_role.yaml @@ -7,7 +7,6 @@ metadata: app.kubernetes.io/component: kube-rbac-proxy app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: proxy-role rules: - apiGroups: diff --git a/config/rbac/auth_proxy_role_binding.yaml b/config/rbac/auth_proxy_role_binding.yaml index b6d1fff..b2b3b8c 100644 --- a/config/rbac/auth_proxy_role_binding.yaml +++ b/config/rbac/auth_proxy_role_binding.yaml @@ -7,7 +7,6 @@ metadata: app.kubernetes.io/component: kube-rbac-proxy app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: proxy-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/config/rbac/auth_proxy_service.yaml b/config/rbac/auth_proxy_service.yaml index 036af1a..f61b7d1 100644 --- a/config/rbac/auth_proxy_service.yaml +++ b/config/rbac/auth_proxy_service.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: kube-rbac-proxy app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-service namespace: system spec: diff --git a/config/rbac/leader_election_role.yaml b/config/rbac/leader_election_role.yaml index 89075bc..f4919a3 100644 --- a/config/rbac/leader_election_role.yaml +++ b/config/rbac/leader_election_role.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: leader-election-role rules: - apiGroups: diff --git a/config/rbac/leader_election_role_binding.yaml b/config/rbac/leader_election_role_binding.yaml index 37a2a65..a10b14e 100644 --- a/config/rbac/leader_election_role_binding.yaml +++ b/config/rbac/leader_election_role_binding.yaml @@ -7,7 +7,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: leader-election-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/config/rbac/perses_editor_role.yaml b/config/rbac/perses_editor_role.yaml index f2f477c..1760d41 100644 --- a/config/rbac/perses_editor_role.yaml +++ b/config/rbac/perses_editor_role.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: perses-editor-role rules: - apiGroups: diff --git a/config/rbac/perses_viewer_role.yaml b/config/rbac/perses_viewer_role.yaml index 29b03ef..93acfa3 100644 --- a/config/rbac/perses_viewer_role.yaml +++ b/config/rbac/perses_viewer_role.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: perses-viewer-role rules: - apiGroups: diff --git a/config/rbac/persesdashboard_editor_role.yaml b/config/rbac/persesdashboard_editor_role.yaml index 12977a8..1853add 100644 --- a/config/rbac/persesdashboard_editor_role.yaml +++ b/config/rbac/persesdashboard_editor_role.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: persesdashboard-editor-role rules: - apiGroups: diff --git a/config/rbac/persesdashboard_viewer_role.yaml b/config/rbac/persesdashboard_viewer_role.yaml index eb49f7f..c52e52e 100644 --- a/config/rbac/persesdashboard_viewer_role.yaml +++ b/config/rbac/persesdashboard_viewer_role.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: persesdashboard-viewer-role rules: - apiGroups: diff --git a/config/rbac/persesdatasource_editor_role.yaml b/config/rbac/persesdatasource_editor_role.yaml index 676c0a6..cac9054 100644 --- a/config/rbac/persesdatasource_editor_role.yaml +++ b/config/rbac/persesdatasource_editor_role.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: persesdatasource-editor-role rules: - apiGroups: diff --git a/config/rbac/persesdatasource_viewer_role.yaml b/config/rbac/persesdatasource_viewer_role.yaml index d6b3d8c..93b938d 100644 --- a/config/rbac/persesdatasource_viewer_role.yaml +++ b/config/rbac/persesdatasource_viewer_role.yaml @@ -8,7 +8,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: persesdatasource-viewer-role rules: - apiGroups: diff --git a/config/rbac/role_binding.yaml b/config/rbac/role_binding.yaml index f8ec12f..f312f89 100644 --- a/config/rbac/role_binding.yaml +++ b/config/rbac/role_binding.yaml @@ -7,7 +7,6 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: manager-rolebinding roleRef: apiGroup: rbac.authorization.k8s.io diff --git a/config/rbac/service_account.yaml b/config/rbac/service_account.yaml index dda5763..94412c1 100644 --- a/config/rbac/service_account.yaml +++ b/config/rbac/service_account.yaml @@ -7,6 +7,5 @@ metadata: app.kubernetes.io/component: rbac app.kubernetes.io/created-by: perses-operator app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize name: controller-manager namespace: system diff --git a/config/samples/perses.dev_v1alpha1_perses.yaml b/config/samples/perses.dev_v1alpha1_perses.yaml index ead1e23..eb5fc3e 100644 --- a/config/samples/perses.dev_v1alpha1_perses.yaml +++ b/config/samples/perses.dev_v1alpha1_perses.yaml @@ -5,7 +5,6 @@ metadata: app.kubernetes.io/name: perses app.kubernetes.io/instance: perses-sample app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize app.kubernetes.io/created-by: perses-operator name: perses-sample namespace: perses-dev diff --git a/config/samples/perses.dev_v1alpha1_persesdashboard.yaml b/config/samples/perses.dev_v1alpha1_persesdashboard.yaml index 92cf90b..cbd83b1 100644 --- a/config/samples/perses.dev_v1alpha1_persesdashboard.yaml +++ b/config/samples/perses.dev_v1alpha1_persesdashboard.yaml @@ -5,7 +5,6 @@ metadata: app.kubernetes.io/name: perses-dashboard app.kubernetes.io/instance: perses-dashboard-sample app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize app.kubernetes.io/created-by: perses-operator name: perses-dashboard-sample namespace: perses-dev diff --git a/config/samples/perses.dev_v1alpha1_persesdatasource.yaml b/config/samples/perses.dev_v1alpha1_persesdatasource.yaml index 83a71ef..cec5dba 100644 --- a/config/samples/perses.dev_v1alpha1_persesdatasource.yaml +++ b/config/samples/perses.dev_v1alpha1_persesdatasource.yaml @@ -5,7 +5,6 @@ metadata: app.kubernetes.io/name: perses-datasource app.kubernetes.io/instance: perses-prometheus-datasource app.kubernetes.io/part-of: perses-operator - app.kubernetes.io/managed-by: kustomize app.kubernetes.io/created-by: perses-operator name: perses-datasource-sample namespace: perses-dev diff --git a/distroless-debug.Dockerfile b/distroless-debug.Dockerfile index bfd170b..09103ca 100644 --- a/distroless-debug.Dockerfile +++ b/distroless-debug.Dockerfile @@ -5,11 +5,11 @@ FROM gcr.io/distroless/static-debian12:debug LABEL maintainer="The Perses Authors " -USER nobody +USER 65532:65532 -COPY --chown=nobody:nobody bin/manager /bin/manager -COPY --chown=nobody:nobody LICENSE /LICENSE -COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types +COPY --chown=65532:65532 bin/manager /bin/manager +COPY --chown=65532:65532 LICENSE /LICENSE +COPY --from=build-env --chown=65532:65532 /etc/mime.types /etc/mime.types EXPOSE 8080 ENTRYPOINT [ "/bin/manager" ] diff --git a/hack/README.md b/hack/README.md new file mode 100644 index 0000000..6b593b8 --- /dev/null +++ b/hack/README.md @@ -0,0 +1,32 @@ +# Hack + +## Install the operator using olm + +1. Connect to a cluster like [kind](https://sigs.k8s.io/kind) or [minikube](https://minikube.sigs.k8s.io/docs/) +2. Install the Operator Lifecycle Manager (OLM) +```bash +operator-sdk olm install +``` +1. Build the required images and push them to a registry +```bash +IMG=/perses-operator:tag make test-image-build image-push +IMG=/perses-operator:tag make bundle-build bundle-push +IMG=/perses-operator:tag make catalog-build catalog-push +``` +2. Change the image inside `hack/resources/catalog-source.yaml` to the image you pushed in the previous step and create a CatalogSource +```bash +kubectl apply -f hack/resources/catalog-source.yaml +``` +3. Create a Subscription +```bash +kubectl apply -f hack/resources/operator-subscription.yaml +``` +4. Check that the operator is installed +```bash +kubectl get clusterserviceversion -n operators -w +``` +5. Now you can create a Perses CR and the operator will create the required resources +```bash +kubectl create namespace perses-dev +kubectl apply -f config/samples/perses_v1alpha1_perses.yaml +``` \ No newline at end of file diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt index cd6247c..98c2979 100644 --- a/hack/boilerplate.go.txt +++ b/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* -Copyright 2023 The Perses Authors. +Copyright 2025 The Perses Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/hack/resources/catalog-source.yaml b/hack/resources/catalog-source.yaml new file mode 100644 index 0000000..90cefe4 --- /dev/null +++ b/hack/resources/catalog-source.yaml @@ -0,0 +1,8 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: CatalogSource +metadata: + name: my-perses-test-catalog + namespace: olm +spec: + sourceType: grpc + image: docker.io/perses-dev/perses-operator-catalog:v0.1.1 \ No newline at end of file diff --git a/hack/resources/operator-subscription.yaml b/hack/resources/operator-subscription.yaml new file mode 100644 index 0000000..53a54c1 --- /dev/null +++ b/hack/resources/operator-subscription.yaml @@ -0,0 +1,11 @@ +apiVersion: operators.coreos.com/v1alpha1 +kind: Subscription +metadata: + name: my-perses-operator-subscription + namespace: operators +spec: + channel: alpha + name: perses-operator + startingCSV: perses-operator.v0.1.1 + source: my-perses-test-catalog + sourceNamespace: olm \ No newline at end of file diff --git a/internal/perses/common/labels.go b/internal/perses/common/labels.go index ec669f8..bed633e 100644 --- a/internal/perses/common/labels.go +++ b/internal/perses/common/labels.go @@ -18,9 +18,10 @@ package common import ( "fmt" - persesv1alpha1 "github.com/perses/perses-operator/api/v1alpha1" "os" "strings" + + persesv1alpha1 "github.com/perses/perses-operator/api/v1alpha1" ) func LabelsForPerses(persesImageFromFlags string, name string, instanceName string, metadata *persesv1alpha1.Metadata) (map[string]string, error) { From 2a6e2e3a3c55ad3f1fa75d79df7a74eec1087397 Mon Sep 17 00:00:00 2001 From: Gabriel Bernal Date: Mon, 24 Feb 2025 15:47:12 +0100 Subject: [PATCH 37/38] [feature] allow to define a custom perses image Signed-off-by: Gabriel Bernal --- Makefile | 6 ++++ api/v1alpha1/perses_types.go | 2 ++ api/v1alpha1/zz_generated.deepcopy.go | 5 ++++ config/crd/bases/perses.dev_perses.yaml | 2 ++ controllers/perses/configmap_controller.go | 2 +- controllers/perses/deployment_controller.go | 4 +-- controllers/perses/service_controller.go | 2 +- controllers/perses/statefulset_controller.go | 4 +-- controllers/perses_controller_test.go | 1 + internal/perses/common/labels.go | 30 ++++++++++---------- 10 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index e79f363..4bf0262 100644 --- a/Makefile +++ b/Makefile @@ -199,6 +199,12 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla - docker buildx rm project-v3-builder rm Dockerfile.cross +.PHONY: podman-cross-build +podman-cross-build: test + podman manifest create ${IMG} + podman build --platform $(PLATFORMS) --manifest ${IMG} -f Dockerfile.dev + podman manifest push ${IMG} + ifndef ignore-not-found ignore-not-found = false endif diff --git a/api/v1alpha1/perses_types.go b/api/v1alpha1/perses_types.go index a46c2fd..57f9f6f 100644 --- a/api/v1alpha1/perses_types.go +++ b/api/v1alpha1/perses_types.go @@ -37,6 +37,8 @@ type PersesSpec struct { Tolerations []corev1.Toleration `json:"tolerations,omitempty"` // +operator-sdk:csv:customresourcedefinitions:type=spec Affinity *corev1.Affinity `json:"affinity,omitempty"` + // +operator-sdk:csv:customresourcedefinitions:type=spec + Image *string `json:"image,omitempty"` } // Metadata to add to deployed pods diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index ee5b611..cc0f6ad 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -339,6 +339,11 @@ func (in *PersesSpec) DeepCopyInto(out *PersesSpec) { *out = new(v1.Affinity) (*in).DeepCopyInto(*out) } + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersesSpec. diff --git a/config/crd/bases/perses.dev_perses.yaml b/config/crd/bases/perses.dev_perses.yaml index 5177283..c372fcf 100644 --- a/config/crd/bases/perses.dev_perses.yaml +++ b/config/crd/bases/perses.dev_perses.yaml @@ -1843,6 +1843,8 @@ spec: containerPort: format: int32 type: integer + image: + type: string metadata: description: Metadata to add to deployed pods properties: diff --git a/controllers/perses/configmap_controller.go b/controllers/perses/configmap_controller.go index ecb5c59..c7f1a18 100644 --- a/controllers/perses/configmap_controller.go +++ b/controllers/perses/configmap_controller.go @@ -103,7 +103,7 @@ func (r *PersesReconciler) reconcileConfigMap(ctx context.Context, req ctrl.Requ func (r *PersesReconciler) createPersesConfigMap(perses *v1alpha1.Perses) (*corev1.ConfigMap, error) { configName := common.GetConfigName(perses.Name) - ls, err := common.LabelsForPerses(r.Config.PersesImage, configName, perses.Name, perses.Spec.Metadata) + ls, err := common.LabelsForPerses(r.Config.PersesImage, configName, perses) if err != nil { return nil, err diff --git a/controllers/perses/deployment_controller.go b/controllers/perses/deployment_controller.go index 1c177a4..27bc923 100644 --- a/controllers/perses/deployment_controller.go +++ b/controllers/perses/deployment_controller.go @@ -121,7 +121,7 @@ func (r *PersesReconciler) createPersesDeployment( perses *v1alpha1.Perses) (*appsv1.Deployment, error) { configName := common.GetConfigName(perses.Name) - ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name, perses.Spec.Metadata) + ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses) if err != nil { return nil, err } @@ -132,7 +132,7 @@ func (r *PersesReconciler) createPersesDeployment( } // Get the Operand image - image, err := common.ImageForPerses(r.Config.PersesImage) + image, err := common.ImageForPerses(perses, r.Config.PersesImage) if err != nil { return nil, err } diff --git a/controllers/perses/service_controller.go b/controllers/perses/service_controller.go index 3b433db..1568af9 100644 --- a/controllers/perses/service_controller.go +++ b/controllers/perses/service_controller.go @@ -102,7 +102,7 @@ func (r *PersesReconciler) reconcileService(ctx context.Context, req ctrl.Reques func (r *PersesReconciler) createPersesService( perses *v1alpha1.Perses) (*corev1.Service, error) { - ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name, perses.Spec.Metadata) + ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses) if err != nil { return nil, err diff --git a/controllers/perses/statefulset_controller.go b/controllers/perses/statefulset_controller.go index ab50c1d..1575769 100644 --- a/controllers/perses/statefulset_controller.go +++ b/controllers/perses/statefulset_controller.go @@ -123,7 +123,7 @@ func (r *PersesReconciler) createPersesStatefulSet( perses *v1alpha1.Perses) (*appsv1.StatefulSet, error) { configName := common.GetConfigName(perses.Name) - ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses.Name, perses.Spec.Metadata) + ls, err := common.LabelsForPerses(r.Config.PersesImage, perses.Name, perses) if err != nil { return nil, err } @@ -134,7 +134,7 @@ func (r *PersesReconciler) createPersesStatefulSet( } // Get the Operand image - image, err := common.ImageForPerses(r.Config.PersesImage) + image, err := common.ImageForPerses(perses, r.Config.PersesImage) if err != nil { return nil, err } diff --git a/controllers/perses_controller_test.go b/controllers/perses_controller_test.go index 5a1973b..8635d03 100644 --- a/controllers/perses_controller_test.go +++ b/controllers/perses_controller_test.go @@ -77,6 +77,7 @@ var _ = Describe("Perses controller", func() { }, Replicas: &replicas, ContainerPort: 8080, + Image: &persesImage, Config: persesv1alpha1.PersesConfig{ Config: persesconfig.Config{ Database: persesconfig.Database{ diff --git a/internal/perses/common/labels.go b/internal/perses/common/labels.go index bed633e..10c2487 100644 --- a/internal/perses/common/labels.go +++ b/internal/perses/common/labels.go @@ -18,15 +18,15 @@ package common import ( "fmt" - "os" "strings" - persesv1alpha1 "github.com/perses/perses-operator/api/v1alpha1" + "github.com/perses/perses-operator/api/v1alpha1" ) -func LabelsForPerses(persesImageFromFlags string, name string, instanceName string, metadata *persesv1alpha1.Metadata) (map[string]string, error) { +func LabelsForPerses(persesImageFromFlags string, name string, perses *v1alpha1.Perses) (map[string]string, error) { + instanceName := perses.Name var imageTag string - image, err := ImageForPerses(persesImageFromFlags) + image, err := ImageForPerses(perses, persesImageFromFlags) if err != nil { return nil, fmt.Errorf("unable to get the image for perses: %s", err) @@ -47,8 +47,8 @@ func LabelsForPerses(persesImageFromFlags string, name string, instanceName stri "app.kubernetes.io/managed-by": "perses-operator", } - if metadata != nil { - for label, value := range metadata.Labels { + if perses.Spec.Metadata != nil { + for label, value := range perses.Spec.Metadata.Labels { // don't overwrite default labels if _, ok := persesLabels[label]; !ok { persesLabels[label] = value @@ -61,24 +61,24 @@ func LabelsForPerses(persesImageFromFlags string, name string, instanceName stri } // imageForPerses gets the Operand image which is managed by this controller -// from the PERSES_IMAGE environment variable defined in the config/manager/manager.yaml -func ImageForPerses(persesImageFromFlags string) (string, error) { +// from the image field in the CR or PERSES_IMAGE environment variable defined in the config/manager/manager.yaml +func ImageForPerses(perses *v1alpha1.Perses, persesImageFromFlags string) (string, error) { image := persesImageFromFlags - if persesImageFromFlags == "" { - var imageEnvVar = "PERSES_IMAGE" - imageFromEnv, found := os.LookupEnv(imageEnvVar) - if !found { - return "", fmt.Errorf("unable to find %s environment variable with the image", imageEnvVar) - } + if perses.Spec.Image != nil && *perses.Spec.Image != "" { + image = *perses.Spec.Image + } - image = imageFromEnv + if image == "" { + return "", fmt.Errorf("perses image operand was not provided") } imageParts := strings.Split(image, ":") + if len(imageParts) < 2 { return "", fmt.Errorf("image provided for perses %s does not have a tag version", image) } + return image, nil } From 5cbf8d9709d1da49720430fbc569138b7e0d6e90 Mon Sep 17 00:00:00 2001 From: Jenny Zhu Date: Mon, 24 Feb 2025 12:40:17 -0500 Subject: [PATCH 38/38] Add a `make bin` command for Konflux CI Pipeline to build binary files --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 4bf0262..32db48c 100644 --- a/Makefile +++ b/Makefile @@ -363,3 +363,7 @@ cross-build: generate-goreleaser manifests generate fmt vet ## Cross build binar .PHONY: cross-release cross-release: generate-goreleaser manifests generate fmt vet goreleaser release --clean + +.PHONY: bin +bin: + go build -mod=readonly -o bin/manager main.go \ No newline at end of file