Closed donbowman closed 4 years ago
Do I understand correctly that you want the resulting string to be free of newlines? If so, the block scalar single newline chomp isn't working in the original document. :thinking:
Here's a test with a Python YAML parser:
>>> import yaml
>>> value_before = yaml.safe_load(
"""literals:
- >-
druid_extensions_loadList=["druid-histogram",
"druid-datasketches",
"druid-lookups-cached-global",
"druid-azure-extensions",
"postgresql-metadata-storage",
"druid-rabbitmq",
"druid-basic-security",
"druid-virtual-columns",
"druid-kafka-indexing-service"]
""")['literals'][0]
>>> # Chop off the key and equals so that we see the value that Kustomize sees
>>> value_before = value_before[len('druid_extensions_loadList='):]
>>> '\n' in value_before
True
Indeed, the string that Kustomize produces is identical to the original one:
>>> value_after = yaml.safe_load(
"""druid_extensions_loadList: |-
["druid-histogram",
"druid-datasketches",
"druid-lookups-cached-global",
"druid-azure-extensions",
"postgresql-metadata-storage",
"druid-rabbitmq",
"druid-basic-security",
"druid-virtual-columns",
"druid-kafka-indexing-service"]
""")['druid_extensions_loadList']
>>> value_before == value_after
True
I'm not sure what the correct YAML syntax here is if you want to use a block scalar, but after tinkering with this online parser I found that a flow scalar happens to work:
>>> value_oneline = yaml.safe_load(
"""literals:
- druid_extensions_loadList=["druid-histogram",
"druid-datasketches",
"druid-lookups-cached-global",
"druid-azure-extensions",
"postgresql-metadata-storage",
"druid-rabbitmq",
"druid-basic-security",
"druid-virtual-columns",
"druid-kafka-indexing-service"]
""")['literals'][0][len('druid_extensions_loadList='):]
>>> '\n' in value_oneline
False
>>> print(type(value_oneline))
<class 'str'>
>>> print(value_oneline)
["druid-histogram", "druid-datasketches", "druid-lookups-cached-global", "druid-azure-extensions", "postgresql-metadata-storage", "druid-rabbitmq", "druid-basic-security", "druid-virtual-columns", "druid-kafka-indexing-service"]
Thanks. Switching to this syntax was to work around https://github.com/kubernetes-sigs/kustomize/issues/843
I can try the flow scalar again i suppose
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten
/remove-lifecycle rotten
its really a shame the only thing visiting the issues is the bot.
the quoting is really tough to get right in kustomize, navigating its buglist.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
.
Mark the issue as fresh with /remove-lifecycle rotten
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close
@fejta-bot: Closing this issue.
I have a simple
kustomization.yaml
fileWhen build, the output is:
which is incorrect, it has been changed from block scalar single newline chomp to block scalar multiline.
since I am using this ulimately as an environment variable, this breaks.