Skip to content

Commit

Permalink
special handling for --v flag
Browse files Browse the repository at this point in the history
Signed-off-by: Omer Aplatony <[email protected]>
  • Loading branch information
omerap12 committed Feb 11, 2025
1 parent e359469 commit 66cf05c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
12 changes: 6 additions & 6 deletions vertical-pod-autoscaler/docs/flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ This document contains the flags for all VPA components.

# What are the parameters to VPA admission-controller?
This document is auto-generated from the flag definitions in the VPA admission-controller code.
Last updated: 2025-02-09 10:07:39 UTC
Last updated: 2025-02-11 13:55:46 UTC

| Flag | Default | Description |
|------|---------|-------------|
Expand Down Expand Up @@ -33,7 +33,7 @@ Last updated: 2025-02-09 10:07:39 UTC
| `--tls-cert-file` | "/etc/tls-certs/serverCert.pem" | Path to server certificate PEM file. |
| `--tls-ciphers` | | A comma-separated or colon-separated list of ciphers to accept. Only works when min-tls-version is set to tls1_2. |
| `--tls-private-key` | "/etc/tls-certs/serverKey.pem" | Path to server certificate key PEM file. |
| `--v,` | 4 | Level set the log level verbosity |
| `--v` | 4 | Set the log level verbosity |
| `--vmodule` | | comma-separated list of pattern=N settings for file-filtered logging |
| `--vpa-object-namespace` | | Namespace to search for VPA objects. Empty means all namespaces will be used. |
| `--webhook-address` | | Address under which webhook is registered. Used when registerByURL is set to true. |
Expand All @@ -45,7 +45,7 @@ Last updated: 2025-02-09 10:07:39 UTC

# What are the parameters to VPA recommender?
This document is auto-generated from the flag definitions in the VPA recommender code.
Last updated: 2025-02-09 10:07:39 UTC
Last updated: 2025-02-11 13:55:47 UTC

| Flag | Default | Description |
|------|---------|-------------|
Expand Down Expand Up @@ -115,13 +115,13 @@ Last updated: 2025-02-09 10:07:39 UTC
| `--target-memory-percentile` | 0.9 | Memory usage percentile that will be used as a base for memory target recommendation. Doesn't affect memory lower bound nor memory upper bound. |
| `--use-external-metrics` | | ALPHA. Use an external metrics provider instead of metrics_server. |
| `--username` | | The username used in the prometheus server basic auth |
| `--v,` | 4 | Level set the log level verbosity |
| `--v` | 4 | Set the log level verbosity |
| `--vmodule` | | comma-separated list of pattern=N settings for file-filtered logging |
| `--vpa-object-namespace` | | Namespace to search for VPA objects. Empty means all namespaces will be used. |

# What are the parameters to VPA updater?
This document is auto-generated from the flag definitions in the VPA updater code.
Last updated: 2025-02-09 10:07:40 UTC
Last updated: 2025-02-11 13:55:47 UTC

| Flag | Default | Description |
|------|---------|-------------|
Expand Down Expand Up @@ -158,7 +158,7 @@ Last updated: 2025-02-09 10:07:40 UTC
| `--stderrthreshold` | | set the log level threshold for writing to standard error |
| `--updater-interval` | 1m0s | How often updater should run |
| `--use-admission-controller-status` | true | If true, updater will only evict pods when admission controller status is valid. |
| `--v,` | 4 | Level set the log level verbosity |
| `--v` | 4 | Set the log level verbosity |
| `--vmodule` | | comma-separated list of pattern=N settings for file-filtered logging |
| `--vpa-object-namespace` | | Namespace to search for VPA objects. Empty means all namespaces will be used. |

18 changes: 12 additions & 6 deletions vertical-pod-autoscaler/hack/generate-flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,22 @@ extract_flags() {
echo "|------|---------|-------------|"

$binary --help 2>&1 | grep -E '^\s*-' | while read -r line; do
flag=$(echo "$line" | awk '{print $1}' | sed 's/^-*//;s/=.*$//')
default=$(echo "$line" | sed -n 's/.*default \([^)]*\).*/\1/p')
description=$(echo "$line" | sed -E 's/^\s*-[^[:space:]]+ [^[:space:]]+ //;s/ \(default.*\)//')
description=$(echo "$description" | sed -E "s/^--?${flag}[[:space:]]?//")
if [[ $line == *"-v, --v Level"* ]]; then
# Special handling for the -v, --v Level flag
flag="v"
default=$(echo "$line" | sed -n 's/.*default: \([0-9]\+\).*/\1/p')
description="Set the log level verbosity"
else
flag=$(echo "$line" | awk '{print $1}' | sed 's/^-*//;s/=.*$//')
default=$(echo "$line" | sed -n 's/.*default \([^)]*\).*/\1/p')
description=$(echo "$line" | sed -E 's/^\s*-[^[:space:]]+ [^[:space:]]+ //;s/ \(default.*\)//')
description=$(echo "$description" | sed -E "s/^--?${flag}[[:space:]]?//")
fi

echo "| \`--${flag}\` | ${default} | ${description} |"
echo "| \`--${flag}\` | ${default:-} | ${description} |"
done
echo
}

# Build components
pushd "${SCRIPT_ROOT}" >/dev/null
for component in "${COMPONENTS[@]}"; do
Expand Down

0 comments on commit 66cf05c

Please sign in to comment.