Skip to content

Commit

Permalink
automated commit
Browse files Browse the repository at this point in the history
Signed-off-by: Public copy <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Jul 16, 2024
1 parent d60513d commit c09c062
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 68 deletions.
7 changes: 4 additions & 3 deletions images/newrelic-infrastructure-bundle/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ module "newrelic-infrastructure-bundle" {
}

module "test" {
source = "./tests"
digest = module.newrelic-infrastructure-bundle.image_ref
license_key = var.license_key
source = "./tests"
digest = module.newrelic-infrastructure-bundle.image_ref
license_key = var.license_key
target_repository = var.target_repository
}

resource "oci_tag" "latest" {
Expand Down
129 changes: 64 additions & 65 deletions images/newrelic-infrastructure-bundle/tests/main.tf
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"
}
}

0 comments on commit c09c062

Please sign in to comment.