-
Notifications
You must be signed in to change notification settings - Fork 151
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
f977e30
commit 43fb887
Showing
4 changed files
with
105 additions
and
96 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,26 +1,117 @@ | ||
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." | ||
} | ||
|
||
data "oci_exec_test" "version" { | ||
digest = var.digest | ||
script = "docker run --rm $IMAGE_NAME envoy --version | grep '^envoy version:'" | ||
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 | ||
} | ||
|
||
resource "random_pet" "suffix" {} | ||
resource "imagetest_feature" "basic" { | ||
name = "basic" | ||
description = "Basic installation test" | ||
harness = module.cluster_harness.harness | ||
|
||
steps = [ | ||
{ | ||
name = "Install and tickle" | ||
cmd = <<EOF | ||
kubectl create ns envoy-static | ||
cat <<YAML | kubectl apply -f - | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: envoy-config | ||
namespace: envoy-static | ||
data: | ||
static.yaml: | | ||
static_resources: | ||
listeners: | ||
- name: listener_0 | ||
address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 8080 | ||
filter_chains: | ||
- filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
stat_prefix: edge | ||
http_filters: | ||
- name: envoy.filters.http.router | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
route_config: | ||
virtual_hosts: | ||
- name: direct_response_service | ||
domains: ["*"] | ||
routes: | ||
- match: | ||
prefix: "/test-envoy-static" | ||
direct_response: | ||
status: 200 | ||
body: | ||
inline_string: | | ||
Yes it's working | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: envoy | ||
namespace: envoy-static | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: envoy | ||
template: | ||
metadata: | ||
labels: | ||
app: envoy | ||
spec: | ||
containers: | ||
- name: envoy | ||
image: ${var.digest} | ||
args: | ||
- "--config-path" | ||
- "/etc/envoy-config/static.yaml" | ||
ports: | ||
- containerPort: 8080 | ||
readinessProbe: | ||
httpGet: | ||
port: 8080 | ||
path: /test-envoy-static | ||
volumeMounts: | ||
- name: envoy-config | ||
mountPath: /etc/envoy-config | ||
volumes: | ||
- name: envoy-config | ||
configMap: | ||
name: envoy-config | ||
YAML | ||
data "oci_exec_test" "serving-static-rules" { | ||
digest = var.digest | ||
script = "${path.module}/static.sh" | ||
kubectl rollout status deployment -n envoy-static envoy --timeout=5m | ||
EOF | ||
}, | ||
] | ||
|
||
env { | ||
name = "NAMESPACE" | ||
value = "envoy-static-${random_pet.suffix.id}" | ||
labels = { | ||
type = "k8s" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.