我有一个基本 yaml 和一个覆盖 yaml,并使用“kustomize”我想合并这两个 yaml。发生在我身上的是,在运行 kustomize build 时会出现一个输出,但预计不会是为什么?因为在我的例子中,kustomize 不是从覆盖 yaml 填充自定义信息,而是用覆盖“容器”替换了基础的整个标题标签。我需要的预期行为是它应该以某种方式使用覆盖 yaml 而不是替换来填充缺失的信息。
基础yaml:
apiVersion: v1
kind: Pod
metadata:
name: temp
labels:
tier: temp
spec:
containers:
- name: temp
image: temp
imagePullPolicy: Always
command: temp
args:
temp
envFrom:
- configMapRef:
name: temp
volumeMounts:
volumes:
覆盖yaml:
apiVersion: v1
kind: Pod
metadata:
name: temp
labels:
tier: temp
spec:
containers:
volumeMounts:
- name: temppathname
mountPath: /temppath
volumes:
- name: temppathname
hostPath:
type: temp
path: temppath
kustomize 构建后的预期结果:
apiVersion: v1
kind: Pod
metadata:
name: temp
labels:
tier: temp
spec:
containers:
- name: temp
image: temp
imagePullPolicy: Always
command: temp
args:
["sleep 9000"]
envFrom:
- configMapRef:
name: temp
volumeMounts:
- name: temppathname
mountPath: /temppath
volumes:
- name: temppathname
hostPath:
type: temp
path: temppath
我得到了什么:
apiVersion: v1
kind: Pod
metadata:
labels:
tier: temp
name: temp
spec:
containers:
volumeMounts:
- name: temppathname
mountPath: /temppath
volumes:
- name: temppathname
hostPath:
type: temp
path: temppath