bitnami-labs / sealed-secrets

A Kubernetes controller and tool for one-way encrypted Secrets
Apache License 2.0
7.72k stars 685 forks source link

kubeseal is creating an empty file #1560

Closed Barsonax closed 2 months ago

Barsonax commented 4 months ago

Which component: kubeseal 0.27.0

Describe the bug kubeseal is creating an empty file with no contents

To Reproduce

  1. Run kubectl create secret generic mysecret --dry-run=client --from-literal=username=admin -o json > mysecret.json
  2. Run kubeseal -f mysecret.json -w mysealedsecret.json
  3. mysealedsecret.json will be empty

Expected behavior Content in the file

Version of Kubernetes:

Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.6+k3s1

Additional context This is on windows 11 (Version 10.0.22631 Build 22631)

kubeseal with --raw does produce output

dekayQ commented 4 months ago

@Barsonax I encountered the same issue and resolved it by changing the encoding of the created secret to UTF-8. I also had a similar problem with the fetched certificate, which wasn't encoded in UTF-8 either.

Barsonax commented 4 months ago

Yeah that seems to fix the problem. So changing step 1 to this will make it work (using powershell):

kubectl create secret generic mysecret --dry-run=client --from-literal=username=admin -o json | Out-File -Encoding "UTF8" "mysecret.json"

If its not easy to fix this in kubeseal I think it would be fine if kubeseal just gave a descriptive error telling you the encoding needs to be UTF8.

github-actions[bot] commented 3 months ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

Barsonax commented 3 months ago

Bump

github-actions[bot] commented 3 months ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 2 months ago

Due to the lack of activity in the last 7 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

Barsonax commented 2 months ago

This shouldn't be closed as it's a real issue that has not been fixed yet

tadeasbronis commented 1 month ago

This is nor resolved. At least some error message would be helpful

alemorcuq commented 1 month ago

@Barsonax @tadeasbronis I created a PR #1580, but it needs to be merged.