-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #189: allows secret generation from literals #236
base: master
Are you sure you want to change the base?
Conversation
Anything missing for someone to review this PR? |
@JoelDimbernat just forgot to assign me 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing! Code looks good to me, but
- What is the motivation/use-case for this?
- Can you add documentation to the README
Hello @blinkeye does this fix your problem? |
Hello, Here a kustomize.yaml without ksops: apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
secretGenerator:
- name: cloudnative-pg-s3
literals:
- ACCESS_KEY_ID=yyyyyyyyyyyyyyyyyyyy
- ACCESS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
generatorOptions:
labels:
app: frankenphp
annotations:
argocd.argoproj.io/sync-wave: '0' And with ksops and literals support kustomize.yaml file: apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
generators:
- sops-secret-generator.yaml and of course apiVersion: viaduct.ai/v1
kind: ksops
metadata:
name: ksops-secret-from-generator
annotations:
config.kubernetes.io/function: "exec:\n # if the binary is your PATH, you can do \n path: ksops\n # otherwise, path should be relative to manifest files, like\n # path: ../../../ksops\n"
secretFrom:
- metadata:
name: cloudnative-pg-s3
annotations:
argocd.argoproj.io/sync-wave: '0'
labels:
app: frankenphp
literals:
- ENC[AES256_GCM,data:koqsnfF4DJs1q5tmnEQhZN3YMZ5SPVSZfn6/DcoT6Nhyyw==,iv:70Io/WBio9EgjdKCHmW2MDILfoc7pZHlQWkzDhKoBhw=,tag:Jnj7H6ClJhwmFuDdRGw5KA==,type:str]
- ENC[AES256_GCM,data:4c5PLLjChVXcR8eMMa+SG+HogafhQp8Q89iS4OJs1NhbqEpHbe57vZPtNqNNLkD4yxw=,iv:fN/3ylxK3aKhwIMvUuCWXL/BkJmwhIQ98htEXU8EH7M=,tag:u0c7zdvPife7XpYvPCJNXQ==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1z9zm8evxf6yczcyc976srtjvhsxpxhme6w94jmurdnx7a38a3f9q3ywu2d
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBEVE5xbERaaWJiemhoNEVj
NkFXNUdMc3lhdEpWOGk3NWswYnVvSmhxUkRjCkJFVVNpbExrYzdLL0VlakhwR0xX
S2h0SVZiVmp2MWh2NXFrbVRuRUNlMTQKLS0tIHVYQ3NDNm1PN3I5Z2laS2NYem9K
c3JCcUxEcGpxanowWjc0djJyaGYvQlUKFgnuyZPyLjemfnFA8Z8eqBAtAbjN21fS
vIHrqEu1dCoGWsxEBg9lbo11rR4MToLRElcw6SAuyRFR8KVdDUHZag==
-----END AGE ENCRYPTED FILE-----
lastmodified: '2024-10-17T17:09:16Z'
mac: ENC[AES256_GCM,data:t1CyTgqyRIc2mBAb8DhYNDKXEUjL1Us8hbPLIMLrUQsWqspHEN1kDjUck4aRTYveyfsoMFk5exQD+owKXiOtLGMybBe3UhIeQu/Bwh1c7ZfqWmgy92Z0TrCpO9XWCEj8FfVDr954ryEsmtJQO+KrqHtj5KPlkkIs93KdSiKIInc=,iv:dC02lVAokp63qcxaOMMM+at9GMvYCfFaonqbA++Zook=,tag:mKEnTDscJ9Hi4kKxamw9vQ==,type:str]
pgp: []
unencrypted_regex: ^(apiVersion|metadata|kind|type)$
version: 3.9.1 I have tried with current version of ksops (v4.3.2), I don't have any error but Secret does not contain ACCESS_KEY_ID and ACCESS_SECRET_KEY: apiVersion: v1
kind: Secret
metadata:
name: cloudnative-pg-s3
namespace: default
labels:
app: frankenphp
argocd.argoproj.io/instance: frankenphp
annotations:
argocd.argoproj.io/sync-wave: '0'
type: Opaque |
Is it something that could be merged ? |
@devstein is it something that could be merged ? |
Hi @albundy83 I'll take a look this weekend. Yes feel free to create a separate PR, thanks. @JoelDimbernat doesn't appear to be active |
I have tried again but now, all I have is is this error:
I don't understand how I achieve to make it works once ... :( |
I think the code can't work like this as others functions are decrypting from file and not directly from the current file. |
Fixes #189