What is the use of the pipe symbol in YAML?

The pipe symbol at the end of a line in YAML signifies that any indented text that follows should be interpreted as a multi-line scalar value. See the YAML spec. Specifically, the pipe indicates that (except for the indentation) the scalar value should be interpreted literally in such a way that preserves newlines. Conversely, the … Read more

YAML Multi-Line Arrays

A YAML sequence is an array. So this is the right way to express it: key: – string1 – string2 – string3 – string4 – string5 – string6 That’s identical in meaning to: key: [‘string1’, ‘string2’, ‘string3’, ‘string4’, ‘string5’, ‘string6′] It’s also legal to split a single-line array over several lines: key: [‘string1’, ‘string2’, ‘string3’, … Read more

How to set multiple commands in one yaml file with Kubernetes?

command: [“/bin/sh”,”-c”] args: [“command one; command two && command three”] Explanation: The command [“/bin/sh”, “-c”] says “run a shell, and execute the following instructions”. The args are then passed as commands to the shell. In shell scripting a semicolon separates commands, and && conditionally runs the following command if the first succeed. In the above … Read more

Use placeholders in yaml

Context YAML version 1.2 user wishes to include variable placeholders in YAML have placeholders replaced with computed values, upon yaml.load be able to use placeholders for both YAML mapping keys and values Problem YAML does not natively support variable placeholders. Anchors and Aliases almost provide the desired functionality, but these do not work as variable … Read more

tech