diff --git a/README.md b/README.md index e2b4467a..827dcdfe 100644 --- a/README.md +++ b/README.md @@ -112,3 +112,7 @@ Queries all the VPA objects that are labelled for this tool and summarizes their ### Container Exclusions The `dashboard` and `summary` commands can exclude recommendations for a list of comma separate container names using the `--excludes-containers` argument. This option can be useful for hiding recommendations for sidecar containers for things like Linkerd and Istio. + +Containers can be excluded for individual deployments by applying an annotation to any deployment. The annotation value should be a list of comma separated container names. The annotation value will be combined with any values provided through the `--excludes-containers` argument. + +`goldilocks.fairwinds.com/exclude-container: linkerd-proxy` diff --git a/pkg/summary/summary.go b/pkg/summary/summary.go index 5a8efead..95706724 100644 --- a/pkg/summary/summary.go +++ b/pkg/summary/summary.go @@ -100,6 +100,10 @@ func constructSummary(vpas *v1beta2.VerticalPodAutoscalerList, excludeContainers break } + if annotationValue, annotationFound := deployment.Annotations["goldilocks.fairwinds.com/exclude-container"]; annotationFound { + containerExclusions = append(containerExclusions, strings.Split(annotationValue, ",")...) + } + CONTAINER_REC_LOOP: for _, containerRecommendation := range vpa.Status.Recommendation.ContainerRecommendations { for _, exclusion := range containerExclusions {