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

Improve SecretManager Secret TTL #3395

Open
3 tasks done
yuwenma opened this issue Dec 16, 2024 · 0 comments
Open
3 tasks done

Improve SecretManager Secret TTL #3395

yuwenma opened this issue Dec 16, 2024 · 0 comments

Comments

@yuwenma
Copy link
Collaborator

yuwenma commented Dec 16, 2024

Checklist

  • I did not find a related open enhancement request.
  • I understand that enhancement requests filed in the GitHub repository are by default low priority.
  • If this request is time-sensitive, I have submitted a corresponding issue with GCP support.

Describe the feature or resource

Problem

SecretManager Secret has a configurable TTL field, which defines the time-to-live for a Secret from its last update time. However, this implementation can cause inconsistencies and drift between the Secret's state in Config Connector and the actual GCP service.

Screenshot 2024-12-16 at 12 03 33 PM

Current Behavior

  • TTL is based on the Secret creation in the GCP. It does not count the created/updated time in Config Connector.
  • Changing an existing Secret TTL won't reset its TTL to the new update time (different from gcloud)
  • Changing another Secret field won't trigger a TTL reset also (different from gcloud)

Proposed solutions

While TTL is generally discouraged for managing time-based permissions in Secret Manager (IAM Conditions are recommended), we need to address the existing ttl functionality to ensure consistency and avoid unexpected behavior. Here are some options:

Option 1: Introduce initTTL

Rename the existing ttl field to initTTL to clarify that it only applies during initial Secret creation.
This improves API readability and avoids ambiguity, but it limits the functionality of the TTL feature and requires an API change (which might be reserved for a major version update).

Option 2: Deprecate ttl

Mark the ttl field as deprecated and emit errors if it's configured.
This solution encourages users to adopt IAM Conditions for time-based permissions and prevents further issues with TTL drift (users can still use the spec.expireTime). However, it could potentially break existing users who rely on the current (albeit flawed) TTL behavior.

Option 3: "Reset" TTL on All Updates

Modify the Config Connector implementation to "reset" the TTL timer whenever the Secret is created or updated in GCP.
This aligns the behavior most closely with the GCP service and gcloud, but it might not be the most intuitive behavior for a declarative configuration tool. Users might not expect that changing unrelated fields will also reset the TTL.

Decision

We need to carefully weigh the pros and cons of each option and consider the potential impact on existing users. We will update this issue. Please share your thoughts and the use of this resource.

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

No branches or pull requests

1 participant