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 Aug 12, 2024
1 parent 5a35028 commit 0971d55
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 27 deletions.
5 changes: 3 additions & 2 deletions images/haproxy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ module "latest" {
}

module "test-latest" {
source = "./tests"
digest = module.latest.image_ref
source = "./tests"
digest = module.latest.image_ref
target_repository = var.target_repository
}

resource "oci_tag" "latest" {
Expand Down
82 changes: 57 additions & 25 deletions images/haproxy/tests/main.tf
Original file line number Diff line number Diff line change
@@ -1,43 +1,75 @@
terraform {
required_providers {
oci = { source = "chainguard-dev/oci" }
oci = { source = "chainguard-dev/oci" }
imagetest = { source = "chainguard-dev/imagetest" }
}
}

variable "target_repository" {}

variable "digest" {
description = "The image digest to run tests over."
}

locals { parsed = provider::oci::parse(var.digest) }

resource "random_pet" "suffix" {}
data "imagetest_inventory" "this" {}

module "cluster_harness" {
source = "../../../tflib/imagetest/harnesses/k3s/"

inventory = data.imagetest_inventory.this
name = basename(path.module)
target_repository = var.target_repository
cwd = path.module
}

module "helm" {
source = "../../../tflib/imagetest/helm"

resource "helm_release" "redis-ha" {
name = "haproxy-redis-${random_pet.suffix.id}"
namespace = "haproxy-system-${random_pet.suffix.id}"
repository = "https://dandydeveloper.github.io/charts"
chart = "redis-ha"
create_namespace = true
timeout = 300
name = "haproxy-redis"
namespace = "haproxy-system"
repo = "https://dandydeveloper.github.io/charts"
chart = "redis-ha"

values = [
jsonencode({
values = {
image = {
registry = "cgr.dev/chainguard/redis"
tag = "latest"
}
hardAntiAffinity = false
haproxy = {
enabled = true
hardAntiAffinity = false
image = {
registry = "cgr.dev/chainguard/redis"
tag = "latest"
repository = local.parsed.registry_repo
tag = local.parsed.pseudo_tag
}
hardAntiAffinity = false
haproxy = {
enabled = true
hardAntiAffinity = false
image = {
repository = local.parsed.registry_repo
tag = local.parsed.pseudo_tag
}
containerSecurityContext = {
capabilities = { add = ["NET_BIND_SERVICE"] }
}
containerSecurityContext = {
capabilities = { add = ["NET_BIND_SERVICE"] }
}
})
}
}
}

resource "imagetest_feature" "basic" {
name = "basic"
description = "Basic installation test"
harness = module.cluster_harness.harness

steps = [
{
name = "Install with helm"
cmd = module.helm.install_cmd
},
]

labels = {
type = "k8s"
}

timeouts = {
# The redis-ha rollout is painfully slow and prone to fruitless polling
create = "15m"
}
}

0 comments on commit 0971d55

Please sign in to comment.