List
API objects and triple dashes (---
) can both be used to denote multiple objects in a single YAML file. Therefore, why do Lists exist when triple dashes accomplish the same thing (in my opinion) in a cleaner way? Are there any cases in which a List would be preferred over triple dashes, or is this purely a stylistic choice?
For example, these two YAML files both produce the same two ServiceAccount
objects (chosen for brevity):
my-serviceaccounts1.yaml
apiVersion: v1
kind: List
metadata: {}
items:
- apiVersion: v1
kind: ServiceAccount
metadata:
name: my-app
- apiVersion: v1
kind: ServiceAccount
metadata:
name: my-other-app
my-serviceaccounts2.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-app
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-other-app
I can think of two reasons: