Skip to content

Commit

Permalink
Generate adoc copies in /content/en/docs to shipwright-io#78
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfedh committed May 24, 2022
1 parent 0e27a3b commit a14f59b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion content/en/docs/authentication.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Authentication during builds
title: Authentication during builds test
---

The following document provides an introduction around the different authentication methods that can take place during an image build when using the Build controller.
Expand Down
42 changes: 42 additions & 0 deletions content/en/docs/profiling-test.adoc
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.

0 comments on commit a14f59b

Please sign in to comment.