Open ChristianRaoulis opened 5 months ago
Hi @ChristianRaoulis it appears that this is related to an upstream bug regarding line splitting. Please see https://github.com/helm/helm/issues/7704 for additional information.
Note that I am also able to reproduce this issue using Helm CLI (v3.15.2 - latest) and the following values.yaml file:
# helm install bitnami/rabbitmq --values ./values.yml --generate-name
metrics:
enabled: true
prometheusRule:
enabled: true
rules:
- alert: RabbitmqInstancesDifferentVersions
expr: count(count(rabbitmq_build_info) by (rabbitmq_version)) > 1
for: 60m
labels:
severity: warning
annotations:
summary: RabbitMQ instances running different versions (instance {{ "{{ $labels.instance }}" }})
description: |-
Running different version of RabbitMQ in the same cluster, can lead to failure.
VALUE = {{ "{{ $value }}" }}
LABELS = {{ "{{ $labels }}" }}
As a workaround for now, you could employ the suggestion in https://github.com/helm/helm/issues/7704#issuecomment-747561507 by declaring your custom values in a yaml file and referencing it using the valueYamlFiles
field.
# index.ts
const chart = new k8s.helm.v3.Release(
"rabbitmq",
{
chart: "rabbitmq",
version: "14.1.2",
repositoryOpts: {
repo: "https://charts.bitnami.com/bitnami",
},
valueYamlFiles: [new pulumi.asset.FileAsset("./values.yml")],
},
{ provider }
);
#values.yml
metrics:
enabled: true
prometheusRule:
enabled: true
rules:
- alert: RabbitmqInstancesDifferentVersions
expr: |
count(count(rabbitmq_build_info) by (rabbitmq_version)) > 1
for: 60m
labels:
severity: warning
annotations:
summary: |
RabbitMQ instances running different versions (instance {{ "{{ $labels.instance }}" }})
description: |
Running different version of RabbitMQ in the same cluster, can lead to failure.
VALUE = {{ "{{ $value }}" }}
LABELS = {{ "{{ $labels }}" }}
Alternatively, you could force a string literal by adding a \n
to the end of strings >80 characters.
const rabbitMQ = new HelmRelease("rabbitmq", {
chart: "rabbitmq",
version: "14.1.2",
repositoryOpts: {
repo: "https://charts.bitnami.com/bitnami",
},
values: {
metrics: {
enabled: true,
prometheusRule: {
enabled: true,
rules: [
{
alert: "RabbitmqInstancesDifferentVersions",
expr: 'count(count(rabbitmq_build_info) by (rabbitmq_version)) > 1',
for: '60m',
labels: {
severity: "warning",
},
annotations: {
summary: 'RabbitMQ instances running different versions (instance {{ "{{ $labels.instance }}" }})\n',
description: 'Running different version of RabbitMQ in the same cluster, can lead to failure.\n VALUE = {{ "{{ $value }}" }}\n LABELS = {{ "{{ $labels }}" }}',
},
},
],
},
},
},
});
In the meantime, I'll see what strategies we could implement within our provider to avoid this issue.
What happened?
I'm trying to add some prometheus rules to my rabbitmq bitnami helm chart and pulumi seems to add a
\n
on a point where it causes anunterminated quoted string
error onpulumi up
Example
Output of
pulumi about
Additional context
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).