【问题标题】:Azure devops + helm chart = ##[warning]Capturing deployment metadata failed with error: TypeError: Cannot read property 'kind' of nullAzure devops + helm chart = ##[warning]Capturing deployment metadata failed with error: TypeError: Cannot read property \'kind\' of null
【发布时间】:2022-11-04 23:29:10
【问题描述】:

我使用 helm chart 通过 Azure Devops 在 AKS 群集上进行部署。一切正常,但我在部署步骤结束时看到警告:

Starting: Deploy Helm chart to qa3 environment
==============================================================================
Task         : Package and deploy Helm charts
Description  : Deploy, configure, update a Kubernetes cluster in Azure Container Service by running helm commands
Version      : 0.201.0
Author       : Microsoft Corporation
Help         : https://aka.ms/azpipes-helm-tsg
==============================================================================
/usr/local/bin/helm upgrade --namespace qa3 --install --values /home/vsts/work/1/s/invitation/values.yaml --set deployment.image.tag=***,deployment.environment=qa3,cluster.name=dev,azure.region=westus2,azure.appInsightsKey=***,deployment.deployedBy='cd',application.publicJwtValidationCertPemBase64=***,application.endpointPath=invitational,application.sendGridTemplateId=***,application.twillioFromPhoneNumber=***,secret.AuthToken=***,secret.AccountSid=***,secret.SendGridApiKey=*** --wait --install --reuse-values q5id-app-invitation /home/vsts/work/1/s/invitation
Release "q5id-app-invitation" has been upgraded. Happy Helming!
NAME: q5id-app-invitation
LAST DEPLOYED: Wed Aug 10 14:53:19 2022
NAMESPACE: qa3
STATUS: deployed
REVISION: 3
TEST SUITE: None
/usr/local/bin/kubectl cluster-info
Kubernetes control plane is running at https://***:443
CoreDNS is running at https://***:443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://***:443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
##[warning]Capturing deployment metadata failed with error: TypeError: Cannot read property 'kind' of null
Finishing: Deploy Helm chart to qa3 environment

看起来模板已成功部署,然后运行 ​​kubectl cluster-info,然后运行其他内容。我无法理解可能导致此警告的原因:

##[警告]捕获部署元数据失败并出现错误:TypeError:无法读取 null 的属性“种类”

我该如何解决?

【问题讨论】:

    标签: azure-devops kubernetes-helm pipeline


    【解决方案1】:

    看来我只是遇到了同样的问题。问题是您的 helm 模板之一未正确加载。例如,您根据values.yaml 中指定的值切换模板,并且该值设置为false。 Azure 执行 helmUpgrade 任务并检查所有模板,一旦模板被禁用,它就会抛出警告“无法读取 null 的属性‘种类’”,因为模板在这里但它是空的,它找不到它的 kind。当您在本地运行设置时,您不会看到此警告,看起来 Azure 方面正在发生某些事情。 我不知道为什么 Azure 不跳过空模板以及它是否是预期的行为,我没有找到任何信息。

    这是我所拥有的:

    pdb.yaml:

    {{- if .Values.pdb }}{{ if .Values.pdb.enabled }}
    apiVersion: policy/v1
    kind: PodDisruptionBudget
    ...
    {{- end }}{{ end }}
    

    值.yaml:

    pdb:
      enabled: false
    

    然后为了摆脱警告,我将值更改为

    pdb:
      enabled: true 
    

    现在,由于在通过 Azure 运行时始终启用该策略,所以我的问题是如何禁用特定环境的模板,因为我只需要其中一些。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-21
      • 1970-01-01
      • 2018-06-30
      • 2017-12-29
      • 2018-01-23
      • 2019-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多