首页 > 解决方案 > Linter 在 IF-ELSE-IF 分支的 kubernetes configmap.yaml 上给出错误

问题描述

我的 linter 在这个 yaml 上给了我错误,看不出有什么问题!错误信息:

kubernetes configmap.yaml 到了最后但是发现了更多的key。请将它们移到 if / else 语句上方,以便解析器正常运行

{{- if .Values.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: cvn-configmap
  namespace: {{ .Release.Namespace }}
data:
  # Not documented: CVI_DRYRUN, INSECURE_HTTPS
  logLevel: "4"
  logSQL: "false"
  immigrations: "true"
  jobMonitorSeconds: "180"
  reclaimJobHours: "0"
  sharedVPC: "false"
  multiVPC: "0"
  bgpWaitMinutes: "0"
  maxVRRP: "255"
  internalBGP: "169.254.16.0/30"
  internalBGPPortChannel: "port-channel1"
  rmapBorder: "extcon-rmap-filter"
  rmapService: "rmap-bgp-direct"
  defaultLagCapacity: "0"
  defaultBorderSwitchCapacity: "800"
  defaultServiceSwitchCapacity: "800"
  gcpEndpointURL: ""
  gcpTenantFolderID: ""
  gcpRemoteASN: ""
  maintenance: "false"
  dryrun: "false"
  garbageDisposalDays: "1"
  garbageDisposalMax: "50"
{{- if eq .Values.global.hyperscaler "aws" }}
  bgpWaitMinutes: "5"
  defaultLagCapacity: "200"
  reclaimJobHours: "36"
{{- else if eq .Values.global.hyperscaler "gcp" }}
  defaultLagCapacity: "20"
  gcpRemoteASN: "64512"
  sharedVPC: "true"
  multiVPC: "5"
  reclaimJobHours: "6"
{{- end }}
{{- end }}

标签: yamlkubernetes-helm

解决方案


推荐阅读