forked from shipwright-io/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate adoc copies in /content/en/docs to shipwright-io#78
- Loading branch information
Showing
3 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,3 @@ PLATFORMS | |
|
||
DEPENDENCIES | ||
asciidoctor (~> 2.0, >= 2.0.17) | ||
|
||
BUNDLED WITH | ||
2.3.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
= Build Controller Profiling | ||
:linkTitle: Profiling | ||
|
||
The build controller supports a `pprof` profiling mode, which is omitted from the binary by default. To use the profiling, use the controller image that was built with `pprof` enabled. | ||
|
||
== Enable `pprof` in the build controller | ||
|
||
In the Kubernetes cluster, edit the `shipwright-build-controller` deployment to use the container tag with the `debug` suffix. | ||
|
||
[,sh] | ||
---- | ||
kubectl --namespace <namespace> set image \ | ||
deployment/shipwright-build-controller \ | ||
shipwright-build-controller="$(kubectl --namespace <namespace> get deployment shipwright-build-controller --output jsonpath='{.spec.template.spec.containers[].image}')-debug" | ||
---- | ||
|
||
== Connect `go pprof` to build controller | ||
|
||
Depending on the respective setup, there could be multiple build controller pods for high availability reasons. In this case, you have to look-up the current leader first. The following command can be used to verify the currently active leader: | ||
|
||
[,sh] | ||
---- | ||
kubectl --namespace <namespace> get configmap shipwright-build-controller-lock --output json \ | ||
| jq --raw-output '.metadata.annotations["control-plane.alpha.kubernetes.io/leader"]' \ | ||
| jq --raw-output .holderIdentity | ||
---- | ||
|
||
The `pprof` endpoint is not exposed in the cluster and can only be used from inside the container. Therefore, set-up port-forwarding to make the `pprof` port available locally. | ||
|
||
[,sh] | ||
---- | ||
kubectl --namespace <namespace> port-forward <controller-pod-name> 8383:8383 | ||
---- | ||
|
||
Now, you can setup a local webserver to browse through the profiling data. | ||
|
||
[,sh] | ||
---- | ||
go tool pprof -http localhost:8080 http://localhost:8383/debug/pprof/heap | ||
---- | ||
|
||
_Please note:_ For it to work, you have to have `graphviz` installed on your system, for example using `brew install graphviz`, `apt-get install graphviz`, `yum install graphviz`, or similar. |