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

Explicit Pattern to validate Duration fields #1690

Conversation

2uasimojo
Copy link
Member

@2uasimojo 2uasimojo commented Feb 15, 2022

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:

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

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
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 15, 2022
@codecov
Copy link

codecov bot commented Feb 15, 2022

Codecov Report

Merging #1690 (8bec000) into ocm-2.4 (672cfe7) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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           
Impacted Files Coverage Δ
.../openshift/hive/apis/hive/v1/clusterclaim_types.go 100.00% <ø> (ø)
...shift/hive/apis/hive/v1/clusterdeployment_types.go 100.00% <ø> (ø)
...m/openshift/hive/apis/hive/v1/clusterpool_types.go 100.00% <ø> (ø)

@2uasimojo
Copy link
Member Author

/retest

@2uasimojo
Copy link
Member Author

/assign @abutcher

@abutcher
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 15, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 15, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 7048523 into openshift:ocm-2.4 Feb 15, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 15, 2022

@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.

@2uasimojo 2uasimojo deleted the HIVE-1760/backport-duration-regex branch February 16, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants