-
Notifications
You must be signed in to change notification settings - Fork 237
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
Explicit Pattern to validate Duration fields #1690
Explicit Pattern to validate Duration fields #1690
Conversation
Due to a difference in how apiserver validates `Format=duration` vs how apimachinery unmarshals `metav1.Duration`, using that format can allow users to blow up some of our controllers if they provide certain values for Duration fields (specifically: containing `d` or `w` units). Upstream issues have been opened against both sides of this discrepancy: - kubernetes/apimachinery#131 - kubernetes/apiextensions-apiserver#56 In the meantime, work around the problem by using an explicit regex instead of the built in format validator. (cherry picked from commit 665b268) Conflicts: apis/hive/v1/clusterpool_types.go config/crds/hive.openshift.io_clusterpools.yaml hack/app-sre/saas-template.yaml vendor/github.com/openshift/hive/apis/hive/v1/clusterpool_types.go These were due to the ResumeTimeout field added to ClusterPool since 2.4. HIVE-1760
Codecov Report
@@ Coverage Diff @@
## ocm-2.4 #1690 +/- ##
========================================
Coverage 41.60% 41.60%
========================================
Files 336 336
Lines 30636 30636
========================================
Hits 12745 12745
Misses 16805 16805
Partials 1086 1086
|
/retest |
/assign @abutcher |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 2uasimojo, abutcher The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@2uasimojo: all tests passed! Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Due to a difference in how apiserver validates
Format=duration
vs howapimachinery unmarshals
metav1.Duration
, using that format can allowusers to blow up some of our controllers if they provide certain values
for Duration fields (specifically: containing
d
orw
units).Upstream issues have been opened against both sides of this discrepancy:
d
,w
; conflicts with kubebuilderformat=duration
validation kubernetes/apimachinery#131format=duration
kubebuilder validation acceptsd
,w
; metav1.Duration does not kubernetes/apiextensions-apiserver#56In the meantime, work around the problem by using an explicit regex
instead of the built in format validator.
(cherry picked from commit 665b268)
Conflicts:
apis/hive/v1/clusterpool_types.go
config/crds/hive.openshift.io_clusterpools.yaml
hack/app-sre/saas-template.yaml
vendor/github.com/openshift/hive/apis/hive/v1/clusterpool_types.go
These were due to the ResumeTimeout field added to ClusterPool since
2.4.
HIVE-1760