-
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
5a35028
commit 0971d55
Showing
2 changed files
with
60 additions
and
27 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,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" | ||
} | ||
} |