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 14, 2024
1 parent f977e30 commit 43fb887
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 96 deletions.
5 changes: 3 additions & 2 deletions images/envoy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,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
113 changes: 102 additions & 11 deletions images/envoy/tests/main.tf
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"
}
}
15 changes: 0 additions & 15 deletions images/envoy/tests/static.sh

This file was deleted.

68 changes: 0 additions & 68 deletions images/envoy/tests/static.yaml

This file was deleted.

0 comments on commit 43fb887

Please sign in to comment.