Skip to content

feat(vector): add support for string templating in extraObjects#512

Open
lasermoth wants to merge 1 commit intovectordotdev:developfrom
lasermoth:feature/extra-object-string-template
Open

feat(vector): add support for string templating in extraObjects#512
lasermoth wants to merge 1 commit intovectordotdev:developfrom
lasermoth:feature/extra-object-string-template

Conversation

@lasermoth
Copy link

Description

Adds optional string templating to extraObjects.

This allows more flexibility with extraObjects.

Example Use Case

Conditionally enabling custom resources like Keda ScaledObject if autoscaling is set to external.

Testing

# values-extra-objects.yaml

custom:
  enabled: true
  config: "my custom config"

extraObjects:
  - apiVersion: v1
    kind: ConfigMap
    metadata:
      name: foo
      namespace: "{{ .Release.Namespace }}"
    data:
      type: "yaml"
  - |
    {{- if $.Values.custom.enabled }}
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: bar
      namespace: "{{ .Release.Namespace }}"
    data:
      type: "string"
      config: "{{ $.Values.custom.config }}"
    {{- end }}
helm template vector . -f values-extra-objects.yaml | yq 'select(.kind == "ConfigMap" and (.metadata.name == "foo" or .metadata.name == "bar"))'

# Source: vector/templates/extra-manifests.yaml
apiVersion: v1
data:
  type: yaml
kind: ConfigMap
metadata:
  name: foo
  namespace: 'default'
---
# Source: vector/templates/extra-manifests.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: bar
  namespace: "default"
data:
  type: "string"
  config: "my custom string"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants