Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

How to run sops -d to decrypt HelmRelease resource #3487

Closed
nichoio opened this issue May 26, 2021 · 1 comment
Closed

How to run sops -d to decrypt HelmRelease resource #3487

nichoio opened this issue May 26, 2021 · 1 comment

Comments

@nichoio
Copy link

nichoio commented May 26, 2021

Hi,
i'm aware that Flux v2 exists, however i'm stuck with 1.14 of Kubernetes, so v2 is out of option AFAIK.
I'm trying to create a workflow using Flux, Helm Operator and Sops. I'm aware of #2804 and #3078 , however i thought, i could simply encrypt a HelmRelease resource locally, using sops -e --config .sops.yaml release.yaml > release.enc.yaml, commit that release.enc.yaml and let Flux decrypt it by using a .flux.yaml file. Like so roughly:

version: 1
commandUpdated:
  generators:
    - command: sops -d --output release.yaml release.enc.yaml

I believe this file is incomplete, however i'm having trouble understanding how to work with commandUpdated or patchUpdated exactly. I simply would like to decrypt the values: section of a HelmRelease, next i would expect Helm-Operator to discover the resource and apply it.

values.yaml i use for the Helm chart of Flux v1:

git:
  url: (...)
  branch: (...)
  pollInterval: 2m
registry:
  disableScanning: true
sync:
  interval: 2m
rbac:
  create: false
serviceAccount:
  create: true
  name: flux-sa
ssh:
  known_hosts: (...)
gpgKeys:
  secretName: flux-sops-gpg
manifestGeneration: true
sops:
  enabled: true

Any help is appreciated.

@nichoio
Copy link
Author

nichoio commented May 28, 2021

Nevermind, i figured it out, however i ended up using kustomize which i originally did not intend.
.flux.yaml (release.enc.yaml contains values for a HelmRelease resource, encrypted with SOPS):

version: 1
patchUpdated:
  generators:
    - command: sops -d --output overlay/release.yaml overlay/release.enc.yaml && kustomize build overlay/
    - command: rm overlay/release.yaml
  patchFile: overlay/release.yaml

@nichoio nichoio closed this as completed May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant