Skip to content

Post-renderer not receiving chart hook manifests? #7891

Open
@robg

Description

@robg

Output of helm version:

version.BuildInfo{Version:"v3.1.2", GitCommit:"d878d4d45863e42fd5cff6743294a11d28a9abce", GitTreeState:"clean", GoVersion:"go1.13.8"}

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.4+k3s1", GitCommit:"3eee8ac3a1cf0a216c8a660571329d4bda3bdf77", GitTreeState:"clean", BuildDate:"2020-03-25T16:13:25Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.4+k3s1", GitCommit:"3eee8ac3a1cf0a216c8a660571329d4bda3bdf77", GitTreeState:"clean", BuildDate:"2020-03-25T16:13:25Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}

I was experimenting with the --post-renderer option and a simple chart that includes one pod:

apiVersion: v1
kind: Pod
metadata:
  name: post-render-test
  labels:
    # The "app.kubernetes.io/managed-by" label is used to track which tool
    # deployed a given chart. It is useful for admins who want to see what
    # releases a particular tool is responsible for.
    app.kubernetes.io/managed-by: {{.Release.Service | quote }}
    # The "app.kubernetes.io/instance" convention makes it easy to tie a release
    # to all of the Kubernetes resources that were created as part of that
    # release.
    app.kubernetes.io/instance: {{.Release.Name | quote }}
    app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
    # This makes it easy to audit chart usage.
    helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}"
    values: {{.Values.Name}}
spec:
  # This shows how to use a simple value. This will look for a passed-in value
  # called restartPolicy. If it is not found, it will use the default value.
  # {{default "Never" .restartPolicy}} is a slightly optimized version of the
  # more conventional syntax: {{.restartPolicy | default "Never"}}
  restartPolicy: {{default "Never" .Values.restartPolicy}}
  containers:
  - name: waiter
    image: "alpine:3.4"
    command: ["/bin/sleep","9000"]

and one pre-install hook:

apiVersion: batch/v1
kind: Job
metadata:
  name: "{{ .Release.Name }}"
  labels:
    app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
    app.kubernetes.io/instance: {{ .Release.Name | quote }}
    app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
    helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
  annotations:
    # This is what defines this resource as a hook. Without this line, the
    # job is considered part of the release.
    "helm.sh/hook": pre-install,pre-upgrade
    "helm.sh/hook-weight": "-5"
    "helm.sh/hook-delete-policy": before-hook-creation
spec:
  backoffLimit: 3 # retry this task 3 times
  template:
    metadata:
      name: "{{ .Release.Name }}"
      labels:
        app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
        app.kubernetes.io/instance: {{ .Release.Name | quote }}
        helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    spec:
      restartPolicy: Never
      containers:
      - name: pre-deploy-job
        image: "alpine:3.4"
{{- if .Values.predeploy_task.fail }}
        command: ["/bin/false"]
{{- else }}
        command: ["/bin/sleep","{{ default "10" .Values.sleepyTime }}"]
{{- end }}

For the test, I was using a no-op post-renderer:

#!/bin/bash

tee --append  <&0 all.yaml

When I execute helm install post-render-test ../chart --post-renderer ./post-renderer --debug --dry-run I see both the chart hook and the pod manifest in the output, however my post-renderer only captures the pod manifest.

I've tried this as well with helm template with the same results.

Is this the intended behavior? I couldn't find anything in the documentation to suggest that hooks would not be included when invoking the post-renderer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategorizes issue or PR as related to a bug.in progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions