使用 helm 提供程序的差异值文件

Tin*_*215 6 kubernetes terraform kubernetes-helm

我希望你能帮助我对我的问题有更多的了解。

目前我正在使用:

  • 地形 v1.3.5
  • 头盔提供商 v2.8.0
  • Kubernetes 提供程序 v2.16.1

最近,我一直在调整 Terraform 上的 Helm 提供程序,以帮助我更有弹性地管理 Helm 版本。plan能够做出改变并了解哪些内容发生了变化以及哪些内容保持不变,这很有帮助。它与基础设施细节融合得非常好,我只需一个工具就可以管理一切,这太棒了。

有件事让我有点困扰。这是terraform plan值文件的预览,它仅显示已进行的一些更改,但不显示更改位置或更改内容。让我添加一个例子。

文件main.tf

# I'm using the "manifest" setting to calculate manifest diffs
provider "helm" {
  kubernetes {
    config_path    = "~/.kube/config"
    config_context = "clusterconfig"
  }
  experiments {
    manifest = true
  }
}

# The helm chart lives locally on my repo. I'm passing the values file and an
#  override for the image tag.
resource "helm_release" "release" {
  name      = "example"
  chart     = "../../helm/chart"
  namespace = "example"
  wait      = true
  set {
    name  = "image.tag"
    value = "latest"
  }
  values = [
    file("helm/values-example.yaml")
  ]
}
Run Code Online (Sandbox Code Playgroud)

这很好用,当我对值文件进行更改时就会出现问题。它显示整个文件而不仅仅是更改。例如,在我的值文件中,我将副本从 1 更改为 2:

文件values-example.yaml

# I'm using the "manifest" setting to calculate manifest diffs
provider "helm" {
  kubernetes {
    config_path    = "~/.kube/config"
    config_context = "clusterconfig"
  }
  experiments {
    manifest = true
  }
}

# The helm chart lives locally on my repo. I'm passing the values file and an
#  override for the image tag.
resource "helm_release" "release" {
  name      = "example"
  chart     = "../../helm/chart"
  namespace = "example"
  wait      = true
  set {
    name  = "image.tag"
    value = "latest"
  }
  values = [
    file("helm/values-example.yaml")
  ]
}
Run Code Online (Sandbox Code Playgroud)

执行:

replicaCount: 1
image:
  repository: test
  pullPolicy: ifNotPresent
Run Code Online (Sandbox Code Playgroud)

当值文件较大时,这使得很难查看哪些值设置已更改。

那么,我的问题是,您知道是否有办法区分这些值?我只想查看更改而不是整个文件。

我在网上看到的:

先谢谢您的帮助。如果我可以提供更多信息,请告诉我。