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

feat: SecretManagerSecret full test coverage & manual replication field #3371

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

yuwenma
Copy link
Collaborator

@yuwenma yuwenma commented Dec 12, 2024

Improve SecretManager with full test coverage.
2nd git-commit is real gcp
3rd git-commit is mockgcp

@yuwenma yuwenma changed the title feat: add SecretManager manual replication feature feat: SecretManagerSecret full test coverage & manual replication field Dec 12, 2024
@@ -48,8 +48,7 @@ type SecretManagerSecretSpec struct {
// This is always provided on output, regardless of what was sent on input.
ExpireTime *string `json:"expireTime,omitempty"`

// Input only. The TTL for the
// [Secret][google.cloud.secretmanager.v1.Secret].
// Input only. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
Copy link
Collaborator Author

@yuwenma yuwenma Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TTL is a stale field that causes customers issues: it uses "Now()" when the resource is created that users cannot control or predict.
But since this is already in Beta, we still add the test coverage for it.

Also this change improves the user experience a little bit otherwise they don't now what value to give.

@@ -26,7 +26,7 @@ if [[ -z "${KUBEBUILDER_ASSETS:-}" ]]; then
fi

if [[ -z "${KCC_USE_DIRECT_RECONCILERS:-}" ]]; then
KCC_USE_DIRECT_RECONCILERS=ComputeForwardingRule,GKEHubFeatureMembership,SecretManagerSecret,SecretManagerSecretVersion
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test now covers both legacy controller and direct controller (via alpha direct annotation). we no longer need this

if secret.Spec.Replication.UserManaged != nil {
for _, r := range secret.Spec.Replication.UserManaged.Replicas {
if r.CustomerManagedEncryption != nil {
kmsKeyRef := r.CustomerManagedEncryption.KmsKeyRef
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I previously missed this field because I thought it is another field spec.customerManagedEncryption, which is not supported yet in the current released beta API.

Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from justinsb. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@yuwenma yuwenma force-pushed the secret-manager-wip branch 2 times, most recently from 08c7091 to 5aa4c54 Compare December 12, 2024 06:36
@yuwenma yuwenma force-pushed the secret-manager-wip branch 4 times, most recently from 16438ad to c827a86 Compare December 12, 2024 07:34
@jasonvigil
Copy link
Collaborator

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants