Cudn http #504
Current --http-server-address validation only checks that the value splits as host:port, but the templates assume an IPv4 CIDR ("/32") and an integer port. Passing a hostname, IPv6, or a non-numeric port will produce invalid NetworkPolicy/EgressFirewall manifests and may break the bastion podman port mapping.
Consider validating that the host is a parsed IPv4 address and that the port contains only digits before continuing.
The readinessProbe builds a shell command with a user-provided address ("/bin/sh -c curl ... http://{{.httpServerAddress}}..."). This can break on special characters and unnecessarily introduces shell-injection risk.
You can call curl directly without a shell and (like deployment-client.yml) set explicit timeout/failure thresholds so external HTTP checks don't flap due to the 1s default exec timeout.
This script doesn't enable strict error handling, so failures (e.g., podman not installed, image pull failure, port bind failure) can still result in a successful exit and misleading "nginx ... is running" output.
Other scripts in cmd/config/scripts commonly use set -e or set -euo pipefail; adding it here will make hook failures surface immediately to kube-burner.
The PR description mentions hloader integration, new flags like --http-load-test-rate/--hloader-metrics, and a PodMonitor for hloader metrics, but this change set appears to only add --http-server-address plus nginx/policy/readiness-probe wiring (no hloader/PodMonitor references found in the repo).
Please either update the PR description to match what is implemented here, or include the missing flags/templates so reviewers can validate the full intended feature.
Pull request overview
This pull request extends the cudn-density workload with an optional “external HTTP server” integration by introducing a new --http-server-address flag, wiring that address into kube-burner templates, and adding automation to stand up an nginx container on a bastion via hooks.
Changes:
--http-server-address flag to cudn-density and propagated parsed values into workload template variables.cudn_nginx.sh helper and kube-burner hooks to setup/cleanup the nginx container when the flag is provided.Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
<details>
<summary>Show a summary per file</summary>
| File | Description |
| ---- | ----------- |
| pkg/workloads/cudn-density.go | Adds --http-server-address flag, validates/parses it, and exports it into workload variables. |
| cmd/config/scripts/cudn_nginx.sh | New helper script to run/cleanup an nginx container via podman on the bastion. |
| cmd/config/cudn-density/np-allow-app-egress.yml | Conditionally allows app egress to the configured HTTP server IP/port. |
| cmd/config/cudn-density/egressfirewall.yml | Conditionally allows OVN egress to the configured HTTP server IP. |
| cmd/config/cudn-density/deployment-app.yml | Adds optional readiness probe that curls the configured external HTTP server. |
| cmd/config/cudn-density/cudn-density.yml | Adds hooks to setup/cleanup nginx and passes HTTP server vars into templates. |
</details>
---
💡 <a href="/kube-burner/kube-burner-ocp/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a code-review agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/en/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
<details>
<summary>Suppressed comments (3)</summary>
pkg/workloads/cudn-density.go:154
--http-server-address is validated with net.SplitHostPort, but the templates later use the host as an IPv4 /32 CIDR (NetworkPolicy ipBlock and EgressFirewall cidrSelector). As written, hostnames and IPv6 addresses would pass validation but generate invalid CIDRs at runtime. Validate that the host portion is an IPv4 address (ParseIP + To4) when the flag is set. if httpServerAddress != "" {
if _, _, err := net.SplitHostPort(httpServerAddress); err != nil {
log.Fatalf("--http-server-address must be in ip:port format, got '%s': %v", httpServerAddress, err)
}
}
cmd/config/cudn-density/deployment-app.yml:43
Kubernetes exec probe commands are argv arrays; providing a single string like "curl -f ..." makes the kubelet try to exec a binary literally named with spaces, so the readiness probe will fail. Split the curl command into arguments (or use /bin/sh -c like other probes in this repo).
readinessProbe:
exec:
command: ["curl -f -sS http://{{.httpServerAddress}}/1024.html"]
periodSeconds: 1
cmd/config/scripts/cudn_nginx.sh:17
setup action, the script calls cleanup and then immediately runs podman rm again. This is redundant and makes logs noisier; cleanup already removes the container. echo "Setting up nginx HTTP server on ${HTTP_SERVER_ADDRESS}..."
podman rm -f -t 0 "$CONTAINER_NAME" 2>/dev/null || true
podman run -d --name "$CONTAINER_NAME" -p "${HTTP_SERVER_ADDRESS}:8080" quay.io/cloud-bulldozer/nginx:latest
</details>
cc @mohit-sheth @jtaleric
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Maybe CI tests can be fixed now with the recent hooks fix that went in.
readinessProbe.exec.command is currently provided as a single string with spaces. Kubernetes exec probes expect an argv array (or sh -c ...); with the current value the kubelet will try to execute a binary literally named curl -f -sS http://..., so the probe will always fail.
The updated --http-server-address validation uses strconv.Atoi, but strconv is not imported yet.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
<details>
<summary>Suppressed comments (1)</summary>
pkg/workloads/cudn-density.go:154
--http-server-address validation only checks that the value parses as host:port. net.SplitHostPort will still accept hostnames (e.g. example.com:80) and non-numeric ports (e.g. 1.2.3.4:http), but the workload templates later treat the host as an IP (appending /32) and the scripts/NPs expect a numeric port. This can lead to invalid rendered YAML or failing podman -p invocations. if httpServerAddress != "" {
if _, _, err := net.SplitHostPort(httpServerAddress); err != nil {
log.Fatalf("--http-server-address must be in ip:port format, got '%s': %v", httpServerAddress, err)
}
}
</details>
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
<details>
<summary>Suppressed comments (1)</summary>
pkg/workloads/cudn-density.go:154
--http-server-address is only validated with net.SplitHostPort, which still allows non-IP hosts (e.g. example.com:8080) and non-numeric/service-name ports (e.g. 1.2.3.4:http). That can later break rendering of ipBlock.cidr: <host>/32 in templates and also fail podman -p <host>:<port>:8080 in cudn_nginx.sh. Since the templates assume a single-host IPv4 CIDR (/32), validate that the host is an IPv4 literal and that the port is numeric in the 1-65535 range. if httpServerAddress != "" {
if _, _, err := net.SplitHostPort(httpServerAddress); err != nil {
log.Fatalf("--http-server-address must be in ip:port format, got '%s': %v", httpServerAddress, err)
}
}
</details>
deployment-client.yml has a shell too
strconv.Atoi is not used anymore
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
<details>
<summary>Suppressed comments (4)</summary>
pkg/workloads/cudn-density.go:154
--http-server-address is documented as ip:port, and the templates assume an IPv4 CIDR by appending /32 (NetworkPolicy ipBlock + EgressFirewall). net.SplitHostPort will also accept hostnames (and IPv6 in brackets), which would generate invalid CIDRs in the YAML templates. Validate that the host portion is an IPv4 address (or adjust templates to handle IPv6). if httpServerAddress != "" {
if _, _, err := net.SplitHostPort(httpServerAddress); err != nil {
log.Fatalf("--http-server-address must be in ip:port format, got '%s': %v", httpServerAddress, err)
}
}
cmd/config/cudn-density/egressfirewall.yml:47
This new HTTP-server rule allows egress to the server IP on all ports. The PR description says the policy should allow egress to the HTTP server IP and port, so this should be port-scoped (similar to np-allow-app-egress.yml).
# HTTP server
- type: Allow
to:
cidrSelector: {{.httpServerIP}}/32
{{ end }}
cmd/config/cudn-density/cudn-density.yml:250
egressfirewall.yml is being updated to add an HTTP server allow-rule, but the inputVars only pass httpServerIP. If the allow-rule is port-scoped, it also needs httpServerPort passed in here. nodeGwMap: '{{ if .GATEWAY_CHECK }}{{.NODE_GW_MAP}}{{ end }}'
httpServerIP: "{{.HTTP_SERVER_IP}}"
- objectTemplate: resourcequota.yml
cmd/config/cudn-density/deployment-app.yml:45
The readiness probe curls
/1024.html, but there are no other references to that path in the repo and other nginx checks in this workload use /. If the nginx image doesn’t ship a 1024.html file, this will fail readiness indefinitely when the HTTP server feature is enabled. - "/bin/sh"
- "-c"
- "curl -f -sS http://{{.httpServerAddress}}/1024.html"
</details>
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
<details>
<summary>Suppressed comments (1)</summary>
pkg/workloads/cudn-density.go:154
--http-server-address is documented/used as ip:port (and templates assume IPv4 by appending /32), but current validation only checks net.SplitHostPort, which still accepts non-IP hosts and non-numeric service names (e.g. example.com:http). That will pass validation but later fail in podman -p IP:PORT:... and can generate invalid CIDRs in templates.Consider validating that the host is an IPv4 address and the port is numeric and within 1-65535, and improving the error message to mention IPv6 bracket syntax is not supported (or explicitly support it).
if httpServerAddress != "" {
if _, _, err := net.SplitHostPort(httpServerAddress); err != nil {
log.Fatalf("--http-server-address must be in ip:port format, got '%s': %v", httpServerAddress, err)
}
}
</details>
The flag help text says "ip:port" but the implementation/templates currently assume IPv4-only semantics (e.g., /32 CIDR host rules). Consider making that explicit in the CLI description so users don't try hostnames/IPv6 forms that will be rejected/incorrect.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
<details>
<summary>Suppressed comments (1)</summary>
pkg/workloads/cudn-density.go:154
--http-server-address is only validated with net.SplitHostPort, which still allows hostnames and IPv6. The templated NetworkPolicy/EgressFirewall rules hardcode a /32 mask, and cudn_nginx.sh uses podman -p <hostIP>:<hostPort>:8080, both of which effectively require an IPv4 address. Without enforcing IPv4 here, a value like example.com:8080 or [fd00::1]:8080 will pass validation but then either fail at runtime or generate incorrect CIDRs. if httpServerAddress != "" {
if _, _, err := net.SplitHostPort(httpServerAddress); err != nil {
log.Fatalf("--http-server-address must be in ip:port format, got '%s': %v", httpServerAddress, err)
}
}
</details>
--http-server-address is described/used as an IP for CIDR rules ("{{.HTTP_SERVER_IP}}/32"), but the current validation only checks SplitHostPort, which still allows hostnames, IPv6 ("[::1]:80"), and non-numeric ports. Those values can render invalid NetworkPolicy/EgressFirewall CIDRs and/or break the podman -p ip:port:8080 mapping.
Consider validating that the host is an IPv4 literal and the port is a numeric 1-65535 value before accepting the flag.
This block assumes net.SplitHostPort(httpServerAddress) cannot fail because validation happens earlier, but the error is still ignored (_). Keeping the split + error handling here makes the code more robust if the validation logic changes later, and avoids silently setting empty vars on unexpected input.
The readiness probe executes via /bin/sh -c even though it’s just running curl against a fixed URL. Avoiding the shell reduces injection surface and quoting issues, and makes the probe behavior more predictable (especially if the address ever contains characters that a shell would treat specially).
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
rsevilla87
This pull request adds support for deploying and integrating an external HTTP server (nginx) into the cudn-density workload for readiness and network testing. The main changes introduce a new
--http-server-addressoption, update configuration templates to pass the server's IP and port, and ensure network policies and deployments are aware of the HTTP server when enabled.HTTP Server Integration
Added a new
--http-server-addressCLI flag tocudn-densitythat, when set, deploys an nginx HTTP server at the specified address using the newcudn_nginx.shscript. The address is validated to be inip:portformat. (pkg/workloads/cudn-density.go,cmd/config/scripts/cudn_nginx.sh) [[1]](diffhunk://#diff-1a9c80eb6a49d5cd4440269ef1a45e631ce1f9a6f49e897eeceaaeb99c039576L106-R107) [[2]](diffhunk://#diff-1a9c80eb6a49d5cd4440269ef1a45e631ce1f9a6f49e897eeceaaeb99c039576R150-R154) [[3]](diffhunk://#diff-1a9c80eb6a49d5cd4440269ef1a45e631ce1f9a6f49e897eeceaaeb99c039576R192-R200) [[4]](diffhunk://#diff-1a9c80eb6a49d5cd4440269ef1a45e631ce1f9a6f49e897eeceaaeb99c039576R232) [[5]](diffhunk://#diff-573b301c1b50166b80f8d325203aebcaa20db5b770cfa942b9504bc26b2776c9R1-R32)The workload configuration (
cudn-density.yml) now conditionally includes hooks to set up and clean up the nginx server before and after job execution, and passes the HTTP server IP/port variables to relevant templates. [[1]](diffhunk://#diff-05ea7a77d4e30ed7c4e79f071ecec8516905182a7e5062a0c61feadd994d41d3R123-R129) [[2]](diffhunk://#diff-05ea7a77d4e30ed7c4e79f071ecec8516905182a7e5062a0c61feadd994d41d3R239-R242) [[3]](diffhunk://#diff-05ea7a77d4e30ed7c4e79f071ecec8516905182a7e5062a0c61feadd994d41d3R251-R253) [[4]](diffhunk://#diff-05ea7a77d4e30ed7c4e79f071ecec8516905182a7e5062a0c61feadd994d41d3R290)Network Policy and Deployment Updates
Network policy templates (
np-allow-app-egress.yml,egressfirewall.yml) now allow egress to the HTTP server IP and port when the feature is enabled. [[1]](diffhunk://#diff-618f77009d97048c1965202633b7c4f3054008ab17309b515587ae2ab0e01eaaR44-R51) [[2]](diffhunk://#diff-b0ae82fc8f9bf85f87d919f2529ccce29cc2ffa2878eab115200523acdedbe64R41-R46)The sample application deployment (
deployment-app.yml) switches to acurl-based image and, if the HTTP server is set, adds a readiness probe that checks connectivity to the server.Minor/Supporting Changes
Added Go
netimport to support address parsing.Minor whitespace/formatting changes in configuration templates.
These changes make it possible to use an external HTTP server for readiness probes and network policy validation within the cudn-density workload.