Skip to content

Commit

Permalink
fix: add single quotes to pod annotations for multiple namespace scen…
Browse files Browse the repository at this point in the history
…ario (#927)

…

Full issue description can be found
[here](https://teams.microsoft.com/l/message/19:[email protected]/1719406797645?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=2fb9049b-bc9c-4cca-a900-84f22c86116c&parentMessageId=1719406797645&teamName=AzMon%20POD%20Swarming&channelName=Azure%20Managed%20Grafana%20-%20Prometheus&createdTime=1719406797645)

Essentially if you have the following in the configmap
podannotationnamespaceregex = "gegc|gegd"

Then the pipe is being read as a command separator by the shell script
[here](https://github.com/Azure/prometheus-collector/blob/main/otelcollector/scripts/configmap-parser.sh#L37)
and its unable to set the values throwing an error ->

/root/.bashrc: line 9: gegd: command not found

We can fix this by making the value a string and adding quotes around it
as done in this PR.

[comment]: # (Note that your PR title should follow the conventional
commit format: https://conventionalcommits.org/en/v1.0.0/#summary)
# PR Description

[comment]: # (The below checklist is for PRs adding new features. If a
box is not checked, add a reason why it's not needed.)
# New Feature Checklist

- [ ] List telemetry added about the feature.
- [ ] Link to the one-pager about the feature.
- [ ] List any tasks necessary for release (3P docs, AKS RP chart
changes, etc.) after merging the PR.
- [ ] Attach results of scale and perf testing.

[comment]: # (The below checklist is for code changes. Not all boxes
necessarily need to be checked. Build, doc, and template changes do not
need to fill out the checklist.)
# Tests Checklist

- [ ] Have end-to-end Ginkgo tests been run on your cluster and passed?
To bootstrap your cluster to run the tests, follow [these
instructions](/otelcollector/test/README.md#bootstrap-a-dev-cluster-to-run-ginkgo-tests).
  - Labels used when running the tests on your cluster:
    - [ ] `operator`
    - [ ] `windows`
    - [ ] `arm64`
    - [ ] `arc-extension`
    - [ ] `fips`
- [ ] Have new tests been added? For features, have tests been added for
this feature? For fixes, is there a test that could have caught this
issue and could validate that the fix works?
  - [ ] Is a new scrape job needed?
- [ ] The scrape job was added to the folder
[test-cluster-yamls](/otelcollector/test/test-cluster-yamls/) in the
correct configmap or as a CR.
  - [ ] Was a new test label added?
- [ ] A string constant for the label was added to
[constants.go](/otelcollector/test/utils/constants.go).
- [ ] The label and description was added to the [test
README](/otelcollector/test/README.md).
- [ ] The label was added to this [PR
checklist](/.github/pull_request_template).
- [ ] The label was added as needed to
[testkube-test-crs.yaml](/otelcollector/test/testkube/testkube-test-crs.yaml).
  - [ ] Are additional API server permissions needed for the new tests?
- [ ] These permissions have been added to
[api-server-permissions.yaml](/otelcollector/test/testkube/api-server-permissions.yaml).
  - [ ] Was a new test suite (a new folder under `/tests`) added?
- [ ] The new test suite is included in
[testkube-test-crs.yaml](/otelcollector/test/testkube/testkube-test-crs.yaml).
  • Loading branch information
bragi92 authored Jul 3, 2024
1 parent 6fcc36c commit eabe067
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CVE-2024-24786
CVE-2024-24557
CVE-2024-27281
CVE-2020-8559
CVE-2024-6104
# MEDIUM - go vulnerabilities
CVE-2023-3978
CVE-2023-44487
Expand Down
1 change: 1 addition & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Pending
* fix: Truncate DCE/DCR to 44/64 chars in ARM, Bicep, Terraform... - https://github.com/Azure/prometheus-collector/pull/922
* fix: add single quotes to pod annotations for multiple namespace scenario - https://github.com/Azure/prometheus-collector/pull/927

## Release 06-12-2024
* Target Allocator Chart update to add Tls secret to the config reader sidecar container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def populateSettingValuesFromConfigMap(parsedConfig)
if !file.nil?
# Close file after writing scrape interval list hash
# Writing it as yaml as it is easy to read and write hash
file.write("export AZMON_PROMETHEUS_POD_ANNOTATION_NAMESPACES_REGEX=#{@podannotationNamespaceRegex}\n")
file.write("export AZMON_PROMETHEUS_POD_ANNOTATION_NAMESPACES_REGEX='#{@podannotationNamespaceRegex}'\n")
file.close
else
ConfigParseErrorLogger.logError(LOGGING_PREFIX, "Exception while opening file for writing regex config hash")
Expand Down

0 comments on commit eabe067

Please sign in to comment.