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

[ENHANCEMENT] Add Kubernetes-compatible annotations for model.Duration fields #2360

Conversation

ibakshay
Copy link
Contributor

@ibakshay ibakshay commented Oct 21, 2024

Description

This PR adds Kubernetes-compatible annotations to fields of type model.Duration in the imported library for Kubernetes spec fields. The following annotations are added to relevant fields:

// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Format=duration

These annotations ensure that model.Duration fields are treated as strings with a duration format, resolving conflicts between the custom JSON serialization in prometheus/common and Kubernetes API expectations. This fix addresses validation errors in the Perses controller when updating Perses resources.

This change ensures compatibility between the Perses and Perses Operator.

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

…tion fields

Signed-off-by: Akshay Iyyadurai Balasundaram <[email protected]>
@celian-garcia
Copy link
Member

Hello I have not much idea on how these annotation works but do you think it could be added directly in the prometheus model? This is what we are using.
https://github.com/prometheus/common/blob/653e0fa37b474f7af331bbfb409c0f654fb04a94/model/time.go#L171

@ibakshay
Copy link
Contributor Author

ibakshay commented Oct 21, 2024

Hello I have not much idea on how these annotation works but do you think it could be added directly in the prometheus model? This is what we are using. https://github.com/prometheus/common/blob/653e0fa37b474f7af331bbfb409c0f654fb04a94/model/time.go#L171

Thanks a lot for the pointer, @celian-garcia.
I have created a PR in prometheus/common repository .
Here is the link prometheus/common#708.
So, We can close this PR.

@ibakshay ibakshay closed this Oct 21, 2024
@ibakshay ibakshay reopened this Oct 21, 2024
@ibakshay ibakshay closed this Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants