replicatedhq/troubleshoot

Add parameterize SupportBundle spec support

nashtsai opened this issue · 2 comments

Describe the rationale for the suggested feature.

There are a number of collectors that required parameterize values, i.e., helm, for every different input value, it requires us generating new supportbundle yaml from a template, which is rather tedious.

Describe the feature

Have CLI tool accept key-value args and SupportBundle spec support template syntax

# file: helm-collector.yaml
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: sample
spec:
  collectors:
    - helm:
        # support templating, i.e., helm/go 
        releaseName: {{ .Values.releaseName }}
        # if not specified, scan all namespaces
        {{- if .Values.namespace }}
        namespace: {{  .Values.namespace }}
        {{- end }}

Run CLI command as:

kubectl support-bundle --template helm-collector.yaml --set releaseName=mysql-1692919203

Expecting same result as running following SupportBundle spec

apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
  name: sample
spec:
  collectors:
    - helm:
        releaseName: mysql-1692919203

Describe alternatives you've considered

Wrap support-bundle plugin with support-bundle-template python script and handle template rending in python.

Additional context

Add additional context about the feature request. If the change is substantial, consider attaching files to the issue outlining architectural changes, data flows, file formats etc., anything that helps describe the requested change.

This feature has been previously asked for. The solution we settled for relies on helm CLI performing template evaluation and producing an output that troubleshoot.sh tools would consume. In your example above, the command that would achieve the same results would look like below

helm template my-release ./my-chart --set releaseName=mysql-1692919203 | kubectl support-bundle -

I believe the issue has been answered and so will close this issue now.