Skip to content

Commit

Permalink
fix: kubernetes resource fixture to test ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Apr 3, 2024
1 parent 5d3e3c0 commit 862142e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
37 changes: 36 additions & 1 deletion fixtures/k8s/kubernetes_resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,27 @@ spec:
kubernetesResource:
- name: ingress-accessibility-check
namespace: default
description: "deploy an nginx pod"
description: "deploy an nginx pod & check that it's accessible via ingress"
waitForReady: true
timeout: 10m
staticResources:
- apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-pod-ingress
namespace: default
spec:
rules:
- host: nginx.test.flanksource.com
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: nginx
port:
number: 80
resources:
- apiVersion: v1
kind: Pod
Expand All @@ -26,3 +44,20 @@ spec:
image: nginx:1.24.0-alpine-slim
ports:
- containerPort: 80
- apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: default
spec:
selector:
name: nginx-pod
ports:
- port: 80
targetPort: 80
checks:
- http:
url: "nginx.default.svc.cluster.local"
headers:
host: "{{(index (index .staticResources 0).spec.rules 0).host}}"

1 change: 1 addition & 0 deletions fixtures/k8s/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ resources:
- pod_fail.yaml
- pod_pass.yaml
- kubernetes_bundle.yaml
- kuberenetes_resource.yaml
3 changes: 3 additions & 0 deletions test/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ if [ "$SKIP_SETUP" != "true" ]; then
echo "::endgroup::"
fi

# Just testing TODO: remove this
kubectl get svc -A

image=ubuntu

if [[ -e $TEST_FOLDER/_image ]]; then
Expand Down

0 comments on commit 862142e

Please sign in to comment.