Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prometheus): Deploy Prometheus StatefulSet by default #89

Merged
merged 19 commits into from
Feb 26, 2024

Conversation

jsirianni
Copy link
Member

@jsirianni jsirianni commented Feb 19, 2024

Description of Changes

BindPlane v1.46.0 will require Prometheus because measurement support for bolt store and postgres have been removed.

This PR implements a Prometheus StatefulSet that is deployed by default. Support for Prometheus side car and self managed Prometheus is retained. This allows the chart to be compatible with all existing deployments. If sidecar or self managed prometheus are in use, the new statefulset will not be deployed.

Changes

  • Removed prometheus.enable bool option
  • Added prometheus.remote bool option
    • When true, the chart will not deploy Prometheus. This is for self managed Prometheus.
  • Change default value for prometheus.host to ""
    • This field should only be set when connecting to a self managed Prometheus
    • Chart will use Prometheus clusterIP service name by default
    • Chart will use localhost when Prometheus side car is enabled
    • Chart will use the prometheus.host when prometheus.remote is enabled
  • Moved prometheus.sidecar.resources to prometheus.resources
    • This block will be shared between the StatefulSet Prometheus and the SideCar, whichever is in use
  • Moved prometheus.storageClass and prometheus.volumeSize to prometheus.storage block

When this change is released, the release will contain upgrade notes. The same upgrade notes will be added to the 1.46 bindplane release notes.

Testing

I have already performed significant testing. Feel free to run through a few scenario or two.

Test method

  • Upgrade from main branch (if applicable)
  • Ensure BindPlane and Prometheus storage is working by deleting the pods and checking to see if data exists on the new pods

Test matrix used to ensure all upgrade paths are possible. See values files used below. GKE tends to be more strict w/ volume mounts, so we test against both.

Test Case Minikube GKE
new deployments pass pass
main without Prometheus pass pass
main w/ sidecar pass pass
main w/ remote Prometheus, not managed by the chart pass pass

New deployment.

Brand new deployment.

We expect bindplane and prometheus to be deployed.

config:
  username: bpuser
  password: bppass
  secret_key: 12D8FB6E-1532-4A4C-97AF-95A430BE5E6E
  sessions_secret: 4484766F-5016-4077-B8E0-0DE1D637854B
dev:
  collector:
    create: true

Main without Prometheus configured

Previous deployment from main, without Prometheus explicitly enabled.

We expect the upgrade to this branch to deploy prometheus.

config:
  username: bpuser
  password: bppass
  secret_key: 12D8FB6E-1532-4A4C-97AF-95A430BE5E6E
  sessions_secret: 4484766F-5016-4077-B8E0-0DE1D637854B
dev:
  collector:
    create: true

Main w/ Sidecar

Previous deployment from main, with Prometheus sidecar explicitly configured.

prometheus:
  enable: true
  enableSideCar: true
config:
  username: bpuser
  password: bppass
  secret_key: 12D8FB6E-1532-4A4C-97AF-95A430BE5E6E
  sessions_secret: 4484766F-5016-4077-B8E0-0DE1D637854B
dev:
  collector:
    create: true

When upgrading, the prometheus.enable field can be removed.

Main w/ remote Prometheus

Previous deployment from main, with a remote Prometheus configured. This is for Prometheus that is unmanaged by this chart.

In this case, Prometheus is deployed to my Linux system using the packages released w/ BindPlane.

config:
  username: bpuser
  password: bppass
  secret_key: 12D8FB6E-1532-4A4C-97AF-95A430BE5E6E
  sessions_secret: 4484766F-5016-4077-B8E0-0DE1D637854B
dev:
  collector:
    create: true
prometheus:
  enable: true
  host: "10.99.1.10"

Before upgrading, I update the values config to look like this:

prometheus.enable --> prometheus.remote

config:
  username: bpuser
  password: bppass
  secret_key: 12D8FB6E-1532-4A4C-97AF-95A430BE5E6E
  sessions_secret: 4484766F-5016-4077-B8E0-0DE1D637854B
dev:
  collector:
    create: true
prometheus:
  remote: true
  host: "10.99.1.10"

Helm outputs the same config in both cases, you can compare like this. If I write the output to file and check the hash, they are identical.

f3aa3b375db7dee4cbc7d655a7b4cfa9d111464dbc9800da3466929fe2e4dde3  new.yaml
f3aa3b375db7dee4cbc7d655a7b4cfa9d111464dbc9800da3466929fe2e4dde3  old.yaml

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • CI passes

@jsirianni jsirianni changed the title feat(prometheus): Deploy remote Prometheus StatefulSet by default feat(prometheus): Deploy Prometheus StatefulSet by default Feb 19, 2024
@jsirianni jsirianni force-pushed the always-on-prometheus branch from 1bd3d53 to acdbc44 Compare February 19, 2024 22:37
@jsirianni jsirianni marked this pull request as ready for review February 20, 2024 21:51
@jsirianni jsirianni requested a review from a team as a code owner February 20, 2024 21:51
@jsirianni jsirianni requested review from shazlehu and dpaasman00 and removed request for a team and shazlehu February 20, 2024 21:51
@jsirianni jsirianni force-pushed the epic/always-on-prometheus branch from b78b381 to d1ca4f9 Compare February 26, 2024 17:55
@jsirianni jsirianni force-pushed the always-on-prometheus branch from 4c63197 to 081b365 Compare February 26, 2024 17:55
@jsirianni jsirianni merged commit 59b7267 into epic/always-on-prometheus Feb 26, 2024
10 checks passed
@jsirianni jsirianni deleted the always-on-prometheus branch February 26, 2024 19:19
jsirianni added a commit that referenced this pull request Feb 27, 2024
* bump minor version

* run on all PRs

* feat(prometheus): Use bindplane-prometheus container image (#87)

* use bindplane prometheus image and remove configmap

* remove args, they are set in the container image already. updaste volume mount to use /prometheus, the correct path for the bindplane-prometheus image

* pin sidecar test version

* feat(prometheus): Deploy Prometheus StatefulSet by default (#89)

* remove sidecar

* rename dev prometheus config

* add prometheus statefulset

* true up securityContext

* add remote option

* regen docs

* remove prom enable from templates

* use generated service name when host is not set

* fix svc name

* re-add sideCar option

* revert size change

* use localhost when sidecar

* Regen docs

* resolve test issues by using newer image

* use ee image

* Remove all test case as it requires a license

* skip if dev prometheus is enabled

* fix condition

* add fsgroup for gke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants