-
Notifications
You must be signed in to change notification settings - Fork 137
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
Timestamp-like strings lose quote #889
Comments
checking... |
@deblaci % cat timestamp.yaml
canonicalts: "2023-01-01T07:00:00.1Z"
canonicalts1: 2023-01-01T07:00:00.1Z
iso8601ts: "2023-01-01T07:00:00Z"
iso8601ts1: 2023-01-01T07:00:00Z
withspacets: "2023-01-01 07:00:00"
withspacets1: 2023-01-01 07:00:00
% ytt -f timestamp.yaml
canonicalts: "2023-01-01T07:00:00.1Z"
canonicalts1: "2023-01-01T07:00:00.1Z"
iso8601ts: "2023-01-01T07:00:00Z"
iso8601ts1: "2023-01-01T07:00:00Z"
withspacets: "2023-01-01 07:00:00"
withspacets1: "2023-01-01 07:00:00"
|
and currently ytt cannot force quotes see https://kubernetes.slack.com/archives/CH8KCCKA5/p1688043220329239 and https://kubernetes.slack.com/archives/CH8KCCKA5/p1668521528903319. |
@prembhaskal According to (https://yaml.org/type/timestamp.html), "2023-01-01T07:00:00" seems to be valid. I tried the regex. Shouldn't Ytt generate a strict yaml in strict mode? When I use Ytt in Strict mode, I give strict input yaml then I will get a non-strict yaml, since "exampleTimestamp: - 2023-01-01T07:00:00" is not a strict yaml without quote. (https://carvel.dev/ytt/docs/v0.46.x/strict/)
I tried to parse the yaml with Groovy: |
@deblaci so strict yaml is only for parsing. |
Upstream does not have this feature. |
What steps did you take:
When I provide a string but contains timestamp, after templating with Ytt this strings lose the quote.
This would be valid, but yaml parsers handle this as a date not a string and convet it like Mon Sep 20 12:00:00 CEST 2021.
This happens even I turn on strict yaml, according to rule "requires strings with colon to be explicitly quoted"
template.yaml:
exampleTimestamp: "2023-01-01T07:00:00"
ytt -f template.yaml
ytt -f template.yaml -s
What happened:
exampleTimestamp: 2023-01-01T07:00:00
What did you expect:
exampleTimestamp: "2023-01-01T07:00:00"
Environment:
ytt --version
): ytt version 0.47.0/etc/os-release
):ProductName: macOS
ProductVersion: 14.2.1
BuildVersion: 23C71
Vote on this request
👍 "I would like to see this addressed as soon as possible"
The text was updated successfully, but these errors were encountered: