Skip to content

Commit

Permalink
Remove bitnami from prometheus-mongodb-exporter (#1664)
Browse files Browse the repository at this point in the history
* Create mongodb-exporter bitnami repo

Signed-off-by: Kathleen Juell <[email protected]>

* Update main.tf

Signed-off-by: Kathleen Juell <[email protected]>

* Remove prometheus-mongodb-exporter-bitnami

Signed-off-by: Kathleen Juell <[email protected]>

---------

Signed-off-by: Kathleen Juell <[email protected]>
  • Loading branch information
katjuell authored Oct 18, 2023
1 parent bf86e68 commit 21fbc8a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 52 deletions.
4 changes: 0 additions & 4 deletions images/prometheus-mongodb-exporter/config/latest.apko.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
contents:
packages:
# These are only needed for bitnami compatiblity.
- bash
- busybox
- prometheus-mongodb-exporter-bitnami-compat

accounts:
groups:
Expand Down
5 changes: 1 addition & 4 deletions images/prometheus-mongodb-exporter/config/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ variable "extra_packages" {

data "apko_config" "this" {
config_contents = file("${path.module}/latest.apko.yaml")
extra_packages = concat(
var.extra_packages,
["prometheus-mongodb-exporter-bitnami-compat"],
)
extra_packages = var.extra_packages
}

output "config" {
Expand Down
1 change: 0 additions & 1 deletion images/prometheus-mongodb-exporter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module "latest" {
target_repository = var.target_repository
config = module.latest-config.config
build-dev = true

}

module "test-latest" {
Expand Down
50 changes: 7 additions & 43 deletions images/prometheus-mongodb-exporter/tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,20 @@ data "oci_string" "ref" {

resource "random_pet" "suffix" {}

resource "helm_release" "bitnami" {
resource "helm_release" "test" {
name = "prometheus-mongodb-exporter-${random_pet.suffix.id}"
repository = "oci://registry-1.docker.io/bitnamicharts"
chart = "mongodb"

namespace = "prometheus-mongodb-exporter-${random_pet.suffix.id}"
create_namespace = true
repository = "https://prometheus-community.github.io/helm-charts"
chart = "prometheus-mongodb-exporter"

values = [jsonencode({
image = {
debug = true
}
metrics = {
enabled = true
image = {
registry = data.oci_string.ref.registry
repository = data.oci_string.ref.repo
digest = data.oci_string.ref.digest
}
repository = data.oci_string.ref.registry_repo
tag = data.oci_string.ref.pseudo_tag
}
})]

wait = false
}

// The upstream helm chart does not become ready even using the upstream image.
// In any case, we only care about the metrics container, which should become ready with our image.
// So instead of waiting for the Helm chart to become ready, we only check the metrics container status.
// This won't be ready immediately, but it should be ready within 30 seconds, or else something is wrong.
data "oci_exec_test" "check-metrics-container" {
depends_on = [helm_release.bitnami]
digest = var.digest
script = <<EOF
set -e
sleep 30
status=$(kubectl get pods -n prometheus-mongodb-exporter-${random_pet.suffix.id} -ojsonpath="{.items[0].status.containerStatuses[0].ready}")
if [ "$status" == "true" ]; then
echo "Metrics container ready"
exit 0
fi
echo "Metrics container not ready after 30 seconds!"
kubectl get pods -n prometheus-mongodb-exporter-${random_pet.suffix.id} -oyaml
EOF
}

module "helm_cleanup" {
depends_on = [data.oci_exec_test.check-metrics-container]

source = "../../../tflib/helm-cleanup"
name = helm_release.bitnami.id
namespace = helm_release.bitnami.namespace
source = "../../../tflib/helm-cleanup"
name = helm_release.test.id
}

0 comments on commit 21fbc8a

Please sign in to comment.