Helm 图表中的所有者参考 [关闭]

问题描述 投票:0回答:0

我有一个带有部署和作业对象的简单掌舵图

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}-parent
spec:
  selector:
    matchLabels:
      app: {{ .Release.Name }}-parent
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}-parent
    spec:
      containers:
        - name: nginx
          image: nginx:latest
          
          # Add other container configuration as needed

和工作对象

apiVersion: batch/v1
kind: Job
metadata:
  name: {{ .Release.Name }}-job
  ownerReferences:
    - apiVersion: apps/v1
      blockOwnerDeletion: true
      controller: true
      kind: Deployment
      name: {{ .Release.Name }}-parent
      uid: $(kubectl get deployment my-release-parent -o jsonpath='{.metadata.uid}')
spec:
  template:
    metadata:
      labels:
        app: {{ .Release.Name }}-job
    spec:
      containers:
        - name: busybox
          image: busybox:latest
      restartPolicy: Never
          # Add other container configuration as needed
      # Add other Job configuration as needed

我正在尝试将部署对象的 UID 动态解析为作业清单中的 onwerReference。现在,如果我部署此图表,除了不会显示的作业外,一切正常。当我删除 ownerReference 时,工作完美运行,我知道这个问题与我解析 UID 的方式有关..

kubernetes kubernetes-helm kubectl helm3 helmfile
© www.soinside.com 2019 - 2024. All rights reserved.