Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postrender does not have any effect in helm_template #1472

Open
RemkoMolier opened this issue Sep 1, 2024 · 4 comments
Open

postrender does not have any effect in helm_template #1472

RemkoMolier opened this issue Sep 1, 2024 · 4 comments
Assignees
Labels

Comments

@RemkoMolier
Copy link

Terraform, Provider, Kubernetes and Helm Versions

Terraform version: v1.9.5
Provider version: v2.15.0
Kubernetes version: N/A

Affected Resource(s)

  • helm_template

Terraform Configuration Files

data "helm_template" "cilium" {
  namespace  = "kube-system"
  name       = "cilium"
  repository = "https://helm.cilium.io"
  chart      = "cilium"
  # renovate: datasource=helm depName=cilium registryUrl=https://helm.cilium.io
  version      = "1.16.0"
  kube_version = var.kubernetes_version
  api_versions = []
  values       = [file("values.yaml")]
  postrender {
    binary_path = "${path.module}/postrender"
  }
}

values.yaml:

---
ipam:
  mode: kubernetes
securityContext:
  capabilities:
    ciliumAgent: [CHOWN, KILL, NET_ADMIN, NET_RAW, IPC_LOCK, SYS_ADMIN, SYS_RESOURCE, DAC_OVERRIDE, FOWNER, SETGID, SETUID]
    cleanCiliumState: [NET_ADMIN, SYS_ADMIN, SYS_RESOURCE]
cgroup:
  autoMount:
    enabled: false
  hostRoot: /sys/fs/cgroup
k8sServiceHost: localhost
k8sServicePort: 7445
kubeProxyReplacement: true

postrender:

#!/bin/bash

yq '.metadata.annotations."meta.helm.sh/release-name"="cilium" | .metadata.annotations."meta.helm.sh/release-namespace"="kube-system" | .metadata.labels."app.kubernetes.io/managed-by" = "Helm"' <&0

Debug Output

N/A

Panic Output

N/A

Steps to Reproduce

  1. terraform plan

Expected Behavior

Postrender to be executed by the helm template and the output should have been adapted

Actual Behavior

Postrender is not executed by the helm template and the output is not adapted accordingly.

Important Factoids

N/A

References

N/A

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@arybolovlev
Copy link
Contributor

Hi @RemkoMolier,

Does your post-render script work when you execute it with Helm CLI? What is the difference in output when you execute it with and without your post-render script?

Thanks.

@RemkoMolier
Copy link
Author

RemkoMolier commented Sep 4, 2024

Hi @arybolovlev,

yes it does. It, amongst side effects like reformatting and removal of comments , adds two annotations and one label to each of the configurations.

These are the first couple of lines from the diff (after formatting the outputs with yamlfmt):

`diff
1d0
< # Source: cilium/templates/cilium-agent/serviceaccount.yaml
6a6,10

annotations:
meta.helm.sh/release-name: cilium
meta.helm.sh/release-namespace: kube-system
labels:
app.kubernetes.io/managed-by: Helm
`

Regards,

Remko

@arybolovlev arybolovlev added the bug label Sep 5, 2024
@arybolovlev
Copy link
Contributor

Hi @RemkoMolier,

Thank you! It looks like we have the postrender attribute in the helm_template data source schema, but it has not been implemented.

@RemkoMolier
Copy link
Author

Hi @arybolovlev thank you.

Is there anything I can do to help?

Regards,

Remko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants