我是 Kubernetes / GitOps 的忠实粉丝,我非常习惯使用 YAML 格式来描述 Kubernetes 对象 (manifests)。
理念:
apiVersion: apps/v1 # A reference to some known schema
kind: Deployment # A subpart of the schema
metadata:
name: some-name
description: The keys under metadata also adhere to some schema, at least in Kubernetes manifests
annotations:
some-key: some-value
spec:
key1: this whole object will adhere to the scheme referenced by apiVersion and kind (line 1 and 2)
key2: the file is invalid if it's not
有时我会看到该格式在其他地方/上下文中使用。 例如参见后台内容描述。与 Kubernetes 资源无关的不同上下文。显然,这是在 YAML 文件中进行一些输入的一种很好且易于识别的方式。
这个概念有名称吗?或者在哪里有更正式的描述?我记得在 Kubernetes 之前就读到过这是 Google 的一些内部标准。
到目前为止找到“名字”:
终于找到了!最初的 Kubernetes 首席架构师最近写了一篇关于此的文章:https://itnext.io/on-using-the-kubernetes-resource-model-for-declarative-configuration-a5dd11b99546
简短的回答:他称之为“KRM Spec”。但它与 API 设计如此相似的整个背景使得它如此强大和有趣。