viaduct-ai / kustomize-sops

KSOPS - A Flexible Kustomize Plugin for SOPS Encrypted Resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KSOPS v3.0.0 issue with ArgoCD v2.1.1

shuker85 opened this issue · comments

image (1)

Downgrade to v.2.6.0 fixed the problem for us.

Hi @shuker85 thanks for making an issue. The error is coming from kustomize not KSOPS, so it's interesting that downgrading fixed it. To help me debug, can you share more information about your setup?

  1. How are you integrating KSOPS + Argo CD? (Custom Docker build, repo server patch, helm w/ custom tooling)
  2. Can you provide an example manifest(s) with that represents the kustomize functionality you are using? For example, the error message indicates you may be using the namePrefix: transformer.
  3. Are you able to reproduce the error locally w// KSOPS v3.0.0?

Hi, we're using the repo server patch approach with initiContainers and we do have nameSuffix present

nameSuffix: -dev
namespace: api
bases:
  - ../base
commonLabels:
  app: api-dev
images:
  - name: api
    newName: ghcr.io/xxxx/api:v0.0.1
patchesStrategicMerge:
  - cm.yaml

@shuker85 Thanks for sharing. Do you have a KSOPS manifest in this overlay or the base?

 kustomization.yaml in the dev dir:
---
generators:
  - ./secret-gen.yaml
  - ./gh-pkg-secret-gen.yaml
---
kind: Secret
type: kubernetes.io/dockerconfigjson
apiVersion: v1
metadata:
    name: github-packages
    namespace: api
    labels:
        app: api
data:
    .dockerconfigjson: ENC[AES256_GCM,data:caOT/5YqgsR3YQd8TkvP4mIV5Oig2Desnq2DAFJqFME5ZwseNucVdGbwbRKZEHcFBWMbIYSC5i7JuGK8lkUc=,tag:U+acmN5G6Fo2ck0wnXDQbw==,type:str]
sops:
    kms: []
    gcp_kms:
        - resource_id: projects/dev-infra/locations/global/keyRings/automation-keys/cryptoKeys/encrypt-decrypt-key
          created_at: "2021-08-31T22:07:44Z"
          enc: CiQApZIyp58XjQKSTiz8iPtNTTZMDoI=
    azure_kv: []
    hc_vault: []
    age: []
    lastmodified: "2021-08-31T22:07:45Z"
    mac: ENC[AES256_GCM,data:Q6dDSGLFAd5ZQAlSTrgZvn9vvqyx1toqJBwAHVoC3i+Qw0hvHDyQoDizysdLo=,iv:5TFiUFfiTf22PA9HEdj+usxAHfyQP32F0EjBiwjXkzs=,tag:2/R9ZIQCVCcRBwTUKpf6zA==,type:str]
    pgp: []
    encrypted_regex: ^(data|stringData)$
    version: 3.7.1
---
apiVersion: viaduct.ai/v1
kind: ksops
metadata:
  name: github-packages-generator
  namespace: api
files:
  - ./gh-pkg-secret.enc.yaml
 

Thanks! And the last question

Are you able to reproduce the error locally w// KSOPS v3.0.0?

Locally kustomize build worked fine :/

Interesting...what is your local kustomize version?

kustomize version

I've downloaded latest 4.3.0, as i can see Argo is on 4.2

@shuker85 I released v3.0.1, which include kustomize v4.3.0 in the Docker image. Please let me know if this resolves the issue; otherwise, we can keep digging into it!

New version works fine.
Kudos

Hello, I have been trying to connect KSOPS with ArgoCD for a while now. I seem to not be having luck with the kustomize.buildOptions: "--enable-alpha-plugins" command in the argo-cd configmap via the strategic merge patch with init containers. KSOPS works fine locally and the patch on the argo-cd-configmap is done correctly as well. Is it possible im using old version? argocd is 2.0.4 and kustomize is 4.0.5 Any help is appreciated. Thank you!

Hi @evercast-chris would you mind sharing the error message you are seeing?

If you are using kustomize from the KSOPS image, then you are on KSOPS v2.5.0.

If that is the case, you should use the repo server patch from v2.5.0. Alternatively, use upgrade to latest image version (v3.0.1)

Thanks @devstein for getting back to me. Yes KSOPS v2.5.0 sounds correct. If that is the case does that mean I should change the image: viaductoss/ksops:v3.0.1 to --> image: viaductoss/ksops:v2.5.0 inside the repo sever patch and also changing the build options to --> kustomize.buildOptions: "--enable_alpha_plugins"

@devstein here is the error I am getting from ArgoCD...

Unable to create application: application spec is invalid: InvalidSpecError: Unable to generate manifests in base rpc error: code = Unknown desc = 'kustomize build' (my_git_repo) --enable_alpha_plugins' failed exit status 1: Error: unknown flag: --enable-alpha-plugins