-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Public copy <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d60513d
commit c09c062
Showing
2 changed files
with
68 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,92 @@ | ||
terraform { | ||
required_providers { | ||
oci = { source = "chainguard-dev/oci" } | ||
helm = { source = "hashicorp/helm" } | ||
oci = { source = "chainguard-dev/oci" } | ||
imagetest = { source = "chainguard-dev/imagetest" } | ||
} | ||
} | ||
|
||
variable "license_key" {} | ||
|
||
variable "target_repository" {} | ||
|
||
variable "digest" { | ||
description = "The image digests to run tests over." | ||
type = string | ||
description = "The image digest to run tests over." | ||
} | ||
|
||
locals { parsed = provider::oci::parse(var.digest) } | ||
|
||
resource "random_pet" "suffix" {} | ||
data "imagetest_inventory" "this" {} | ||
|
||
resource "helm_release" "nri-bundle" { | ||
name = "newrelic-ib-${random_pet.suffix.id}" | ||
namespace = "newrelic-ib-${random_pet.suffix.id}" | ||
repository = "https://helm-charts.newrelic.com" | ||
chart = "nri-bundle" | ||
create_namespace = true | ||
module "cluster_harness" { | ||
source = "../../../tflib/imagetest/harnesses/k3s/" | ||
|
||
values = [ | ||
jsonencode({ | ||
global = { | ||
cluster = "test" | ||
licenseKey = var.license_key | ||
} | ||
inventory = data.imagetest_inventory.this | ||
name = basename(path.module) | ||
target_repository = var.target_repository | ||
cwd = path.module | ||
} | ||
|
||
newrelic-infrastructure = { | ||
privileged = true | ||
kubelet = { | ||
// We use some extra volume mounts needed when running in a docker-in-docker environment | ||
extraVolumeMounts = [{ | ||
mountPath = "/var/run/newrelic-infra" | ||
name = "var-run-newrelic-infra" | ||
}] | ||
extraVolumes = [{ | ||
hostPath = { | ||
path = "/var/run/newrelic-infra" | ||
} | ||
name = "var-run-newrelic-infra" | ||
}] | ||
} | ||
images = { | ||
agent = { | ||
registry = local.parsed.registry | ||
repository = local.parsed.repo | ||
tag = local.parsed.pseudo_tag | ||
module "helm" { | ||
source = "../../../tflib/imagetest/helm" | ||
|
||
repo = "https://helm-charts.newrelic.com" | ||
chart = "nri-bundle" | ||
|
||
values = { | ||
global = { | ||
cluster = "test" | ||
licenseKey = var.license_key | ||
} | ||
|
||
newrelic-infrastructure = { | ||
privileged = true | ||
kubelet = { | ||
// We use some extra volume mounts needed when running in a docker-in-docker environment | ||
extraVolumeMounts = [{ | ||
mountPath = "/var/run/newrelic-infra" | ||
name = "var-run-newrelic-infra" | ||
}] | ||
extraVolumes = [{ | ||
hostPath = { | ||
path = "/var/run/newrelic-infra" | ||
} | ||
name = "var-run-newrelic-infra" | ||
}] | ||
} | ||
images = { | ||
agent = { | ||
registry = local.parsed.registry | ||
repository = local.parsed.repo | ||
tag = local.parsed.pseudo_tag | ||
} | ||
} | ||
} | ||
|
||
kube-state-metrics = { | ||
enabled = true | ||
} | ||
kube-state-metrics = { | ||
enabled = true | ||
} | ||
|
||
nri-metadata-injection = { enabled = false } | ||
newrelic-pixie = { enabled = false } | ||
pixie-chart = { enabled = false } | ||
newrelic-infra-operator = { enabled = false } | ||
newrelic-k8s-metrics-adapter = { enabled = false } | ||
}) | ||
] | ||
nri-metadata-injection = { enabled = false } | ||
newrelic-pixie = { enabled = false } | ||
pixie-chart = { enabled = false } | ||
newrelic-infra-operator = { enabled = false } | ||
newrelic-k8s-metrics-adapter = { enabled = false } | ||
} | ||
} | ||
|
||
data "oci_exec_test" "check-deployment" { | ||
digest = var.digest | ||
script = "./helm.sh" | ||
working_dir = path.module | ||
depends_on = [helm_release.nri-bundle] | ||
resource "imagetest_feature" "basic" { | ||
name = "basic" | ||
description = "Basic installation" | ||
harness = module.cluster_harness.harness | ||
|
||
env = [ | ||
{ | ||
name = "NAMESPACE" | ||
value = helm_release.nri-bundle.namespace | ||
}, | ||
steps = [ | ||
{ | ||
name = "NAME" | ||
value = helm_release.nri-bundle.name | ||
name = "Helm Install" | ||
cmd = module.helm.install_cmd | ||
} | ||
] | ||
} | ||
|
||
module "helm_cleanup" { | ||
source = "../../../tflib/helm-cleanup" | ||
name = helm_release.nri-bundle.id | ||
namespace = helm_release.nri-bundle.namespace | ||
depends_on = [data.oci_exec_test.check-deployment] | ||
labels = { | ||
type = "k8s" | ||
} | ||
} |