Skip to content

Commit

Permalink
WIP testing
Browse files Browse the repository at this point in the history
* Add sail operator to dependency kustomizations
* Add hack/testing to run multi cluster testing scenarios manually on kind clusters
* Add kustomize_overlays make targets
* Add basic dns testing config for aws,azure,gcp and inmem providers

Signed-off-by: Michael Nairn <[email protected]>
  • Loading branch information
mikenairn committed Nov 22, 2024
1 parent ce778a2 commit 257473b
Show file tree
Hide file tree
Showing 18 changed files with 727 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/dependencies/istio/sail/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- istio.yaml
11 changes: 11 additions & 0 deletions config/dependencies/istio/sail/operator/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: istio-system
resources:
- namespace.yaml
helmCharts:
- name: sail-operator
repo: https://istio-ecosystem.github.io/sail-operator
version: 0.1.0
namespace: istio-system
includeCRDs: true
4 changes: 4 additions & 0 deletions config/dependencies/istio/sail/operator/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: istio-system
21 changes: 21 additions & 0 deletions hack/testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@


Create two kind clusters (Minimal setup, no kuadrant):
```bash
CLUSTER_COUNT=2 ./hack/testing/test.sh kind-create
```

Generate kuadrant deployment overlays for each cluster:
```bash
CLUSTER_COUNT=2 ./hack/testing/test.sh generate-cluster-overlay
```

Apply kuadrant deployment overlays for each cluster:
```bash
CLUSTER_COUNT=2 ./hack/testing/test.sh apply-cluster-overlay
```

Run a test:
```bash
CLUSTER_COUNT=2 TEST_NS_COUNT=1 ./hack/testing/test.sh test_dnspolicy_simple
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
secretGenerator:
- literals:
- INMEM_INIT_ZONES=kuadrant.local
name: dns-provider-credentials-inmemory
options:
disableNameSuffixHash: true
labels:
kuadrant.io/test-dns-provider: inmemory
type: kuadrant.io/inmemory
#- envs:
# - gcp-credentials.env
# name: dns-provider-credentials-gcp
# options:
# disableNameSuffixHash: true
# labels:
# kuadrant.io/test-dns-provider: gcp
# type: kuadrant.io/gcp
#- envs:
# - aws-credentials.env
# name: dns-provider-credentials-aws
# options:
# disableNameSuffixHash: true
# labels:
# kuadrant.io/test-dns-provider: aws
# type: kuadrant.io/aws
#- envs:
# - azure-credentials.env
# name: dns-provider-credentials-azure
# options:
# disableNameSuffixHash: true
# labels:
# kuadrant.io/test-dns-provider: azure
# type: kuadrant.io/azure
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: kuadrant.io/v1
kind: DNSPolicy
metadata:
name: prod-web-inmemory
labels:
kuadrant.io/test-dns-provider: inmemory
spec:
targetRef:
name: prod-web-istio-inmemory
group: gateway.networking.k8s.io
kind: Gateway
providerRefs:
- name: dns-provider-credentials-inmemory
loadBalancing:
defaultGeo: true
geo: US
weight: 100
---
apiVersion: kuadrant.io/v1
kind: DNSPolicy
metadata:
name: prod-web-aws
labels:
kuadrant.io/test-dns-provider: aws
spec:
targetRef:
name: prod-web-istio-aws
group: gateway.networking.k8s.io
kind: Gateway
providerRefs:
- name: dns-provider-credentials-aws
loadBalancing:
defaultGeo: true
geo: US
weight: 100
---
apiVersion: kuadrant.io/v1
kind: DNSPolicy
metadata:
name: prod-web-gcp
labels:
kuadrant.io/test-dns-provider: gcp
spec:
targetRef:
name: prod-web-istio-gcp
group: gateway.networking.k8s.io
kind: Gateway
providerRefs:
- name: dns-provider-credentials-gcp
loadBalancing:
defaultGeo: true
geo: us-east1
weight: 100
---
apiVersion: kuadrant.io/v1
kind: DNSPolicy
metadata:
name: prod-web-azure
labels:
kuadrant.io/test-dns-provider: azure
spec:
targetRef:
name: prod-web-istio-azure
group: gateway.networking.k8s.io
kind: Gateway
providerRefs:
- name: dns-provider-credentials-azure
loadBalancing:
defaultGeo: true
geo: GEO-NA
weight: 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resources:
- dnspolicy_prod-web-istio-loadbalanced.yaml

labels:
- pairs:
kuadrant.io/test-suite: manual
kuadrant.io/test: dnspolicy_prod-web-istio-loadbalanced
includeTemplates: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: kuadrant.io/v1
kind: DNSPolicy
metadata:
name: prod-web-inmemory
labels:
kuadrant.io/test-dns-provider: inmemory
spec:
targetRef:
name: prod-web-istio-inmemory
group: gateway.networking.k8s.io
kind: Gateway
providerRefs:
- name: dns-provider-credentials-inmemory
---
apiVersion: kuadrant.io/v1
kind: DNSPolicy
metadata:
name: prod-web-aws
labels:
kuadrant.io/test-dns-provider: aws
spec:
targetRef:
name: prod-web-istio-aws
group: gateway.networking.k8s.io
kind: Gateway
providerRefs:
- name: dns-provider-credentials-aws
---
apiVersion: kuadrant.io/v1
kind: DNSPolicy
metadata:
name: prod-web-gcp
labels:
kuadrant.io/test-dns-provider: gcp
spec:
targetRef:
name: prod-web-istio-gcp
group: gateway.networking.k8s.io
kind: Gateway
providerRefs:
- name: dns-provider-credentials-gcp
---
apiVersion: kuadrant.io/v1
kind: DNSPolicy
metadata:
name: prod-web-azure
labels:
kuadrant.io/test-dns-provider: azure
spec:
targetRef:
name: prod-web-istio-azure
group: gateway.networking.k8s.io
kind: Gateway
providerRefs:
- name: dns-provider-credentials-azure
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resources:
- dnspolicy_prod-web-istio-simple.yaml

labels:
- pairs:
kuadrant.io/test-suite: manual
kuadrant.io/test: dnspolicy_prod-web-istio-simple
includeTemplates: true
71 changes: 71 additions & 0 deletions hack/testing/config/test-namespace/echo-app-istio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: my-route-inmemory
labels:
kuadrant.io/test-dns-provider: inmemory
spec:
parentRefs:
- kind: Gateway
name: prod-web-istio-inmemory
hostnames:
- "myapp.kuadrant.local"
- "myapp2.kuadrant.local"
rules:
- backendRefs:
- name: echo
port: 8080
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: my-route-aws
labels:
kuadrant.io/test-dns-provider: aws
spec:
parentRefs:
- kind: Gateway
name: prod-web-istio-aws
hostnames:
- "myapp.mn.hcpapps.net"
- "myapp2.mn.hcpapps.net"
rules:
- backendRefs:
- name: echo
port: 8080
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: my-route-gcp
labels:
kuadrant.io/test-dns-provider: gcp
spec:
parentRefs:
- kind: Gateway
name: prod-web-istio-gcp
hostnames:
- "myapp.mn.google.hcpapps.net"
- "myapp2.mn.google.hcpapps.net"
rules:
- backendRefs:
- name: echo
port: 8080
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: my-route-azure
labels:
kuadrant.io/test-dns-provider: azure
spec:
parentRefs:
- kind: Gateway
name: prod-web-istio-azure
hostnames:
- "myapp.mn.azure.hcpapps.net"
- "myapp2.mn.azure.hcpapps.net"
rules:
- backendRefs:
- name: echo
port: 8080
34 changes: 34 additions & 0 deletions hack/testing/config/test-namespace/echo-app/echo-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v1
kind: Service
metadata:
name: echo
spec:
ports:
- name: http-port
port: 8080
targetPort: http-port
protocol: TCP
selector:
app: echo
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: echo
spec:
replicas: 1
selector:
matchLabels:
app: echo
template:
metadata:
labels:
app: echo
spec:
containers:
- name: echo
image: docker.io/jmalloc/echo-server
ports:
- name: http-port
containerPort: 8080
protocol: TCP
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resources:
- echo-app.yaml

labels:
- pairs:
kuadrant.io/test-suite: manual
includeTemplates: true
Loading

0 comments on commit 257473b

Please sign in to comment.