Skip to content
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

gcpkms: update SDK to latest, add tests, tidy #1072

Merged
merged 1 commit into from
Jul 12, 2022
Merged

gcpkms: update SDK to latest, add tests, tidy #1072

merged 1 commit into from
Jul 12, 2022

Conversation

hiddeco
Copy link
Member

@hiddeco hiddeco commented Jun 7, 2022

This PR updates the GCP KMS client to latest, adds more extensive test
coverage, and general tidying of bits of code.

The improvements are based on a fork of the key source in the Flux
project's kustomize-controller, built due to SOPS' limitation around
credential management without relying on runtime environment variables.

  • Updates the deprecated google.golang.org/api/cloudkms/v1 to
    cloud.google.com/go/kms/apiv1.
  • It introduces a CredentialJSON type which holds a Service Account
    credential file, and can be applied to the MasterKey.
    When applied, the provided credentials are used in the GCP KMS
    service client configuration, instead of relying on
    GOOGLE_CREDENTIALS, or the default client environment variables.
    This is most useful when working with SOPS as an SDK, in combination
    with e.g. a local key service server implementation.
  • Test coverage.

The forked version of this has compatability (and integration) tests to
ensure it works with current SOPS:

gcpkms/keysource.go Outdated Show resolved Hide resolved
This updates the GCP KMS client to latest, adds more extensive test
coverage, and general tidying of bits of code.
The improvements are based on a fork of the key source in the Flux
project's kustomize-controller, built due to SOPS' limitation around
credential management without relying on runtime environment variables.

- Updates the deprecated `google.golang.org/api/cloudkms/v1` to
  `cloud.google.com/go/kms/apiv1`.
- It introduces a `CredentialJSON` type which holds a Service Account
  credential file, and can be applied to the `MasterKey`.
  When applied, the provided credentials are used in the GCP KMS
  service client configuration, instead of relying on
  `GOOGLE_CREDENTIALS`, or the default client environment variables.
  This is most useful when working with SOPS as an SDK, in combination
  with e.g. a local key service server implementation.
- Test coverage.

The forked version of this has compatability (and integration) tests to
ensure it works with current SOPS:

- https://github.com/fluxcd/kustomize-controller/blob/cbb0fc9df5da12a54cf998392dbd80d28522def5/internal/sops/gcpkms/keysource_integration_test.go#L39
- https://github.com/fluxcd/kustomize-controller/blob/cbb0fc9df5da12a54cf998392dbd80d28522def5/internal/sops/gcpkms/keysource_integration_test.go#L59

Co-authored-by: Somtochi Onyekwere <[email protected]>
Signed-off-by: Hidde Beydals <[email protected]>
@hiddeco hiddeco marked this pull request as ready for review July 4, 2022 20:24
@hiddeco hiddeco requested a review from ajvb July 4, 2022 20:35
@hiddeco hiddeco mentioned this pull request Jul 6, 2022
@ajvb ajvb merged commit 5448b42 into getsops:develop Jul 12, 2022
@hiddeco hiddeco deleted the gcpkms-keysource-imprv branch July 13, 2022 15:31
@hiddeco hiddeco added this to the v3.8.0 milestone Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants