Horizontal pod autoscaler with sidecar container

Hi all, i’m trying to figure how HPA work on a pod with a sidecar container.

Background info.

i have a pod that serve images with simple logic that search the image to serve looking in a database. To unload the database and speedup things i added a sidecar container with with nginx acting as a caching proxy. Each container has is own resource request definition.
Things work well but i can’t figure out how the HPA evaulate metrics to decide when scale up.

Now the HPA scale up on 80% cpu request usage, but looking at the metrics i don’t understand if it evaluate only one of the two containers and in what order, or if it evaluete the grouped cpu requests consumption.

Cluster information:

Kubernetes version: v1.12.8-gke.10
Cloud being used: GKE
Installation method:
Host OS:
CNI and version:
CRI and version:

You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.

To my knowledge it uses the averaged CPU across all containers within a pod – So the threshold of 80% would need to be 80% of the entire pod usage.

EDIT: They are averaged together. Here is the relevant code comment