|
| 1 | +# DNSPolicy Scale Testing |
| 2 | + |
| 3 | +Scale testing using [kube-burner](https://kube-burner.github.io/kube-burner/latest). |
| 4 | + |
| 5 | +## Setup local environment (kind) |
| 6 | + |
| 7 | +Create a kind cluster with kuadrant and prometheus/thanos installed and configured using the [kuadrant-operator](https://github.com/Kuadrant/kuadrant-operator) repo tasks and config. |
| 8 | + |
| 9 | +In the kuadrant-operator directory, run the following to create a local kind cluster with kuadrant deployed: |
| 10 | +```shell |
| 11 | +make local-setup SUBNET_OFFSET=1 CIDR=26 NUM_IPS=64 |
| 12 | +``` |
| 13 | +Note: In order to test at scale, metallb must be configured with enough ip address to assign one to each gateway to be created. |
| 14 | + |
| 15 | +## Pre-test setup |
| 16 | + |
| 17 | +Scale down the default dns operator: |
| 18 | +```shell |
| 19 | +kubectl scale deployment/dns-operator-controller-manager --replicas=0 -n kuadrant-system |
| 20 | +``` |
| 21 | +Note: This is required for the default kubeburner workload (namespaced-dns-operator-deployments.yaml) as it creates its own dns operator deployments. |
| 22 | + |
| 23 | +Deploy the observability stack: |
| 24 | +```shell |
| 25 | +kubectl apply --server-side -k github.com/kuadrant/dns-operator/config/observability?ref=main # Run twice if it fails the first time dut o CRDs i.e. "ensure CRDs are installed first" |
| 26 | +``` |
| 27 | +Note: This should be in the kuadrant-operator repo instead of the dns operator |
| 28 | + |
| 29 | +Forward port for prometheus to allow kube burner to access it on the default PROMETHEUS_URL (http://127.0.0.1:9090): |
| 30 | +```shell |
| 31 | +kubectl -n monitoring port-forward service/thanos-query 9090:9090 |
| 32 | +``` |
| 33 | + |
| 34 | +## Run test |
| 35 | + |
| 36 | +The `test-scale-dnspolicy` make target can be used without input to run the default test workload with the default configuration: |
| 37 | + |
| 38 | +```shell |
| 39 | +make test-scale-dnspolicy |
| 40 | +``` |
| 41 | + |
| 42 | +View created resources: |
| 43 | +```shell |
| 44 | +kubectl get deployments,gateways,httproutes,secrets,dnspolicy -A -l kube-burner-uuid=3e6516a7-76a7-4e9f-a995-480f3512a8bb |
| 45 | +NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE |
| 46 | +kuadrant-dns-operator-0 deployment.apps/controller-manager 1/1 1 1 14m |
| 47 | +scale-test-0 deployment.apps/gw1-i0-istio 1/1 1 1 13m |
| 48 | +scale-test-0 deployment.apps/httpbin 1/1 1 1 14m |
| 49 | + |
| 50 | +NAMESPACE NAME CLASS ADDRESS PROGRAMMED AGE |
| 51 | +scale-test-0 gateway.gateway.networking.k8s.io/gw1-i0 istio 172.18.0.18 True 13m |
| 52 | + |
| 53 | +NAMESPACE NAME HOSTNAMES AGE |
| 54 | +scale-test-0 httproute.gateway.networking.k8s.io/httproute-gw1-l1-i0 ["api-1.dnspolicy-scale-test-loadbalanced.kuadrant.local"] 13m |
| 55 | + |
| 56 | +NAMESPACE NAME TYPE DATA AGE |
| 57 | +scale-test-0 secret/inmemory-credentials kuadrant.io/inmemory 1 14m |
| 58 | +``` |
| 59 | +Note: DNSPolices are deleted as part of the run as `SKIP_CLEANUP` defaults to false |
| 60 | + |
| 61 | +Alternatively it can be executed passing in values as required. Please refer to the `test-scale-dnspolicy` make target for possible variables and their default values. |
| 62 | +```shell |
| 63 | +make test-scale-dnspolicy JOB_ITERATIONS=1 NUM_GWS=1 NUM_LISTENERS=1 SKIP_CLEANUP=true DNS_PROVIDER=aws KUADRANT_ZONE_ROOT_DOMAIN=my.domain.com |
| 64 | +``` |
| 65 | + |
| 66 | +## Workloads |
| 67 | + |
| 68 | +The following describes the behaviour and configuration of the current DNSPolicy workloads. |
| 69 | + |
| 70 | +### namespaced-dns-operator-deployments |
| 71 | + |
| 72 | +The workload will create multiple instances of the dns operator in separate namespaces(kuadrant-dns-operator-x), and multiple test namespaces (scale-test-x) that the corresponding dns operator is configured to watch. |
| 73 | +The number of dns operator instances and test namespaces created is determined by the `JOB_ITERATIONS` environment variable. |
| 74 | +In each test namespace a test app and service is deployed and one or more gateways are created determined by the `NUM_GWS` environment variable. |
| 75 | +The number of listeners added to the gateway is determined by the `NUM_LISTENERS` environment variable. |
| 76 | +Each listener hostname is generated using the listener number and the `KUADRANT_ZONE_ROOT_DOMAIN` environment variable. |
| 77 | +In each test namespace a dns provider credential is created, the type created is determined by the `DNS_PROVIDER` environment variable, additional environment variables may need to be set depending on the provider type. |
| 78 | + |
| 79 | +#### Example Run |
| 80 | + |
| 81 | +Create a shared recordset in AWS (DNS_PROVIDER=aws) for a single host with four distinct A record values, owned by four DNSRecord resources, created by four gateway/dnspolices (JOB_ITERATIONS * NUM_GWS) processed by two dns operators(JOB_ITERATIONS). |
| 82 | + |
| 83 | +```shell |
| 84 | +make test-scale-dnspolicy JOB_ITERATIONS=2 NUM_GWS=2 NUM_LISTENERS=1 DNS_PROVIDER=aws KUADRANT_AWS_ACCESS_KEY_ID=<my aws access key> KUADRANT_AWS_SECRET_ACCESS_KEY=<my aws secret id>. KUADRANT_AWS_REGION='' KUADRANT_ZONE_ROOT_DOMAIN=mn.hcpapps.net SKIP_CLEANUP=true |
| 85 | +... |
| 86 | +time="2025-01-13 10:19:27" level=info msg="Finished execution with UUID: 469d4b4e-6c41-4433-8c4b-2c48ea4973bc" file="job.go:247" |
| 87 | +time="2025-01-13 10:19:27" level=info msg="👋 Exiting kube-burner 469d4b4e-6c41-4433-8c4b-2c48ea4973bc" file="kube-burner.go:85" |
| 88 | +``` |
| 89 | + |
| 90 | +Resource Created in cluster: |
| 91 | + |
| 92 | +```shell |
| 93 | +kubectl get deployments,gateways,httproutes,secrets,dnspolicy -A -l kube-burner-uuid=469d4b4e-6c41-4433-8c4b-2c48ea4973bc |
| 94 | +NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE |
| 95 | +kuadrant-dns-operator-0 deployment.apps/controller-manager 1/1 1 1 12m |
| 96 | +kuadrant-dns-operator-1 deployment.apps/controller-manager 1/1 1 1 12m |
| 97 | +scale-test-0 deployment.apps/gw1-i0-istio 1/1 1 1 9m26s |
| 98 | +scale-test-0 deployment.apps/gw2-i0-istio 1/1 1 1 9m26s |
| 99 | +scale-test-0 deployment.apps/httpbin 1/1 1 1 11m |
| 100 | +scale-test-1 deployment.apps/gw1-i1-istio 1/1 1 1 9m26s |
| 101 | +scale-test-1 deployment.apps/gw2-i1-istio 1/1 1 1 9m25s |
| 102 | +scale-test-1 deployment.apps/httpbin 1/1 1 1 11m |
| 103 | + |
| 104 | +NAMESPACE NAME CLASS ADDRESS PROGRAMMED AGE |
| 105 | +scale-test-0 gateway.gateway.networking.k8s.io/gw1-i0 istio 172.18.0.2 True 9m26s |
| 106 | +scale-test-0 gateway.gateway.networking.k8s.io/gw2-i0 istio 172.18.0.3 True 9m26s |
| 107 | +scale-test-1 gateway.gateway.networking.k8s.io/gw1-i1 istio 172.18.0.4 True 9m26s |
| 108 | +scale-test-1 gateway.gateway.networking.k8s.io/gw2-i1 istio 172.18.0.5 True 9m25s |
| 109 | + |
| 110 | +NAMESPACE NAME HOSTNAMES AGE |
| 111 | +scale-test-0 httproute.gateway.networking.k8s.io/httproute-gw1-l1-i0 ["api-1.dnspolicy-scale-test-loadbalanced.mn.hcpapps.net"] 9m26s |
| 112 | +scale-test-0 httproute.gateway.networking.k8s.io/httproute-gw2-l1-i0 ["api-1.dnspolicy-scale-test-loadbalanced.mn.hcpapps.net"] 9m26s |
| 113 | +scale-test-1 httproute.gateway.networking.k8s.io/httproute-gw1-l1-i1 ["api-1.dnspolicy-scale-test-loadbalanced.mn.hcpapps.net"] 9m25s |
| 114 | +scale-test-1 httproute.gateway.networking.k8s.io/httproute-gw2-l1-i1 ["api-1.dnspolicy-scale-test-loadbalanced.mn.hcpapps.net"] 9m25s |
| 115 | + |
| 116 | +NAMESPACE NAME TYPE DATA AGE |
| 117 | +scale-test-0 secret/aws-credentials kuadrant.io/aws 3 11m |
| 118 | +scale-test-1 secret/aws-credentials kuadrant.io/aws 3 11m |
| 119 | + |
| 120 | +NAMESPACE NAME AGE |
| 121 | +scale-test-0 dnspolicy.kuadrant.io/dnspolicy-gw1-i0 9m26s |
| 122 | +scale-test-0 dnspolicy.kuadrant.io/dnspolicy-gw2-i0 9m26s |
| 123 | +scale-test-1 dnspolicy.kuadrant.io/dnspolicy-gw1-i1 9m25s |
| 124 | +scale-test-1 dnspolicy.kuadrant.io/dnspolicy-gw2-i1 9m25s |
| 125 | +``` |
| 126 | + |
| 127 | +Records Created in AWS: |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +## Useful commands |
| 132 | + |
| 133 | +Delete all resources created by the test, useful if you used SKIP_CLEANUP=true |
| 134 | +```shell |
| 135 | +kubectl delete gateway,httproute,dnspolicy,all -A -l app=scale-test |
| 136 | +``` |
| 137 | + |
| 138 | +Tail all logs of dns operators created by a specific kubeburner job |
| 139 | +```shell |
| 140 | +kubectl stern -l kube-burner-job=dnspolicy-scale-test-setup-namespaced-dns-operators -A |
| 141 | +``` |
0 commit comments