Skip to content

Commit

Permalink
tests: dnspolicy scale testing (kind)
Browse files Browse the repository at this point in the history
* Add hack/dnspolicy-scale-testing to run multi cluster testing
  scenarios manually on kind clusters
* Add basic dns testing config for aws,azure,gcp and inmem providers

Signed-off-by: Michael Nairn <mnairn@redhat.com>
  • Loading branch information
mikenairn committed Nov 27, 2024
1 parent 5f8fff7 commit 1987a25
Showing 13 changed files with 575 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/kuadrant/dns-operator/config/local-setup/dns-operator?ref=${DNS_OPERATOR_GITREF}
# - github.com/kuadrant/dns-operator/config/prometheus?ref=${DNS_OPERATOR_GITREF} # Uncomment to enable prometheus monitor
# - github.com/kuadrant/dns-operator/config/prometheus?ref=${DNS_OPERATOR_GITREF} # Uncomment to enable prometheus monitor
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/kuadrant/dns-operator/config/local-setup/dns-operator?ref=main
# - github.com/kuadrant/dns-operator/config/prometheus?ref=main # Uncomment to enable prometheus monitor
# - github.com/kuadrant/dns-operator/config/prometheus?ref=main # Uncomment to enable prometheus monitor
31 changes: 31 additions & 0 deletions hack/dnspolicy-scale-testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## DNSPolicy Scale Testing

Create two kind clusters with Kuadrant installed:
```bash
CLUSTER_COUNT=2 ./hack/dnspolicy-scale-testing/test.sh kind-create
```

Installed namespaced dns operators (optional):
```bash
CLUSTER_COUNT=2 ./hack/dnspolicy-scale-testing/test.sh kind-install-namespaced-dns-operator
```

Run a test:
```bash
CLUSTER_COUNT=2 TEST_NS_COUNT=5 ./hack/dnspolicy-scale-testing/test.sh test_dnspolicy_loadbalanced aws
```

Cleanup after test:

Delete all dnspolices created by tests first and ensure all dnsrecords are removed
```shell
kubectl get dnspolicy -l kuadrant.io/test-suite=manual -A --context kind-kuadrant-local-1
kubectl delete dnspolicy -l kuadrant.io/test-suite=manual -A --context kind-kuadrant-local-1
kubectl get dnsrecord -A --context kind-kuadrant-local-1
```

Delete all other test suite resources
```shell
kubectl get all,httproutes,gateway,tlspolicy,secrets,issuers -l kuadrant.io/test-suite=manual -A --context kind-kuadrant-local-1
kubectl delete all,httproutes,gateway,tlspolicy,secrets,issuers -l kuadrant.io/test-suite=manual -A --context kind-kuadrant-local-1
```
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
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: prod-web-istio-inmemory
labels:
kuadrant.io/test-dns-provider: inmemory
spec:
gatewayClassName: istio
listeners:
- allowedRoutes:
namespaces:
from: Same
name: api
hostname: "myapp.kuadrant.local"
port: 80
protocol: HTTP
- allowedRoutes:
namespaces:
from: Same
name: api2
hostname: "myapp2.kuadrant.local"
port: 80
protocol: HTTP
- allowedRoutes:
namespaces:
from: Same
name: api-secure
hostname: "myapp.kuadrant.local"
port: 443
protocol: HTTPS
- allowedRoutes:
namespaces:
from: Same
name: api2-secure
hostname: "myapp2.kuadrant.local"
port: 443
protocol: HTTPS
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: prod-web-istio-aws
labels:
kuadrant.io/test-dns-provider: aws
spec:
gatewayClassName: istio
listeners:
- allowedRoutes:
namespaces:
from: Same
name: api
hostname: "myapp.scale.hcpapps.net"
port: 80
protocol: HTTP
- allowedRoutes:
namespaces:
from: Same
name: api2
hostname: "myapp2.scale.hcpapps.net"
port: 80
protocol: HTTP
- allowedRoutes:
namespaces:
from: Same
name: api-secure
hostname: "myapp.scale.hcpapps.net"
port: 443
protocol: HTTPS
- allowedRoutes:
namespaces:
from: Same
name: api2-secure
hostname: "myapp2.scale.hcpapps.net"
port: 443
protocol: HTTPS
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: prod-web-istio-gcp
labels:
kuadrant.io/test-dns-provider: gcp
spec:
gatewayClassName: istio
listeners:
- allowedRoutes:
namespaces:
from: Same
name: api
hostname: "myapp.scale.google.hcpapps.net"
port: 80
protocol: HTTP
- allowedRoutes:
namespaces:
from: Same
name: api2
hostname: "myapp2.scale.google.hcpapps.net"
port: 80
protocol: HTTP
- allowedRoutes:
namespaces:
from: Same
name: api-secure
hostname: "myapp.scale.google.hcpapps.net"
port: 443
protocol: HTTPS
- allowedRoutes:
namespaces:
from: Same
name: api2-secure
hostname: "myapp2.scale.google.hcpapps.net"
port: 443
protocol: HTTPS
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: prod-web-istio-azure
labels:
kuadrant.io/test-dns-provider: azure
spec:
gatewayClassName: istio
listeners:
- allowedRoutes:
namespaces:
from: Same
name: api
hostname: "myapp.scale.azure.hcpapps.net"
port: 80
protocol: HTTP
- allowedRoutes:
namespaces:
from: Same
name: api2
hostname: "myapp2.scale.azure.hcpapps.net"
port: 80
protocol: HTTP
- allowedRoutes:
namespaces:
from: Same
name: api-secure
hostname: "myapp.scale.azure.hcpapps.net"
port: 443
protocol: HTTPS
- allowedRoutes:
namespaces:
from: Same
name: api2-secure
hostname: "myapp2.scale.azure.hcpapps.net"
port: 443
protocol: HTTPS
Loading

0 comments on commit 1987a25

Please sign in to comment.