Skip to content

Commit e57b11b

Browse files
authored
Move Budget settings to new BudgetDetails struct (#3695)
Signed-off-by: Nick Young <[email protected]>
1 parent e68481c commit e57b11b

File tree

9 files changed

+232
-105
lines changed

9 files changed

+232
-105
lines changed

apisx/v1alpha1/xbackendtrafficpolicy_types.go

+29-18
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,11 @@ type BackendTrafficPolicySpec struct {
119119

120120
// RetryConstraint defines the configuration for when to retry a request.
121121
type RetryConstraint struct {
122-
// BudgetPercent defines the maximum percentage of active requests that may
123-
// be made up of retries.
124-
//
125-
// Support: Extended
126-
//
127-
// +optional
128-
// +kubebuilder:default=20
129-
// +kubebuilder:validation:Minimum=0
130-
// +kubebuilder:validation:Maximum=100
131-
BudgetPercent *int `json:"budgetPercent,omitempty"`
132-
133-
// BudgetInterval defines the duration in which requests will be considered
134-
// for calculating the budget for retries.
135-
//
136-
// Support: Extended
122+
// Budget holds the details of the retry budget configuration.
137123
//
138124
// +optional
139-
// +kubebuilder:default="10s"
140-
// +kubebuilder:validation:XValidation:message="budgetInterval can not be greater than one hour or less than one second",rule="!(duration(self) < duration('1s') || duration(self) > duration('1h'))"
141-
BudgetInterval *Duration `json:"budgetInterval,omitempty"`
125+
// +kubebuilder:default={percent: 20, interval: "10s"}
126+
Budget *BudgetDetails `json:"budget,omitempty"`
142127

143128
// MinRetryRate defines the minimum rate of retries that will be allowable
144129
// over a specified duration of time.
@@ -157,3 +142,29 @@ type RetryConstraint struct {
157142
// +kubebuilder:default={count: 10, interval: "1s"}
158143
MinRetryRate *RequestRate `json:"minRetryRate,omitempty"`
159144
}
145+
146+
// BudgetDetails specifies the details of the budget configuration, like
147+
// the percentage of requests in the budget, and the interval between
148+
// checks.
149+
type BudgetDetails struct {
150+
// BudgetPercent defines the maximum percentage of active requests that may
151+
// be made up of retries.
152+
//
153+
// Support: Extended
154+
//
155+
// +optional
156+
// +kubebuilder:default=20
157+
// +kubebuilder:validation:Minimum=0
158+
// +kubebuilder:validation:Maximum=100
159+
Percent *int `json:"percent,omitempty"`
160+
161+
// BudgetInterval defines the duration in which requests will be considered
162+
// for calculating the budget for retries.
163+
//
164+
// Support: Extended
165+
//
166+
// +optional
167+
// +kubebuilder:default="10s"
168+
// +kubebuilder:validation:XValidation:message="budgetInterval can not be greater than one hour or less than one second",rule="!(duration(self) < duration('1s') || duration(self) > duration('1h'))"
169+
Interval *Duration `json:"interval,omitempty"`
170+
}

apisx/v1alpha1/zz_generated.deepcopy.go

+29-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfiguration/apisx/v1alpha1/budgetdetails.go

+52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfiguration/apisx/v1alpha1/retryconstraint.go

+6-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfiguration/internal/internal.go

+11-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfiguration/utils.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/experimental/gateway.networking.x-k8s.io_xbackendtrafficpolicies.yaml

+29-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/generated/openapi/zz_generated.openapi.go

+32-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)