Skip to content

[WIP] Added quantity format #540

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sreeram-venkitesh
Copy link
Member

Part of kubernetes/kubernetes#130639 and along the same lines of #526.

I tested this locally but I'm not sure if we should add k8s.io/apimachinery in vendor here.

I have a corresponding PR in k/k which I'm opening along with these changes. Would love to hear some feedback.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sreeram-venkitesh
Once this PR has been reviewed and has the lgtm label, please assign liggitt for approval. For more information see the 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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 26, 2025
@k8s-ci-robot k8s-ci-robot requested review from apelisse and sttts May 26, 2025 17:19
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 26, 2025
@sreeram-venkitesh sreeram-venkitesh changed the title Added quantity format [WIP] Added quantity format May 26, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 26, 2025
@sreeram-venkitesh sreeram-venkitesh marked this pull request as draft May 26, 2025 17:39
@sreeram-venkitesh sreeram-venkitesh marked this pull request as ready for review May 30, 2025 18:10
@cici37
Copy link
Contributor

cici37 commented Jun 11, 2025

I think the introduction of "k8s.io/apimachinery/pkg/api/resource" import here would cause loop dependency issue later which we may wanna avoid.

@sreeram-venkitesh
Copy link
Member Author

@cici37 Yes I was wondering the same. In order to use resource.ParseQuantity() here, does it make sense to copy over the logic from k8s.io/apimachinery/pkg/api/resource here?

package strfmt

import (
"k8s.io/apimachinery/pkg/api/resource"
Copy link
Member

@liggitt liggitt Jun 11, 2025

Choose a reason for hiding this comment

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

Unfortunately, this repo cannot depend on anything published out of kubernetes/kubernetes/staging, like k8s.io/apimachinery. We can't allow cycles between vendored dependencies used within kubernetes/kubernetes and things published out of kubernetes/kubernetes/staging.

(I haven't read the rest of the PR or the context, just followed the link to this from the apimachinery agenda meeting, but wanted to let you know this import isn't going to work before you got too far down this road)


func init() {
quantity := Quantity("")
Default.Add("quantity", &quantity, isQuantity)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this type definition / registration could be done from outside kube-openapi, e.g. defined in kubernetes/kubernetes or apiextensions-apiserver and then registered

If so, that would avoid the kube-openapi → k8s.io/apimachinery dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants