BvuRVKyUVlViVIc7
BvuRVKyUVlViVIc7

Reputation: 11811

Helmfile with additional resource without chart

I know this is maybe a weird question, but I want to ask if it's possible to also manage single resources (like f.e. a configmap/secret) without a seperate chart?

F.e. I try to install a nginx-ingress and would like to additionally apply a secret map which includes http-basic-authentication data.

I can just reference the nginx-ingress-repo directly in my helmfile, but do I really need to create a seperate helm chart to also apply the http-basic-secret?

I have many releases which need a single, additional resource (like a json configmap, a single secret) and it would be cumbersome to always need a seperate chart file for each release?

Thank you!

Upvotes: 2

Views: 1850

Answers (2)

Josh
Josh

Reputation: 86

To deploy an extra object for a chart that is missing extraObjects, you can also deploy something like the sysbee/kubedeploy chart.

As an example helmfile.yaml

releases:
  - name: extra
    namespace: extra-namespace
    chart: "sysbee/kubedeploy"
    version: ^1.2.1
    values:
      - extra.yaml

And the extra.yaml values file

deploymentMode: None
serviceAccount:
  create: false
service:
  enabled: false
extraObjects:
  - apiVersion: metallb.io/v1beta1
    kind: IPAddressPool
    metadata:
      name: ip-pool
      namespace: extra-namespace
    spec:
      addresses:
        - 10.1.0.0/16
      autoAssign: true
      avoidBuggyIPs: false

Make sure to include the deploymentMode: None, and disable the service account and service. Then the chart will deploy absolute nothing other than your extraObjects.

Upvotes: 0

David Maze
David Maze

Reputation: 158758

Sorry, Helmfile only manages entire Helm releases.

There are a couple of escape hatches you might be able to use. Helmfile hooks can run arbitrary shell commands on the host (as distinct from Helm hooks, which usually run Jobs in the cluster) and so you could in principle kubectl apply a file in a hook. Helmfile also has some integration with Kustomize and it might be possible to add resources this way. As you've noted you can also write local charts and put whatever YAML you need in those.

The occasional chart does support including either arbitrary extra resources or specific configuration content; the Bitnami MariaDB chart, to pick one, supports putting anything you want under an extraDeploy value. You could use this in combination with Helmfile values: to inject more resources

releases:
  - name: mariadb
    chart: bitnami/mariadb
    values:
      - extraDeploy:
          - |-
              apiVersion: v1
              kind: ConfigMap
              ...

Upvotes: 2

Related Questions