forked from different-ai/openwork
-
Notifications
You must be signed in to change notification settings - Fork 0
DEVOPS-3406 - helm: namespace resouces #1
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 all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2d94648
DEVOPS-3406 - helm: namespace resouces
raul-gherman-modaoperandi d6298dd
DEVOPS-3406 - Update README with namespace usage instructions
raul-gherman-modaoperandi da2c9eb
DEVOPS-3406 - helm: quote namespace helper
Copilot 19d085c
DEVOPS- ensure namespace values are quoted in templates and tests
raul-gherman-modaoperandi 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
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,57 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| chart_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| tmp_dir="$(mktemp -d)" | ||
| trap 'rm -rf "$tmp_dir"' EXIT | ||
|
|
||
| assert_count() { | ||
| local file="$1" | ||
| local needle="$2" | ||
| local expected="$3" | ||
| local count | ||
| count="$(grep -F -c -- "$needle" "$file" || true)" | ||
| if [[ "$count" != "$expected" ]]; then | ||
| printf 'Expected %s occurrences of %s, found %s\n' "$expected" "$needle" "$count" >&2 | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| # Default render: every namespaced resource lands in "openwork". | ||
| # 8 resources: Secret, ConfigMap, den-api/den-web Services+Deployments, | ||
| # migration Job, env-probe test Job. | ||
| default_rendered="$tmp_dir/default.yaml" | ||
| helm template openwork-ee "$chart_dir" > "$default_rendered" | ||
| assert_count "$default_rendered" ' namespace: "openwork"' 8 | ||
| assert_count "$default_rendered" ' namespace: "kube-system"' 0 | ||
|
|
||
| # Full render (ingress + inference enabled): 11 namespaced resources. | ||
| full_rendered="$tmp_dir/full.yaml" | ||
| helm template openwork-ee "$chart_dir" \ | ||
| --set ingress.enabled=true --set inference.enabled=true > "$full_rendered" | ||
| assert_count "$full_rendered" ' namespace: "openwork"' 11 | ||
|
|
||
| # Explicit override wins on every resource. | ||
| override_rendered="$tmp_dir/override.yaml" | ||
| helm template openwork-ee "$chart_dir" --set namespace=platform > "$override_rendered" | ||
| assert_count "$override_rendered" ' namespace: "platform"' 8 | ||
| assert_count "$override_rendered" ' namespace: "openwork"' 0 | ||
|
|
||
| # Cleared value falls back to the release namespace. | ||
| fallback_rendered="$tmp_dir/fallback.yaml" | ||
| helm template openwork-ee "$chart_dir" --namespace rel-ns --set namespace= > "$fallback_rendered" | ||
| assert_count "$fallback_rendered" ' namespace: "rel-ns"' 8 | ||
|
|
||
| # Numeric and YAML-keyword overrides stay quoted strings: --set types these as | ||
| # number/bool, and metadata.namespace must render as a quoted string. | ||
| numeric_rendered="$tmp_dir/numeric.yaml" | ||
| helm template openwork-ee "$chart_dir" --set namespace=123 > "$numeric_rendered" | ||
| assert_count "$numeric_rendered" ' namespace: "123"' 8 | ||
| assert_count "$numeric_rendered" ' namespace: 123' 0 | ||
|
|
||
| keyword_rendered="$tmp_dir/keyword.yaml" | ||
| helm template openwork-ee "$chart_dir" --set namespace=yes > "$keyword_rendered" | ||
| assert_count "$keyword_rendered" ' namespace: "yes"' 8 | ||
| assert_count "$keyword_rendered" ' namespace: yes' 0 | ||
|
|
||
| printf 'namespace chart checks passed\n' |
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
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.