forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make generated manifests compatible with various Yaml parsers (a…
…rgoproj#20532) Can help with argoproj#20532 The manifests often used the plain style of strings, which could move a part of value to a new line, which could cause some parsers fail to parse. Using this style is not recommended. It was switched to the literal style when relevant and manifests were updated. To make sure next updates are good, the helper script to fix manifests is a part of the script to update manifests. It's in Python, hope that's okay as it doesn't get added to images. There's one weird value for haproxy.cfg which is rendered as a quotes-enclosed string, but it was correct when I tried to load yamls from upstream and updated ones. In any case, it's more readable now. Let's cherry pick to 2.13, as the apply of install manifests is currently broken. Signed-off-by: Andrii Korotkov <[email protected]>
- Loading branch information
1 parent
5d0a3e6
commit a04ce7f
Showing
11 changed files
with
7,724 additions
and
7,631 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
set -eux -o pipefail | ||
|
||
KUSTOMIZE_VERSION=4.5.7 "$(dirname $0)/../install.sh" kustomize protoc | ||
KUSTOMIZE_VERSION=5.4.3 "$(dirname $0)/../install.sh" kustomize protoc |
This file contains 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import math | ||
import sys | ||
import yaml | ||
|
||
def represent_str(dumper, data): | ||
use_literal_style = '\n' in data or ' ' in data or '\\' in data | ||
if use_literal_style: | ||
data = data.replace("\\", "\\\\") | ||
return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|") | ||
return dumper.represent_str(data) | ||
|
||
yaml.add_representer(str, represent_str, Dumper=yaml.SafeDumper) | ||
|
||
# Technically we can write to the same file, but that can erase the file if dump fails. | ||
input_filename = sys.argv[1] | ||
output_filename = sys.argv[2] | ||
|
||
with open(input_filename, "r") as input_file: | ||
data = yaml.safe_load_all(input_file.read()) | ||
|
||
with open(output_filename, "w") as output_file: | ||
# Without large width the multiline strings enclosed in "..." are rendered weirdly. | ||
yaml.safe_dump_all(data, output_file, width=math.inf) |
This file contains 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
This file contains 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
Oops, something went wrong.