Skip to content

Commit 75a22a3

Browse files
authored
Merge pull request kubernetes#3586 from icyfork/vpa_hack_scrips_with_noop_and_diff_action
vpa/hack/vpa-process-yamls.sh add print action
2 parents 0b52dba + 99c99a1 commit 75a22a3

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

vertical-pod-autoscaler/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ in the `kube-system` namespace. It also generates
112112
and uploads a secret (a CA cert) used by VPA Admission Controller when communicating
113113
with the API server.
114114

115+
To print YAML contents with all resources that would be understood by
116+
`kubectl diff|apply|...` commands, you can use
117+
118+
```
119+
./hack/vpa-process-yamls.sh print
120+
```
121+
122+
The output of that command won't include secret information generated by
123+
[pkg/admission-controller/gencerts.sh](pkg/admission-controller/gencerts.sh) script.
124+
115125
### Quick start
116126

117127
After [installation](#installation) the system is ready to recommend and set
@@ -275,15 +285,15 @@ VPA will set RAM request to 2 GB (following the resource policy) and RAM limit t
275285
be restarted. The pod may be recreated on a different node.
276286
* VPA does not evict pods which are not run under a controller. For such pods
277287
`Auto` mode is currently equivalent to `Initial`.
278-
* Vertical Pod Autoscaler **should not be used with the [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) (HPA) on CPU or memory** at this moment.
288+
* Vertical Pod Autoscaler **should not be used with the [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) (HPA) on CPU or memory** at this moment.
279289
However, you can use VPA with [HPA on custom and external metrics](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-custom-metrics).
280290
* The VPA admission controller is an admission webhook. If you add other admission webhooks
281291
to you cluster, it is important to analyze how they interact and whether they may conflict
282292
with each other. The order of admission controllers is defined by a flag on APIserver.
283293
* VPA reacts to most out-of-memory events, but not in all situations.
284294
* VPA performance has not been tested in large clusters.
285295
* VPA recommendation might exceed available resources (e.g. Node size, available
286-
size, available quota) and cause **pods to go pending**. This can be partly
296+
size, available quota) and cause **pods to go pending**. This can be partly
287297
addressed by using VPA together with [Cluster Autoscaler](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#basics).
288298
* Multiple VPA resources matching the same pod have undefined behavior.
289299

vertical-pod-autoscaler/hack/vpa-process-yamls.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
2222

2323
function print_help {
2424
echo "ERROR! Usage: vpa-process-yamls.sh <action> [<component>]"
25-
echo "<action> should be either 'create' or 'delete'."
25+
echo "<action> should be either 'create', 'diff', 'print' or 'delete'."
26+
echo "The 'print' action will print all resources that would be used by, e.g., 'kubectl diff'."
2627
echo "<component> might be one of 'admission-controller', 'updater', 'recommender'."
2728
echo "If <component> is set, only the deployment of that component will be processed,"
2829
echo "otherwise all components and configs will be processed."
@@ -40,9 +41,9 @@ fi
4041

4142
ACTION=$1
4243
COMPONENTS="vpa-v1-crd vpa-rbac updater-deployment recommender-deployment admission-controller-deployment"
43-
if [ ${ACTION} == delete ]; then
44-
COMPONENTS+=" vpa-beta2-crd"
45-
fi
44+
case ${ACTION} in
45+
delete|diff|print) COMPONENTS+=" vpa-beta2-crd" ;;
46+
esac
4647

4748
if [ $# -gt 1 ]; then
4849
COMPONENTS="$2-deployment"
@@ -57,6 +58,9 @@ for i in $COMPONENTS; do
5758
(bash ${SCRIPT_ROOT}/pkg/admission-controller/delete-webhook.sh || true)
5859
fi
5960
fi
60-
${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/deploy/$i.yaml | kubectl ${ACTION} -f - || true
61+
if [[ ${ACTION} == print ]]; then
62+
${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/deploy/$i.yaml
63+
else
64+
${SCRIPT_ROOT}/hack/vpa-process-yaml.sh ${SCRIPT_ROOT}/deploy/$i.yaml | kubectl ${ACTION} -f - || true
65+
fi
6166
done
62-

0 commit comments

Comments
 (0)