VSCode yamllinter 在 helm 模板中显示不正确的类型

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

我在 VSCode 中使用 YAML 插件,当我将 ports 值转换为变量时,它显示

Incorrect type. Expected "integer"
。我试着写了
{{ .Values.port | int }}
之类的东西,但没有帮助。实际上,我不明白为什么会显示它以及如何解决它

部署.yml:

kind: Deployment
metadata:
  name: "{{ .Release.Name }}"
spec:
  selector:
    matchLabels:
      app: "{{ .Release.Name }}"
  template:
    metadata:
      labels:
        app: "{{ .Release.Name }}"
    spec:
      containers:
      - name: "{{ .Release.Name }}"
        image: "{{ .Values.image }}"
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports: 
         - containerPort: {{ .Values.port }}
         
kubernetes-helm
© www.soinside.com 2019 - 2024. All rights reserved.