-
Notifications
You must be signed in to change notification settings - Fork 300
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
Cleanup: Use ResourceFlavor.metadata.labels #353
Cleanup: Use ResourceFlavor.metadata.labels #353
Conversation
Hi @thisisprasad. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: thisisprasad 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 |
/assign @alculquicondor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the validation code just works without changes?
// labels associated with this flavor. They are matched against or | ||
// converted to node affinity constraints on the workload’s pods. | ||
// For example, cloud.provider.com/accelerator: nvidia-tesla-k80. | ||
// More info: http://kubernetes.io/docs/user-guide/labels | ||
// | ||
// labels can be up to 8 elements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can something similar be added above ObjectMeta? Would that be included in the CRD yaml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding single or multi-line comment does not generate description for ObjectMeta in CRD yaml using make manifests
command.
metav1.ObjectMeta
struct is embedded inside ResourceFlavor struct. It's not a separate field defined. Don't know of any other way to add for .metadata.labels
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. That's fine then.
@@ -68,7 +69,7 @@ var _ = ginkgo.Describe("ResourceFlavor Webhook", func() { | |||
resourceFlavor := testing.MakeResourceFlavor("resource-flavor").Label("foo", "@abcd").Obj() | |||
err := k8sClient.Create(ctx, resourceFlavor) | |||
gomega.Expect(err).Should(gomega.HaveOccurred()) | |||
gomega.Expect(errors.IsForbidden(err)).Should(gomega.BeTrue(), "error: %v", err) | |||
gomega.Expect(err.Error()).To(gomega.ContainSubstring(errorInvalidLabelValue("@abcd"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error returned is not of type forbidden. Hence, added the error substring. Any other way to assert the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should be an error type that matches in the package.
The substrings could change upstream, so I rather not pay attention to that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably errors.IsBadRequest
@@ -92,7 +93,11 @@ var _ = ginkgo.Describe("ResourceFlavor Webhook", func() { | |||
ginkgo.By("Updating the resourceFlavor with invalid labels") | |||
err := k8sClient.Update(ctx, &created) | |||
gomega.Expect(err).Should(gomega.HaveOccurred()) | |||
gomega.Expect(errors.IsForbidden(err)).Should(gomega.BeTrue(), "error: %v", err) | |||
gomega.Expect(err.Error()).To(gomega.ContainSubstring(errorInvalidLabelValue("@abcd"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
/ok-to-test |
Actually, I think you need to update the validation code to have the proper path for "too many labels" |
I created #355 to accelerate the process, so that we can release today. I kept your name on the commit :) /close |
@alculquicondor: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
ResourceFlavor's
.labels
field is removed. Now users can specify the labels in.metadata.labels
.Which issue(s) this PR fixes:
Fixes #334
Special notes for your reviewer: