-
Notifications
You must be signed in to change notification settings - Fork 0
ROX-31149: Improve monitoring deployment customization #83
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
Open
JoukoVirtanen
wants to merge
6
commits into
main
Choose a base branch
from
jv-ROX-31149-improve-monitoring-deployment-customization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c3e4bfe
X-Smart-Branch-Parent: main
JoukoVirtanen 6390169
Setting prometheus parameters in helm args
JoukoVirtanen 542b91b
Old acs versions use the old script new acs versions use a new script
JoukoVirtanen 1031b1d
Combined scripts. Changed metricRelabelConfigs to cadvisorMetricRelab…
JoukoVirtanen b2f19d5
Setting memory limit and request via helm args regardless of acs version
JoukoVirtanen d65555b
Using kubectl apply -f instead of deleting and recreating config map
JoukoVirtanen 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,22 @@ set -eou pipefail | |
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
|
|
||
| # Extract version from MAIN_IMAGE_TAG (e.g., "4.11.0-rc.2" -> "4.11") | ||
| version_major_minor=$(echo "${MAIN_IMAGE_TAG}" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/') | ||
|
|
||
| # Parse major and minor version numbers | ||
| version_major=$(echo "${version_major_minor}" | cut -d. -f1) | ||
| version_minor=$(echo "${version_major_minor}" | cut -d. -f2) | ||
|
|
||
| # Determine if version is 4.11 or later (compare as integers, not floats) | ||
| is_4_11_plus=false | ||
| if [[ "$version_major" -gt 4 ]] || [[ "$version_major" -eq 4 && "$version_minor" -ge 11 ]]; then | ||
| echo "Using ACS 4.11+ secured cluster setup (version: ${version_major_minor})" | ||
| is_4_11_plus=true | ||
| else | ||
| echo "Using ACS pre-4.11 secured cluster setup (version: ${version_major_minor})" | ||
| fi | ||
|
|
||
| "${STACKROX_DIR}/deploy/k8s/sensor.sh" | ||
| kubectl -n stackrox create secret generic access-rhacs \ | ||
| --from-literal="username=${ROX_ADMIN_USERNAME}" \ | ||
|
|
@@ -14,19 +30,28 @@ kubectl create -f "${SCRIPT_DIR}/collector-config.yaml" | |
|
|
||
| echo "Deploying Monitoring..." | ||
| monitoring_values_file="${COMMON_DIR}/../charts/monitoring/values.yaml" | ||
| yq -i '.resources.requests.memory = "8Gi"' "$monitoring_values_file" | ||
| yq -i '.resources.limits.memory = "8Gi"' "$monitoring_values_file" | ||
|
|
||
| # Build base helm arguments | ||
| helm_args=( | ||
| --set persistence.type="${STORAGE}" | ||
| --set exposure.type="${MONITORING_LOAD_BALANCER}" | ||
| --set resources.requests.memory="8Gi" | ||
| --set resources.limits.memory="8Gi" | ||
| ) | ||
|
|
||
| if [[ "$is_4_11_plus" == true ]]; then | ||
| # 4.11+: Add memory settings and metric relabel configs to helm args | ||
| helm_args+=( | ||
| --set-json 'cadvisorMetricRelabelConfigs=[{"source_labels":["container"],"regex":"berserker","action":"drop"},{"source_labels":["namespace"],"regex":"berserker-.*","action":"drop"}]' | ||
| ) | ||
| fi | ||
|
|
||
| helm dependency update "${COMMON_DIR}/../charts/monitoring" | ||
| envsubst < "$monitoring_values_file" > "${COMMON_DIR}/../charts/monitoring/values_substituted.yaml" | ||
| helm upgrade -n stackrox --install --create-namespace stackrox-monitoring "${COMMON_DIR}/../charts/monitoring" --values "${COMMON_DIR}/../charts/monitoring/values_substituted.yaml" "${helm_args[@]}" | ||
| rm "${COMMON_DIR}/../charts/monitoring/values_substituted.yaml" | ||
|
|
||
| # Replace the prometheus ConfigMap with one that doesn't scrape as much info from berserker containers | ||
| kubectl -n stackrox delete configmap prometheus | ||
| kubectl create -f "${SCRIPT_DIR}"/prometheus.yaml | ||
| # Pre-4.11 only: Replace prometheus ConfigMap | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| if [[ "$is_4_11_plus" == false ]]; then | ||
| kubectl apply -f "${SCRIPT_DIR}"/prometheus.yaml | ||
| fi | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a Jira under https://issues.redhat.com/browse/ROX-33013 for the cleanup, when 4.11 is the last lowest supported ACS version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the ticket https://issues.redhat.com/browse/ROX-33578