mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: update all k8s packages to 0.27.2
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
07b05616a0
commit
2551a0b05f
2
vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go
generated
vendored
2
vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go
generated
vendored
@ -1026,7 +1026,7 @@ func (cfgCtlr *configController) startRequest(ctx context.Context, rd RequestDig
|
||||
noteFn(selectedFlowSchema, plState.pl, flowDistinguisher)
|
||||
workEstimate := workEstimator()
|
||||
|
||||
startWaitingTime = time.Now()
|
||||
startWaitingTime = cfgCtlr.clock.Now()
|
||||
klog.V(7).Infof("startRequest(%#+v) => fsName=%q, distMethod=%#+v, plName=%q, numQueues=%d", rd, selectedFlowSchema.Name, selectedFlowSchema.Spec.DistinguisherMethod, plName, numQueues)
|
||||
req, idle := plState.queues.StartRequest(ctx, &workEstimate, hashValue, flowDistinguisher, selectedFlowSchema.Name, rd.RequestInfo, rd.User, queueNoteFn)
|
||||
if idle {
|
||||
|
56
vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller_debug.go
generated
vendored
56
vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller_debug.go
generated
vendored
@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
@ -50,16 +51,30 @@ func (cfgCtlr *configController) dumpPriorityLevels(w http.ResponseWriter, r *ht
|
||||
defer cfgCtlr.lock.Unlock()
|
||||
tabWriter := tabwriter.NewWriter(w, 8, 0, 1, ' ', 0)
|
||||
columnHeaders := []string{
|
||||
"PriorityLevelName", // 1
|
||||
"ActiveQueues", // 2
|
||||
"IsIdle", // 3
|
||||
"IsQuiescing", // 4
|
||||
"WaitingRequests", // 5
|
||||
"ExecutingRequests", // 6
|
||||
"PriorityLevelName", // 1
|
||||
"ActiveQueues", // 2
|
||||
"IsIdle", // 3
|
||||
"IsQuiescing", // 4
|
||||
"WaitingRequests", // 5
|
||||
"ExecutingRequests", // 6
|
||||
"DispatchedRequests", // 7
|
||||
"RejectedRequests", // 8
|
||||
"TimedoutRequests", // 9
|
||||
"CancelledRequests", // 10
|
||||
}
|
||||
tabPrint(tabWriter, rowForHeaders(columnHeaders))
|
||||
endLine(tabWriter)
|
||||
for _, plState := range cfgCtlr.priorityLevelStates {
|
||||
plNames := make([]string, 0, len(cfgCtlr.priorityLevelStates))
|
||||
for plName := range cfgCtlr.priorityLevelStates {
|
||||
plNames = append(plNames, plName)
|
||||
}
|
||||
sort.Strings(plNames)
|
||||
for i := range plNames {
|
||||
plState, ok := cfgCtlr.priorityLevelStates[plNames[i]]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
if plState.queues == nil {
|
||||
tabPrint(tabWriter, row(
|
||||
plState.pl.Name, // 1
|
||||
@ -68,6 +83,10 @@ func (cfgCtlr *configController) dumpPriorityLevels(w http.ResponseWriter, r *ht
|
||||
"<none>", // 4
|
||||
"<none>", // 5
|
||||
"<none>", // 6
|
||||
"<none>", // 7
|
||||
"<none>", // 8
|
||||
"<none>", // 9
|
||||
"<none>", // 10
|
||||
))
|
||||
endLine(tabWriter)
|
||||
continue
|
||||
@ -81,12 +100,16 @@ func (cfgCtlr *configController) dumpPriorityLevels(w http.ResponseWriter, r *ht
|
||||
}
|
||||
|
||||
tabPrint(tabWriter, rowForPriorityLevel(
|
||||
plState.pl.Name, // 1
|
||||
activeQueueNum, // 2
|
||||
plState.queues.IsIdle(), // 3
|
||||
plState.quiescing, // 4
|
||||
queueSetDigest.Waiting, // 5
|
||||
queueSetDigest.Executing, // 6
|
||||
plState.pl.Name, // 1
|
||||
activeQueueNum, // 2
|
||||
plState.queues.IsIdle(), // 3
|
||||
plState.quiescing, // 4
|
||||
queueSetDigest.Waiting, // 5
|
||||
queueSetDigest.Executing, // 6
|
||||
queueSetDigest.Dispatched, // 7
|
||||
queueSetDigest.Rejected, // 8
|
||||
queueSetDigest.Timedout, // 9
|
||||
queueSetDigest.Cancelled, // 10
|
||||
))
|
||||
endLine(tabWriter)
|
||||
}
|
||||
@ -236,7 +259,8 @@ func rowForHeaders(headers []string) string {
|
||||
return row(headers...)
|
||||
}
|
||||
|
||||
func rowForPriorityLevel(plName string, activeQueues int, isIdle, isQuiescing bool, waitingRequests, executingRequests int) string {
|
||||
func rowForPriorityLevel(plName string, activeQueues int, isIdle, isQuiescing bool, waitingRequests, executingRequests int,
|
||||
dispatchedReqeusts, rejectedRequests, timedoutRequests, cancelledRequests int) string {
|
||||
return row(
|
||||
plName,
|
||||
strconv.Itoa(activeQueues),
|
||||
@ -244,6 +268,10 @@ func rowForPriorityLevel(plName string, activeQueues int, isIdle, isQuiescing bo
|
||||
strconv.FormatBool(isQuiescing),
|
||||
strconv.Itoa(waitingRequests),
|
||||
strconv.Itoa(executingRequests),
|
||||
strconv.Itoa(dispatchedReqeusts),
|
||||
strconv.Itoa(rejectedRequests),
|
||||
strconv.Itoa(timedoutRequests),
|
||||
strconv.Itoa(cancelledRequests),
|
||||
)
|
||||
}
|
||||
|
||||
|
17
vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_filter.go
generated
vendored
17
vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_filter.go
generated
vendored
@ -21,6 +21,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
endpointsrequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/server/httplog"
|
||||
"k8s.io/apiserver/pkg/server/mux"
|
||||
fq "k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing"
|
||||
@ -161,7 +162,7 @@ func (cfgCtlr *configController) Handle(ctx context.Context, requestDigest Reque
|
||||
queued := startWaitingTime != time.Time{}
|
||||
if req == nil {
|
||||
if queued {
|
||||
metrics.ObserveWaitingDuration(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), time.Since(startWaitingTime))
|
||||
observeQueueWaitTime(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), cfgCtlr.clock.Since(startWaitingTime))
|
||||
}
|
||||
klog.V(7).Infof("Handle(%#+v) => fsName=%q, distMethod=%#+v, plName=%q, isExempt=%v, reject", requestDigest, fs.Name, fs.Spec.DistinguisherMethod, pl.Name, isExempt)
|
||||
return
|
||||
@ -178,20 +179,26 @@ func (cfgCtlr *configController) Handle(ctx context.Context, requestDigest Reque
|
||||
}()
|
||||
idle = req.Finish(func() {
|
||||
if queued {
|
||||
metrics.ObserveWaitingDuration(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), time.Since(startWaitingTime))
|
||||
observeQueueWaitTime(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), cfgCtlr.clock.Since(startWaitingTime))
|
||||
}
|
||||
metrics.AddDispatch(ctx, pl.Name, fs.Name)
|
||||
fqs.OnRequestDispatched(req)
|
||||
executed = true
|
||||
startExecutionTime := time.Now()
|
||||
startExecutionTime := cfgCtlr.clock.Now()
|
||||
defer func() {
|
||||
executionTime := time.Since(startExecutionTime)
|
||||
executionTime := cfgCtlr.clock.Since(startExecutionTime)
|
||||
httplog.AddKeyValue(ctx, "apf_execution_time", executionTime)
|
||||
metrics.ObserveExecutionDuration(ctx, pl.Name, fs.Name, executionTime)
|
||||
}()
|
||||
execFn()
|
||||
})
|
||||
if queued && !executed {
|
||||
metrics.ObserveWaitingDuration(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), time.Since(startWaitingTime))
|
||||
observeQueueWaitTime(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), cfgCtlr.clock.Since(startWaitingTime))
|
||||
}
|
||||
panicking = false
|
||||
}
|
||||
|
||||
func observeQueueWaitTime(ctx context.Context, priorityLevelName, flowSchemaName, execute string, waitTime time.Duration) {
|
||||
metrics.ObserveWaitingDuration(ctx, priorityLevelName, flowSchemaName, execute, waitTime)
|
||||
endpointsrequest.TrackAPFQueueWaitLatency(ctx, waitTime)
|
||||
}
|
||||
|
11
vendor/k8s.io/apiserver/pkg/util/flowcontrol/conc_alloc.go
generated
vendored
11
vendor/k8s.io/apiserver/pkg/util/flowcontrol/conc_alloc.go
generated
vendored
@ -108,11 +108,12 @@ const epsilon = 0.0000001
|
||||
// if possible otherwise returns an error saying why it is impossible.
|
||||
// `allocs` sums to `requiredSum`.
|
||||
// For each J in [0, len(classes)):
|
||||
// (1) `classes[J].lowerBound <= allocs[J] <= classes[J].upperBound` and
|
||||
// (2) exactly one of the following is true:
|
||||
// (2a) `allocs[J] == fairProp * classes[J].target`,
|
||||
// (2b) `allocs[J] == classes[J].lowerBound && classes[J].lowerBound > fairProp * classes[J].target`, or
|
||||
// (2c) `allocs[J] == classes[J].upperBound && classes[J].upperBound < fairProp * classes[J].target`.
|
||||
// 1. `classes[J].lowerBound <= allocs[J] <= classes[J].upperBound` and
|
||||
// 2. exactly one of the following is true:
|
||||
// 2a. `allocs[J] == fairProp * classes[J].target`,
|
||||
// 2b. `allocs[J] == classes[J].lowerBound && classes[J].lowerBound > fairProp * classes[J].target`, or
|
||||
// 2c. `allocs[J] == classes[J].upperBound && classes[J].upperBound < fairProp * classes[J].target`.
|
||||
//
|
||||
// Each allocProblemItem is required to have `target >= lowerBound >= 0` and `upperBound >= lowerBound`.
|
||||
// A target smaller than MinTarget is treated as if it were MinTarget.
|
||||
func computeConcurrencyAllocation(requiredSum int, classes []allocProblemItem) ([]float64, float64, error) {
|
||||
|
4
vendor/k8s.io/apiserver/pkg/util/flowcontrol/debug/dump.go
generated
vendored
4
vendor/k8s.io/apiserver/pkg/util/flowcontrol/debug/dump.go
generated
vendored
@ -30,6 +30,10 @@ type QueueSetDump struct {
|
||||
Executing int
|
||||
SeatsInUse int
|
||||
SeatsWaiting int
|
||||
Dispatched int
|
||||
Rejected int
|
||||
Timedout int
|
||||
Cancelled int
|
||||
}
|
||||
|
||||
// QueueDump is an instant dump of one queue in a queue-set.
|
||||
|
40
vendor/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go
generated
vendored
40
vendor/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go
generated
vendored
@ -148,6 +148,22 @@ type queueSet struct {
|
||||
|
||||
// enqueues is the number of requests that have ever been enqueued
|
||||
enqueues int
|
||||
|
||||
// totRequestsDispatched is the total number of requests of this
|
||||
// queueSet that have been processed.
|
||||
totRequestsDispatched int
|
||||
|
||||
// totRequestsRejected is the total number of requests of this
|
||||
// queueSet that have been rejected.
|
||||
totRequestsRejected int
|
||||
|
||||
// totRequestsTimedout is the total number of requests of this
|
||||
// queueSet that have been timeouted.
|
||||
totRequestsTimedout int
|
||||
|
||||
// totRequestsCancelled is the total number of requests of this
|
||||
// queueSet that have been cancelled.
|
||||
totRequestsCancelled int
|
||||
}
|
||||
|
||||
// NewQueueSetFactory creates a new QueueSetFactory object
|
||||
@ -304,6 +320,7 @@ func (qs *queueSet) StartRequest(ctx context.Context, workEstimate *fqrequest.Wo
|
||||
if !qs.canAccommodateSeatsLocked(workEstimate.MaxSeats()) {
|
||||
klog.V(5).Infof("QS(%s): rejecting request %q %#+v %#+v because %d seats are asked for, %d seats are in use (%d are executing) and the limit is %d",
|
||||
qs.qCfg.Name, fsName, descr1, descr2, workEstimate, qs.totSeatsInUse, qs.totRequestsExecuting, qs.dCfg.ConcurrencyLimit)
|
||||
qs.totRequestsRejected++
|
||||
metrics.AddReject(ctx, qs.qCfg.Name, fsName, "concurrency-limit")
|
||||
return nil, qs.isIdleLocked()
|
||||
}
|
||||
@ -323,6 +340,7 @@ func (qs *queueSet) StartRequest(ctx context.Context, workEstimate *fqrequest.Wo
|
||||
// concurrency shares and at max queue length already
|
||||
if req == nil {
|
||||
klog.V(5).Infof("QS(%s): rejecting request %q %#+v %#+v due to queue full", qs.qCfg.Name, fsName, descr1, descr2)
|
||||
qs.totRequestsRejected++
|
||||
metrics.AddReject(ctx, qs.qCfg.Name, fsName, "queue-full")
|
||||
return nil, qs.isIdleLocked()
|
||||
}
|
||||
@ -400,6 +418,8 @@ func (req *request) wait() (bool, bool) {
|
||||
switch decisionAny {
|
||||
case decisionReject:
|
||||
klog.V(5).Infof("QS(%s): request %#+v %#+v timed out after being enqueued\n", qs.qCfg.Name, req.descr1, req.descr2)
|
||||
qs.totRequestsRejected++
|
||||
qs.totRequestsTimedout++
|
||||
metrics.AddReject(req.ctx, qs.qCfg.Name, req.fsName, "time-out")
|
||||
return false, qs.isIdleLocked()
|
||||
case decisionCancel:
|
||||
@ -418,6 +438,8 @@ func (req *request) wait() (bool, bool) {
|
||||
defer qs.boundNextDispatchLocked(queue)
|
||||
qs.totRequestsWaiting--
|
||||
qs.totSeatsWaiting -= req.MaxSeats()
|
||||
qs.totRequestsRejected++
|
||||
qs.totRequestsCancelled++
|
||||
metrics.AddReject(req.ctx, qs.qCfg.Name, req.fsName, "cancelled")
|
||||
metrics.AddRequestsInQueues(req.ctx, qs.qCfg.Name, req.fsName, -1)
|
||||
req.NoteQueued(false)
|
||||
@ -1038,9 +1060,27 @@ func (qs *queueSet) Dump(includeRequestDetails bool) debug.QueueSetDump {
|
||||
Executing: qs.totRequestsExecuting,
|
||||
SeatsInUse: qs.totSeatsInUse,
|
||||
SeatsWaiting: qs.totSeatsWaiting,
|
||||
Dispatched: qs.totRequestsDispatched,
|
||||
Rejected: qs.totRequestsRejected,
|
||||
Timedout: qs.totRequestsTimedout,
|
||||
Cancelled: qs.totRequestsCancelled,
|
||||
}
|
||||
for i, q := range qs.queues {
|
||||
d.Queues[i] = q.dumpLocked(includeRequestDetails)
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func OnRequestDispatched(r fq.Request) {
|
||||
req, ok := r.(*request)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
qs := req.qs
|
||||
if qs != nil {
|
||||
qs.lock.Lock()
|
||||
defer qs.lock.Unlock()
|
||||
qs.totRequestsDispatched++
|
||||
}
|
||||
}
|
||||
|
1
vendor/k8s.io/apiserver/pkg/util/flowcontrol/metrics/timing_ratio_histogram.go
generated
vendored
1
vendor/k8s.io/apiserver/pkg/util/flowcontrol/metrics/timing_ratio_histogram.go
generated
vendored
@ -70,6 +70,7 @@ func NewTimingRatioHistogram(opts *TimingRatioHistogramOpts) *TimingRatioHistogr
|
||||
|
||||
// NewTestableTimingHistogram adds injection of the clock
|
||||
func NewTestableTimingRatioHistogram(nowFunc func() time.Time, opts *TimingRatioHistogramOpts) *TimingRatioHistogram {
|
||||
//nolint:govet // copylocks: assignment copies lock value to ratioedOpts: k8s.io/component-base/metrics.TimingHistogramOpts contains sync.Once contains sync.Mutex
|
||||
ratioedOpts := opts.TimingHistogramOpts
|
||||
ratioedOpts.InitialValue /= opts.InitialDenominator
|
||||
th := compbasemetrics.NewTestableTimingHistogram(nowFunc, &ratioedOpts)
|
||||
|
5
vendor/k8s.io/apiserver/pkg/util/flowcontrol/request/list_work_estimator.go
generated
vendored
5
vendor/k8s.io/apiserver/pkg/util/flowcontrol/request/list_work_estimator.go
generated
vendored
@ -147,8 +147,11 @@ func key(requestInfo *apirequest.RequestInfo) string {
|
||||
// staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go
|
||||
func shouldListFromStorage(query url.Values, opts *metav1.ListOptions) bool {
|
||||
resourceVersion := opts.ResourceVersion
|
||||
match := opts.ResourceVersionMatch
|
||||
pagingEnabled := utilfeature.DefaultFeatureGate.Enabled(features.APIListChunking)
|
||||
hasContinuation := pagingEnabled && len(opts.Continue) > 0
|
||||
hasLimit := pagingEnabled && opts.Limit > 0 && resourceVersion != "0"
|
||||
return resourceVersion == "" || hasContinuation || hasLimit || opts.ResourceVersionMatch == metav1.ResourceVersionMatchExact
|
||||
unsupportedMatch := match != "" && match != metav1.ResourceVersionMatchNotOlderThan
|
||||
|
||||
return resourceVersion == "" || hasContinuation || hasLimit || unsupportedMatch
|
||||
}
|
||||
|
5
vendor/k8s.io/apiserver/pkg/util/flowcontrol/watch_tracker.go
generated
vendored
5
vendor/k8s.io/apiserver/pkg/util/flowcontrol/watch_tracker.go
generated
vendored
@ -195,9 +195,8 @@ func (w *watchTracker) forgetWatch(identifier *watchIdentifier, index *indexValu
|
||||
// GetInterestedWatchCount implements WatchTracker interface.
|
||||
//
|
||||
// TODO(wojtek-t): As of now, requestInfo for object creation (POST) doesn't
|
||||
//
|
||||
// contain the Name field set. Figure out if we can somehow get it for the
|
||||
// more accurate cost estimation.
|
||||
// contain the Name field set. Figure out if we can somehow get it for the
|
||||
// more accurate cost estimation.
|
||||
//
|
||||
// TODO(wojtek-t): Figure out how to approach DELETECOLLECTION calls.
|
||||
func (w *watchTracker) GetInterestedWatchCount(requestInfo *request.RequestInfo) int {
|
||||
|
83
vendor/k8s.io/apiserver/pkg/util/openapi/enablement.go
generated
vendored
83
vendor/k8s.io/apiserver/pkg/util/openapi/enablement.go
generated
vendored
@ -1,83 +0,0 @@
|
||||
/*
|
||||
Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/kube-openapi/pkg/common"
|
||||
"k8s.io/kube-openapi/pkg/schemamutation"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
)
|
||||
|
||||
// enumTypeDescriptionHeader is the header of enum section in schema description.
|
||||
const enumTypeDescriptionHeader = "Possible enum values:"
|
||||
|
||||
// GetOpenAPIDefinitionsWithoutDisabledFeatures wraps a GetOpenAPIDefinitions to revert
|
||||
// any change to the schema that was made by disabled features.
|
||||
func GetOpenAPIDefinitionsWithoutDisabledFeatures(GetOpenAPIDefinitions common.GetOpenAPIDefinitions) common.GetOpenAPIDefinitions {
|
||||
return func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||
defs := GetOpenAPIDefinitions(ref)
|
||||
restoreDefinitions(defs)
|
||||
return defs
|
||||
}
|
||||
}
|
||||
|
||||
// restoreDefinitions restores any changes by disabled features from definition map.
|
||||
func restoreDefinitions(defs map[string]common.OpenAPIDefinition) {
|
||||
// revert changes from OpenAPIEnums
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(genericfeatures.OpenAPIEnums) {
|
||||
for gvk, def := range defs {
|
||||
orig := &def.Schema
|
||||
if ret := pruneEnums(orig); ret != orig {
|
||||
def.Schema = *ret
|
||||
defs[gvk] = def
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func pruneEnums(schema *spec.Schema) *spec.Schema {
|
||||
walker := schemamutation.Walker{
|
||||
SchemaCallback: func(schema *spec.Schema) *spec.Schema {
|
||||
orig := schema
|
||||
clone := func() {
|
||||
if orig == schema { // if schema has not been mutated yet
|
||||
schema = new(spec.Schema)
|
||||
*schema = *orig // make a clone from orig to schema
|
||||
}
|
||||
}
|
||||
if headerIndex := strings.Index(schema.Description, enumTypeDescriptionHeader); headerIndex != -1 {
|
||||
// remove the enum section from description.
|
||||
// note that the new lines before the header should be removed too,
|
||||
// thus the slice range.
|
||||
clone()
|
||||
schema.Description = schema.Description[:headerIndex]
|
||||
}
|
||||
if len(schema.Enum) != 0 {
|
||||
// remove the enum field
|
||||
clone()
|
||||
schema.Enum = nil
|
||||
}
|
||||
return schema
|
||||
},
|
||||
RefCallback: schemamutation.RefCallbackNoop,
|
||||
}
|
||||
return walker.WalkSchema(schema)
|
||||
}
|
46
vendor/k8s.io/apiserver/pkg/util/openapi/proto.go
generated
vendored
46
vendor/k8s.io/apiserver/pkg/util/openapi/proto.go
generated
vendored
@ -1,46 +0,0 @@
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
openapi_v2 "github.com/google/gnostic/openapiv2"
|
||||
|
||||
"k8s.io/kube-openapi/pkg/util/proto"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
)
|
||||
|
||||
// ToProtoModels builds the proto formatted models from OpenAPI spec
|
||||
func ToProtoModels(openAPISpec *spec.Swagger) (proto.Models, error) {
|
||||
specBytes, err := json.MarshalIndent(openAPISpec, " ", " ")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
doc, err := openapi_v2.ParseDocument(specBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
models, err := proto.NewOpenAPIData(doc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return models, nil
|
||||
}
|
2
vendor/k8s.io/apiserver/pkg/util/webhook/webhook.go
generated
vendored
2
vendor/k8s.io/apiserver/pkg/util/webhook/webhook.go
generated
vendored
@ -121,7 +121,7 @@ func WithExponentialBackoff(ctx context.Context, retryBackoff wait.Backoff, webh
|
||||
// having a webhook error allows us to track the last actual webhook error for requests that
|
||||
// are later cancelled or time out.
|
||||
var webhookErr error
|
||||
err := wait.ExponentialBackoffWithContext(ctx, retryBackoff, func() (bool, error) {
|
||||
err := wait.ExponentialBackoffWithContext(ctx, retryBackoff, func(_ context.Context) (bool, error) {
|
||||
webhookErr = webhookFn()
|
||||
if shouldRetry(webhookErr) {
|
||||
return false, nil
|
||||
|
Reference in New Issue
Block a user