-
Notifications
You must be signed in to change notification settings - Fork 49
feat(self-managed): add profile-based observability #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
67b8f0b
feat(self-managed): add profile-based observability
kristinapathak b42d113
docs(skill): remove obsolete import routing
kristinapathak 9381159
fix(self-managed): keep autoscaler image pin stack-owned
kristinapathak 6666163
fix(observability): enable selected plane monitors by default
kristinapathak 270297e
fix(observability): preserve explicit monitor overrides
kristinapathak fd46c36
refactor(observability): nest compute monitor values
kristinapathak 1b52225
refactor(observability): share service monitor template
kristinapathak 06842ea
refactor(observability): consolidate monitor and autoscaler config
kristinapathak 669d2af
fix(observability): address review feedback
kristinapathak 427d588
fix(observability): wire compute profile to nvca
kristinapathak a38018d
docs(observability): clarify backend validation
kristinapathak 744b8e0
test(observability): cover collector image overrides
kristinapathak d728e63
fix(observability): allow target allocator secret discovery
kristinapathak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| expected_dir="${1:?expected golden directory is required}" | ||
| actual_dir="${2:?actual manifest directory is required}" | ||
| work_dir="$(mktemp -d)" | ||
| trap 'rm -rf "$work_dir"' EXIT | ||
|
|
||
| index_tree() { | ||
| local root_dir="$1" | ||
| local output_file="$2" | ||
|
|
||
| find "$root_dir" -type f -print | | ||
| while IFS= read -r file; do | ||
| relative_path="${file#"$root_dir"/}" | ||
| normalized_path="$( | ||
| printf '%s\n' "$relative_path" | | ||
| sed -E 's#^([^/]+)-[0-9a-f]{8}-#\1-HASH-#' | ||
| )" | ||
| printf '%s %s\n' "$(git hash-object "$file")" "$normalized_path" | ||
| done | | ||
| sort >"$output_file" | ||
| } | ||
|
|
||
| index_tree "$expected_dir" "$work_dir/expected" | ||
| index_tree "$actual_dir" "$work_dir/actual" | ||
| diff -u "$work_dir/expected" "$work_dir/actual" |
105 changes: 105 additions & 0 deletions
105
deploy/stacks/nvcf-compute-plane/tests/observability-profile.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| stack_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| work_dir="$(mktemp -d)" | ||
| cluster_name="observability-profile-test-$$" | ||
| registration_values="$stack_dir/out/$cluster_name-register-values.yaml" | ||
| trap 'rm -rf "$work_dir"; rm -f "$registration_values"' EXIT | ||
|
|
||
| fail() { | ||
| echo "observability-profile: $*" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| mkdir -p "$stack_dir/out" | ||
| cp "$stack_dir/testdata/registration/ncp-local-register-values.yaml" \ | ||
| "$registration_values" | ||
|
|
||
| render_values() { | ||
| local profile="$1" | ||
| local output_file="$2" | ||
| local profile_args=() | ||
| shift 2 | ||
|
|
||
| if [[ "$profile" != "default" ]]; then | ||
| profile_args=(--state-values-set "observability.profile=$profile") | ||
| fi | ||
|
|
||
| HELMFILE_ENV=base \ | ||
| CLUSTER_NAME="$cluster_name" \ | ||
| NCA_ID=nvcf-default \ | ||
| helmfile \ | ||
| --file "$stack_dir/helmfile.d/02-nvca.yaml.gotmpl" \ | ||
| --environment default \ | ||
| "${profile_args[@]}" \ | ||
| "$@" \ | ||
| --selector name=nvca-operator \ | ||
| write-values \ | ||
| --output-file-template "$output_file" >/dev/null | ||
| } | ||
|
|
||
| collector_enabled() { | ||
| awk ' | ||
| /^selfManaged:$/ { self_managed = 1; next } | ||
| self_managed && /^ otelCollector:$/ { collector = 1; next } | ||
| collector && /^ enabled:/ { print $2; exit } | ||
| ' "$1" | ||
| } | ||
|
|
||
| has_byoo_gate() { | ||
| grep -q '^[[:space:]]*- BYOObservability$' "$1" | ||
| } | ||
|
|
||
| for profile in default disabled control compute all; do | ||
| values="$work_dir/$profile.yaml" | ||
| render_values "$profile" "$values" | ||
|
|
||
| case "$profile" in | ||
| default|compute|all) | ||
| test "$(collector_enabled "$values")" = "true" || | ||
| fail "$profile profile did not enable the NVCA collector" | ||
| has_byoo_gate "$values" || | ||
| fail "$profile profile did not enable BYOObservability" | ||
| ;; | ||
| disabled|control) | ||
| test "$(collector_enabled "$values")" = "false" || | ||
| fail "$profile profile enabled the NVCA collector" | ||
| if has_byoo_gate "$values"; then | ||
| fail "$profile profile enabled BYOObservability" | ||
| fi | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| render_values compute "$work_dir/compute-overrides.yaml" \ | ||
| --state-values-set global.nvcaOperator.selfManaged.otelCollector.enabled=false \ | ||
| --state-values-set-string 'global.nvcaOperator.selfManaged.featureGateValues[0]=-BYOObservability' | ||
|
|
||
| test "$(collector_enabled "$work_dir/compute-overrides.yaml")" = "false" || | ||
| fail "explicit collector disable did not override the compute profile" | ||
| if has_byoo_gate "$work_dir/compute-overrides.yaml"; then | ||
| fail "explicit BYOObservability disable did not override the compute profile" | ||
| fi | ||
| grep -q '^[[:space:]]*- -BYOObservability$' \ | ||
| "$work_dir/compute-overrides.yaml" || | ||
| fail "explicit BYOObservability disable was not preserved" | ||
|
|
||
| render_values control "$work_dir/control-overrides.yaml" \ | ||
| --state-values-set global.nvcaOperator.selfManaged.otelCollector.enabled=true \ | ||
| --state-values-set-string 'global.nvcaOperator.selfManaged.featureGateValues[0]=BYOObservability' | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| test "$(collector_enabled "$work_dir/control-overrides.yaml")" = "true" || | ||
| fail "explicit collector enable did not override the control profile" | ||
| has_byoo_gate "$work_dir/control-overrides.yaml" || | ||
| fail "explicit BYOObservability enable did not override the control profile" | ||
|
|
||
| if render_values invalid "$work_dir/invalid.yaml" \ | ||
| >"$work_dir/invalid.log" 2>&1; then | ||
| fail "invalid observability profile was accepted" | ||
| fi | ||
| grep -q 'observability.profile must be disabled, control, compute, or all' \ | ||
| "$work_dir/invalid.log" || | ||
| fail "invalid profile did not return the expected error" | ||
|
|
||
| echo "observability-profile: all checks passed" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.