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

Add postgres exporter sidecar and metrics service #117

Merged
merged 9 commits into from
Feb 15, 2023

Conversation

sjmiller609
Copy link
Contributor

No description provided.

@sjmiller609 sjmiller609 changed the title Add postgres exporter sidecar Add postgres exporter sidecar and metrics service Feb 15, 2023
@sjmiller609 sjmiller609 marked this pull request as ready for review February 15, 2023 19:42
debug!("Did not find primary pod is ready");
let primary_pod = primary_pod.unwrap();

if !is_postgres_ready().matches_object(Some(&primary_pod)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we wait just for postgres to be ready, not the whole pod, before creating the postgres exporter role

@@ -45,7 +45,7 @@ impl PsqlCommand {

pub async fn execute(&self) -> Result<PsqlOutput, kube::Error> {
let attach_params = AttachParams {
container: None,
container: Some("postgres".to_string()),
Copy link
Contributor Author

@sjmiller609 sjmiller609 Feb 15, 2023

Choose a reason for hiding this comment

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

now we have two containers in the pod, so add the container name to psql into with kube exec

@@ -53,6 +56,74 @@ pub fn stateful_set_from_cdb(cdb: &CoreDB) -> StatefulSet {
..VolumeMount::default()
},
]);
let mut containers = vec![
Copy link
Contributor Author

Choose a reason for hiding this comment

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

move containers into separate variable in order to enable conditionally appending the sidecar

Copy link
Member

@ianstanton ianstanton left a comment

Choose a reason for hiding this comment

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

@sjmiller609 LGTM! Thoughts on following up with a simple 'scrape metrics' test? We could argue this is not the operator's responsibility, but I think it's good to test the metrics are served as expected.

@sjmiller609 sjmiller609 merged commit a71bda2 into main Feb 15, 2023
@sjmiller609 sjmiller609 deleted the postgres-exporter-2 branch February 15, 2023 21:02
sjmiller609 pushed a commit that referenced this pull request Dec 5, 2023
…ent (#117)

* move postgres-exporter out of statefulset and into deployment

* fmt

* fix clippy warnings, add correct connection string

* change policy creation to be async

* fix fmt

* set postgres-exporter password as secret, refactor envvars, set role pass

* remove local debug line

* fixing tests

* add more tests to assert deployments and secrets

* adjust PolicyRule for postgres-exporter

* fmt

* fix possible naming collisions

* move test to not have a race condition

* more race condition fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants