antrea
antrea copied to clipboard
Support running `./hack/make-metrics-doc.sh` from macOS
Currently the only way to update the Prometheus metrics with the ./hack/make-metrics-doc.sh docs/prometheus-integration.md
command, is to run it on a Linux machine.
Why, you ask. Well because of 2 main issues:
- the script assumes that the Antrea Agent and Controller can be reached using the control-plane Node IP. For example it assumes that metrics for the Agent can be retrieved from
https://<NODE IP>:10350/metrics
, where 10350 is the Agent API port. This is not the case when running the script on macOS, as the Nodes of the Kind cluster (running as docker containers) cannot be accessed directly from the host unlike on Linux (this is just the way Docker Desktop works). - the sed commands do not work on macOS, as macOS uses a different version of sed (FreeBSD) from Linux distributions.
There are 2 possible solutions:
- Keep the script mostly as it is but make sure it can run on macOS. It will require the following changes:
- configure extra port mappings for the Kind control-plane Node, so that the macOS host can access the Antrea API. The Kind config could look like this:
...
- role: control-plane
extraPortMappings:
- containerPort: 10349
hostPort: 10349
- containerPort: 10350
hostPort: 10350
...
- Fix the sed commands so that they run on macOS
- The second solution would be to change the current script so that it starts a K8s Job, so that a Pod would be in charge of generating the metrics document and outputting it to stdout. The script would then simply need to retrieve it. The nice part about this solution is that we won't need to worry about breaking support for either OS (Linux or macOS) in the future, since most of the functionality executes inside a Pod. It is probably a bit more work initially though since it requires building a new container image.
There is actually one more solution, which is to stop relying on API access to generate the metrics documentation and instead rely on a tool like this one (but we can write our own), which looks at the source code for documented metrics. Something worth investigating.
@antoninbas can i work on it
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment, or this will be closed in 90 days