Commit Graph

22 Commits

Author SHA1 Message Date
Stefan Prodan 3090eff734
Refactor: Acquire artifacts with `fluxcd/pkg/http/fetch`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-10 15:30:58 +03:00
Stefan Prodan 06e91e047b
Refactor: Use impersonation from `fluxcd/pkg/runtime/client`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-07 17:36:41 +03:00
Stefan Prodan 06ce60f7bf
Refactor: Extract decrytor to internal package
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-10-06 19:45:12 +03:00
Somtochi Onyekwere 2ac475ebef sops/gcpkms: add key source implementation
This adds a SOPS GCP KMS key source which makes use of the latest GCP
client, and supports both injection of master key credentials and a
default client making use of environmental runtime values.

The implementation fully replaces SOPS', and is covered with
compatability tests.

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-05-24 21:51:46 +02:00
Sanskar Jaiswal 1ee85e5988 add and update tests for awskms and hcvault
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-19 14:34:16 +05:30
Sanskar Jaiswal 53aded2596 add support for AWS KMS credentials using .spec.decryption
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
2022-05-19 14:33:22 +05:30
Hidde Beydals 3f9999b9ee
Merge pull request #615 from nstogner/secret-ref-key 2022-04-29 20:23:53 +02:00
Nick Stogner 6aeff8c924 Support defining a KubeConfig Secret data key
Signed-off-by: Nick Stogner <nicholas.stogner@gmail.com>
2022-04-29 10:04:14 -04:00
Hidde Beydals 36df540a5d decryptor: detect format of Secret data field
This checks the base64 decoded bytes from a Secret field for any of the
marker bytes, thereby allowing data to be encrypted into any format.
Instead of the previous behavior which assumed it to either be YAML or
JSON.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-29 15:26:36 +02:00
Hidde Beydals a7639c68d3 decryptor: detect DockerConfigJsonKey as JSON out
This ensures the Secret field gets formatted back into JSON, instead of
it being detected as binary output.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-29 11:00:44 +02:00
Steven E. Harris e6beca11b1
Confirm format detection of file sources via tests
Signed-off-by: Steven E. Harris <seh@panix.com>
2022-04-26 11:07:17 -04:00
Steven E. Harris ee0e4c1674
Remove invalid "EnvSources" entry from test case
Signed-off-by: Steven E. Harris <seh@panix.com>
2022-04-26 11:07:17 -04:00
Hidde Beydals 105ebd9f47 controllers: improve decryptor and add tests
- Refactored recursion while iterating over Kustomization files.
  References of files that have been visited are cached, and not
  visited again. In addition, symlinks are confirmed to not traverse
  outside the working directory.
- Optimized various bits around (un)marshalling (encrypted) data, and
  YAML -> JSON -> YAML roundtrips are prevented where not required.
- Added support for decrypting INI Kustomize EnvSource references using
  the dedicated SOPS store for the format.
- Introduced support for decrypting Kustomize FileSources:
  https://pkg.go.dev/sigs.k8s.io/kustomize@v1.0.2/pkg/types#DataSources

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-14 09:17:43 +02:00
Hidde Beydals 855d57c491 Use new standardized meta and runtime pkgs
This includes an update of the source-controller to v0.22.0, to pull in
the v1beta2 API which makes use of the same packages.

Co-authored-by: Sunny <darkowlzz@protonmail.com>
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-18 12:04:39 +01:00
Stefan Prodan 4ee01a2db0
Fix preflight validation
Validate that the resources built with kustomize conform to the Kubernetes API conventions before passing them to the server-side apply engine.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-21 13:05:40 +02:00
Soule BA c579e71430
add native support for sops decryption/encryption with Vault
If implemented, the kustomize controller will be able to retrieve a
secret containing a VAULT TOKEN and use it to decrypt the sops encrypted
master key. It will then use it to decrypt the data key and finally use the data
key to decrypt the final data.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-01-19 21:59:10 +01:00
Stefan Prodan bedb53e0fa
Verify artifacts integrity
After downloading an artifact, compute its checksum and verify that it matches the original checksum advertised by source-controller.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-12 14:03:58 +02:00
Rishabh Bohra b8cebd3838
chore: remove deprecated io/ioutil
Signed-off-by: Rishabh Bohra <rishabhbohra01@gmail.com>
2021-10-29 20:28:25 +05:30
Somtochi Onyekwere 84a88d5878 Decrypt dotenv files
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-10-17 15:27:04 +01:00
Stefan Prodan a292f28699
Fix drift detection in Secrets and ConfigMaps
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-11 16:26:01 +03:00
Stefan Prodan 1e01d800c5
Implement reconciliation using server-side apply
Reconciler behaviour:
- Creates an inventory of objects to be applied (persisted in-cluster under `.status.inventory`).
- Applies first custom resource definitions (CRDs) and namespaces, waits for them to register and only then applies the custom resources.
- Validates all resources with server-side dry-run apply (namespaced objects must contain `metadata.namespace`, defaulting to the `default` namespace is no longer supported).
- Reconciles only the resources that drifted.
- Prunes the objects that were previously applied but are missing from the current inventory.
- Emits events for only the resources that where created, configured or deleted.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-30 18:34:40 +03:00
Stefan Prodan 14329c6fa0
Refactor tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-09-10 16:51:22 +03:00