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] Add prometheus config reloader livenessProbe & readinessProbe #5449

Merged
merged 29 commits into from
Apr 7, 2023

Conversation

dongjiang1989
Copy link
Contributor

@dongjiang1989 dongjiang1989 commented Mar 24, 2023

Description

#4730
#3587
#5294

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.

prometheus-config-reloader containers add livenessProbe & readinessProbe

@dongjiang1989 dongjiang1989 requested a review from a team as a code owner March 24, 2023 04:02
Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, do you any concrete use case for adding liveness/readiness probes to the config reloader? In other words, did you face situations where probes would have helped?

One problem I can see with the current approach is that the next operator's version requires to use a config reloader image with the new health endpoint. This would make upgrades more complicated than needed IMHO.
To smooth the upgrade, we can introduce a new operator's flag to enable liveness/readiness probes for the config reloader (e.g. --enable-config-reloader-probes).

pkg/operator/config_reloader.go Outdated Show resolved Hide resolved
cmd/prometheus-config-reloader/main.go Outdated Show resolved Hide resolved
@dongjiang1989
Copy link
Contributor Author

Out of curiosity, do you any concrete use case for adding liveness/readiness probes to the config reloader? In other words, did you face situations where probes would have helped?

One problem I can see with the current approach is that the next operator's version requires to use a config reloader image with the new health endpoint. This would make upgrades more complicated than needed IMHO. To smooth the upgrade, we can introduce a new operator's flag to enable liveness/readiness probes for the config reloader (e.g. --enable-config-reloader-probes).

THKS for U review! The Open Policy Agent is installed in the online kubernetes cluster. All containers in the pod must have livenessProbe or ReadinessProbe.

like:

apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sRequiredProbes
metadata:
  name: must-have-probes
spec:
  match:
    kinds:
      - apiGroups: [""]
        kinds: ["Pod"]
  parameters:
    probes: ["readinessProbe", "livenessProbe"]
    probeTypes: ["tcpSocket", "httpGet", "exec"]

add --enable-config-reloader-probes flag done

@simonpasquier
Copy link
Contributor

The Open Policy Agent is installed in the online kubernetes cluster. All containers in the pod must have livenessProbe or ReadinessProbe.

Ack, I think that being an opt-in feature is the best approach because from past experience, liveness probes can create accidental problems (e.g. probe timeouts triggering container restarts).

@dongjiang1989
Copy link
Contributor Author

The Open Policy Agent is installed in the online kubernetes cluster. All containers in the pod must have livenessProbe or ReadinessProbe.

Ack, I think that being an opt-in feature is the best approach because from past experience, liveness probes can create accidental problems (e.g. probe timeouts triggering container restarts).

I agree! It is very necessary to add --enable-config-reloader-probes flag. default value is false

cmd/operator/main.go Outdated Show resolved Hide resolved
@sthaha
Copy link
Contributor

sthaha commented Mar 28, 2023

Thank you @dongjiang1989 , Looks good to me. Will defer to @simonpasquier 's to review and approve

cmd/prometheus-config-reloader/main.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader.go Outdated Show resolved Hide resolved
cmd/operator/main.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Show resolved Hide resolved
dongjiang1989 and others added 2 commits March 28, 2023 20:02
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
@dongjiang1989
Copy link
Contributor Author

dongjiang1989 commented Mar 29, 2023

@simonpasquier Please review and approve

Copy link
Contributor

@JoaoBraveCoding JoaoBraveCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from my side lgtm

dongjiang1989 and others added 2 commits April 7, 2023 15:14
Sure! this is clean code.

Co-authored-by: Simon Pasquier <spasquie@redhat.com>
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
pkg/operator/config_reloader_test.go Outdated Show resolved Hide resolved
dongjiang1989 and others added 10 commits April 7, 2023 18:17
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
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.

None yet

5 participants