mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: update kubernetes to latest
updating the kubernetes release to the latest in main go.mod Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
63c4c05b35
commit
5a66991bb3
4
vendor/k8s.io/apiserver/pkg/util/feature/feature_gate.go
generated
vendored
4
vendor/k8s.io/apiserver/pkg/util/feature/feature_gate.go
generated
vendored
@ -24,8 +24,8 @@ var (
|
||||
// DefaultMutableFeatureGate is a mutable version of DefaultFeatureGate.
|
||||
// Only top-level commands/options setup and the k8s.io/component-base/featuregate/testing package should make use of this.
|
||||
// Tests that need to modify feature gates for the duration of their test should use:
|
||||
// defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.<FeatureName>, <value>)()
|
||||
DefaultMutableFeatureGate featuregate.MutableFeatureGate = featuregate.NewFeatureGate()
|
||||
// featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.<FeatureName>, <value>)
|
||||
DefaultMutableFeatureGate featuregate.MutableVersionedFeatureGate = featuregate.NewFeatureGate()
|
||||
|
||||
// DefaultFeatureGate is a shared global FeatureGate.
|
||||
// Top-level commands/options setup that needs to modify this feature gate should use DefaultMutableFeatureGate.
|
||||
|
99
vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go
generated
vendored
99
vendor/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go
generated
vendored
@ -135,7 +135,7 @@ type configController struct {
|
||||
|
||||
// configQueue holds `(interface{})(0)` when the configuration
|
||||
// objects need to be reprocessed.
|
||||
configQueue workqueue.RateLimitingInterface
|
||||
configQueue workqueue.TypedRateLimitingInterface[int]
|
||||
|
||||
plLister flowcontrollister.PriorityLevelConfigurationLister
|
||||
plInformerSynced cache.InformerSynced
|
||||
@ -204,7 +204,7 @@ type priorityLevelState struct {
|
||||
// reached through this pointer is mutable.
|
||||
pl *flowcontrol.PriorityLevelConfiguration
|
||||
|
||||
// qsCompleter holds the QueueSetCompleter derived from `config`
|
||||
// qsCompleter holds the QueueSetCompleter derived from `pl`
|
||||
// and `queues`.
|
||||
qsCompleter fq.QueueSetCompleter
|
||||
|
||||
@ -255,12 +255,12 @@ type priorityLevelState struct {
|
||||
type seatDemandStats struct {
|
||||
avg float64
|
||||
stdDev float64
|
||||
highWatermark float64
|
||||
highWatermark int
|
||||
smoothed float64
|
||||
}
|
||||
|
||||
func (stats *seatDemandStats) update(obs fq.IntegratorResults) {
|
||||
stats.highWatermark = obs.Max
|
||||
stats.highWatermark = int(math.Round(obs.Max))
|
||||
if obs.Duration <= 0 {
|
||||
return
|
||||
}
|
||||
@ -292,7 +292,10 @@ func newTestableController(config TestableConfig) *configController {
|
||||
klog.V(2).Infof("NewTestableController %q with serverConcurrencyLimit=%d, name=%s, asFieldManager=%q", cfgCtlr.name, cfgCtlr.serverConcurrencyLimit, cfgCtlr.name, cfgCtlr.asFieldManager)
|
||||
// Start with longish delay because conflicts will be between
|
||||
// different processes, so take some time to go away.
|
||||
cfgCtlr.configQueue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(200*time.Millisecond, 8*time.Hour), "priority_and_fairness_config_queue")
|
||||
cfgCtlr.configQueue = workqueue.NewTypedRateLimitingQueueWithConfig(
|
||||
workqueue.NewTypedItemExponentialFailureRateLimiter[int](200*time.Millisecond, 8*time.Hour),
|
||||
workqueue.TypedRateLimitingQueueConfig[int]{Name: "priority_and_fairness_config_queue"},
|
||||
)
|
||||
// ensure the data structure reflects the mandatory config
|
||||
cfgCtlr.lockAndDigestConfigObjects(nil, nil)
|
||||
fci := config.InformerFactory.Flowcontrol().V1()
|
||||
@ -395,38 +398,63 @@ func (cfgCtlr *configController) updateBorrowing() {
|
||||
|
||||
func (cfgCtlr *configController) updateBorrowingLocked(setCompleters bool, plStates map[string]*priorityLevelState) {
|
||||
items := make([]allocProblemItem, 0, len(plStates))
|
||||
plNames := make([]string, 0, len(plStates))
|
||||
nonExemptPLNames := make([]string, 0, len(plStates))
|
||||
idxOfNonExempt := map[string]int{} // items index of non-exempt classes
|
||||
cclOfExempt := map[string]int{} // minCurrentCL of exempt classes
|
||||
var minCLSum, minCurrentCLSum int // sums over non-exempt classes
|
||||
remainingServerCL := cfgCtlr.nominalCLSum
|
||||
for plName, plState := range plStates {
|
||||
obs := plState.seatDemandIntegrator.Reset()
|
||||
plState.seatDemandStats.update(obs)
|
||||
// Lower bound on this priority level's adjusted concurreny limit is the lesser of:
|
||||
// - its seat demamd high watermark over the last adjustment period, and
|
||||
// - its configured concurrency limit.
|
||||
// BUT: we do not want this to be lower than the lower bound from configuration.
|
||||
// See KEP-1040 for a more detailed explanation.
|
||||
minCurrentCL := math.Max(float64(plState.minCL), math.Min(float64(plState.nominalCL), plState.seatDemandStats.highWatermark))
|
||||
plNames = append(plNames, plName)
|
||||
items = append(items, allocProblemItem{
|
||||
lowerBound: minCurrentCL,
|
||||
upperBound: float64(plState.maxCL),
|
||||
target: math.Max(minCurrentCL, plState.seatDemandStats.smoothed),
|
||||
})
|
||||
var minCurrentCL int
|
||||
if plState.pl.Spec.Type == flowcontrol.PriorityLevelEnablementExempt {
|
||||
minCurrentCL = max(plState.minCL, plState.seatDemandStats.highWatermark)
|
||||
cclOfExempt[plName] = minCurrentCL
|
||||
remainingServerCL -= minCurrentCL
|
||||
} else {
|
||||
// Lower bound on this priority level's adjusted concurreny limit is the lesser of:
|
||||
// - its seat demamd high watermark over the last adjustment period, and
|
||||
// - its configured concurrency limit.
|
||||
// BUT: we do not want this to be lower than the lower bound from configuration.
|
||||
// See KEP-1040 for a more detailed explanation.
|
||||
minCurrentCL = max(plState.minCL, min(plState.nominalCL, plState.seatDemandStats.highWatermark))
|
||||
idxOfNonExempt[plName] = len(items)
|
||||
nonExemptPLNames = append(nonExemptPLNames, plName)
|
||||
items = append(items, allocProblemItem{
|
||||
lowerBound: float64(minCurrentCL),
|
||||
upperBound: float64(plState.maxCL),
|
||||
target: math.Max(float64(minCurrentCL), plState.seatDemandStats.smoothed),
|
||||
})
|
||||
minCLSum += plState.minCL
|
||||
minCurrentCLSum += minCurrentCL
|
||||
}
|
||||
}
|
||||
if len(items) == 0 && cfgCtlr.nominalCLSum > 0 {
|
||||
klog.ErrorS(nil, "Impossible: no priority levels", "plStates", cfgCtlr.priorityLevelStates)
|
||||
return
|
||||
}
|
||||
allocs, fairFrac, err := computeConcurrencyAllocation(cfgCtlr.nominalCLSum, items)
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "Unable to derive new concurrency limits", "plNames", plNames, "items", items)
|
||||
allocs = make([]float64, len(items))
|
||||
for idx, plName := range plNames {
|
||||
plState := plStates[plName]
|
||||
allocs[idx] = float64(plState.currentCL)
|
||||
var allocs []float64
|
||||
var shareFrac, fairFrac float64
|
||||
var err error
|
||||
if remainingServerCL <= minCLSum {
|
||||
metrics.SetFairFrac(0)
|
||||
} else if remainingServerCL <= minCurrentCLSum {
|
||||
shareFrac = float64(remainingServerCL-minCLSum) / float64(minCurrentCLSum-minCLSum)
|
||||
metrics.SetFairFrac(0)
|
||||
} else {
|
||||
allocs, fairFrac, err = computeConcurrencyAllocation(cfgCtlr.nominalCLSum, items)
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "Unable to derive new concurrency limits", "plNames", nonExemptPLNames, "items", items)
|
||||
allocs = make([]float64, len(items))
|
||||
for idx, plName := range nonExemptPLNames {
|
||||
plState := plStates[plName]
|
||||
allocs[idx] = float64(plState.currentCL)
|
||||
}
|
||||
}
|
||||
metrics.SetFairFrac(float64(fairFrac))
|
||||
}
|
||||
for idx, plName := range plNames {
|
||||
plState := plStates[plName]
|
||||
for plName, plState := range plStates {
|
||||
idx, isNonExempt := idxOfNonExempt[plName]
|
||||
if setCompleters {
|
||||
qsCompleter, err := queueSetCompleterForPL(cfgCtlr.queueSetFactory, plState.queues,
|
||||
plState.pl, plState.reqsGaugePair, plState.execSeatsObs,
|
||||
@ -437,10 +465,20 @@ func (cfgCtlr *configController) updateBorrowingLocked(setCompleters bool, plSta
|
||||
}
|
||||
plState.qsCompleter = qsCompleter
|
||||
}
|
||||
currentCL := int(math.Round(float64(allocs[idx])))
|
||||
var currentCL int
|
||||
if !isNonExempt {
|
||||
currentCL = cclOfExempt[plName]
|
||||
} else if remainingServerCL <= minCLSum {
|
||||
currentCL = plState.minCL
|
||||
} else if remainingServerCL <= minCurrentCLSum {
|
||||
minCurrentCL := max(plState.minCL, min(plState.nominalCL, plState.seatDemandStats.highWatermark))
|
||||
currentCL = plState.minCL + int(math.Round(float64(minCurrentCL-plState.minCL)*shareFrac))
|
||||
} else {
|
||||
currentCL = int(math.Round(float64(allocs[idx])))
|
||||
}
|
||||
relChange := relDiff(float64(currentCL), float64(plState.currentCL))
|
||||
plState.currentCL = currentCL
|
||||
metrics.NotePriorityLevelConcurrencyAdjustment(plState.pl.Name, plState.seatDemandStats.highWatermark, plState.seatDemandStats.avg, plState.seatDemandStats.stdDev, plState.seatDemandStats.smoothed, float64(items[idx].target), currentCL)
|
||||
metrics.NotePriorityLevelConcurrencyAdjustment(plState.pl.Name, float64(plState.seatDemandStats.highWatermark), plState.seatDemandStats.avg, plState.seatDemandStats.stdDev, plState.seatDemandStats.smoothed, float64(items[idx].target), currentCL)
|
||||
logLevel := klog.Level(4)
|
||||
if relChange >= 0.05 {
|
||||
logLevel = 2
|
||||
@ -455,7 +493,6 @@ func (cfgCtlr *configController) updateBorrowingLocked(setCompleters bool, plSta
|
||||
klog.V(logLevel).InfoS("Update CurrentCL", "plName", plName, "seatDemandHighWatermark", plState.seatDemandStats.highWatermark, "seatDemandAvg", plState.seatDemandStats.avg, "seatDemandStdev", plState.seatDemandStats.stdDev, "seatDemandSmoothed", plState.seatDemandStats.smoothed, "fairFrac", fairFrac, "currentCL", currentCL, "concurrencyDenominator", concurrencyDenominator, "backstop", err != nil)
|
||||
plState.queues = plState.qsCompleter.Complete(fq.DispatchingConfig{ConcurrencyLimit: currentCL, ConcurrencyDenominator: concurrencyDenominator})
|
||||
}
|
||||
metrics.SetFairFrac(float64(fairFrac))
|
||||
}
|
||||
|
||||
// runWorker is the logic of the one and only worker goroutine. We
|
||||
@ -474,7 +511,7 @@ func (cfgCtlr *configController) processNextWorkItem() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func(obj interface{}) {
|
||||
func(obj int) {
|
||||
defer cfgCtlr.configQueue.Done(obj)
|
||||
specificDelay, err := cfgCtlr.syncOne()
|
||||
switch {
|
||||
|
13
vendor/k8s.io/apiserver/pkg/util/flowcontrol/request/list_work_estimator.go
generated
vendored
13
vendor/k8s.io/apiserver/pkg/util/flowcontrol/request/list_work_estimator.go
generated
vendored
@ -25,6 +25,8 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
apirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/features"
|
||||
"k8s.io/apiserver/pkg/storage"
|
||||
etcdfeature "k8s.io/apiserver/pkg/storage/feature"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
@ -165,15 +167,16 @@ func shouldListFromStorage(query url.Values, opts *metav1.ListOptions) bool {
|
||||
resourceVersion := opts.ResourceVersion
|
||||
match := opts.ResourceVersionMatch
|
||||
consistentListFromCacheEnabled := utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache)
|
||||
requestWatchProgressSupported := etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RequestWatchProgress)
|
||||
|
||||
// Serve consistent reads from storage if ConsistentListFromCache is disabled
|
||||
consistentReadFromStorage := resourceVersion == "" && !consistentListFromCacheEnabled
|
||||
consistentReadFromStorage := resourceVersion == "" && !(consistentListFromCacheEnabled && requestWatchProgressSupported)
|
||||
// Watch cache doesn't support continuations, so serve them from etcd.
|
||||
hasContinuation := len(opts.Continue) > 0
|
||||
// Serve paginated requests about revision "0" from watch cache to avoid overwhelming etcd.
|
||||
hasLimit := opts.Limit > 0 && resourceVersion != "0"
|
||||
// Watch cache only supports ResourceVersionMatchNotOlderThan (default).
|
||||
unsupportedMatch := match != "" && match != metav1.ResourceVersionMatchNotOlderThan
|
||||
// see https://kubernetes.io/docs/reference/using-api/api-concepts/#semantics-for-get-and-list
|
||||
isLegacyExactMatch := opts.Limit > 0 && match == "" && len(resourceVersion) > 0 && resourceVersion != "0"
|
||||
unsupportedMatch := match != "" && match != metav1.ResourceVersionMatchNotOlderThan || isLegacyExactMatch
|
||||
|
||||
return consistentReadFromStorage || hasContinuation || hasLimit || unsupportedMatch
|
||||
return consistentReadFromStorage || hasContinuation || unsupportedMatch
|
||||
}
|
||||
|
454
vendor/k8s.io/apiserver/pkg/util/version/registry.go
generated
vendored
Normal file
454
vendor/k8s.io/apiserver/pkg/util/version/registry.go
generated
vendored
Normal file
@ -0,0 +1,454 @@
|
||||
/*
|
||||
Copyright 2024 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 version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/version"
|
||||
cliflag "k8s.io/component-base/cli/flag"
|
||||
"k8s.io/component-base/featuregate"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// DefaultComponentGlobalsRegistry is the global var to store the effective versions and feature gates for all components for easy access.
|
||||
// Example usage:
|
||||
// // register the component effective version and feature gate first
|
||||
// _, _ = utilversion.DefaultComponentGlobalsRegistry.ComponentGlobalsOrRegister(utilversion.DefaultKubeComponent, utilversion.DefaultKubeEffectiveVersion(), utilfeature.DefaultMutableFeatureGate)
|
||||
// wardleEffectiveVersion := utilversion.NewEffectiveVersion("1.2")
|
||||
// wardleFeatureGate := featuregate.NewFeatureGate()
|
||||
// utilruntime.Must(utilversion.DefaultComponentGlobalsRegistry.Register(apiserver.WardleComponentName, wardleEffectiveVersion, wardleFeatureGate, false))
|
||||
//
|
||||
// cmd := &cobra.Command{
|
||||
// ...
|
||||
// // call DefaultComponentGlobalsRegistry.Set() in PersistentPreRunE
|
||||
// PersistentPreRunE: func(*cobra.Command, []string) error {
|
||||
// if err := utilversion.DefaultComponentGlobalsRegistry.Set(); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// ...
|
||||
// },
|
||||
// RunE: func(c *cobra.Command, args []string) error {
|
||||
// // call utilversion.DefaultComponentGlobalsRegistry.Validate() somewhere
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// flags := cmd.Flags()
|
||||
// // add flags
|
||||
// utilversion.DefaultComponentGlobalsRegistry.AddFlags(flags)
|
||||
var DefaultComponentGlobalsRegistry ComponentGlobalsRegistry = NewComponentGlobalsRegistry()
|
||||
|
||||
const (
|
||||
DefaultKubeComponent = "kube"
|
||||
|
||||
klogLevel = 2
|
||||
)
|
||||
|
||||
type VersionMapping func(from *version.Version) *version.Version
|
||||
|
||||
// ComponentGlobals stores the global variables for a component for easy access.
|
||||
type ComponentGlobals struct {
|
||||
effectiveVersion MutableEffectiveVersion
|
||||
featureGate featuregate.MutableVersionedFeatureGate
|
||||
|
||||
// emulationVersionMapping contains the mapping from the emulation version of this component
|
||||
// to the emulation version of another component.
|
||||
emulationVersionMapping map[string]VersionMapping
|
||||
// dependentEmulationVersion stores whether or not this component's EmulationVersion is dependent through mapping on another component.
|
||||
// If true, the emulation version cannot be set from the flag, or version mapping from another component.
|
||||
dependentEmulationVersion bool
|
||||
// minCompatibilityVersionMapping contains the mapping from the min compatibility version of this component
|
||||
// to the min compatibility version of another component.
|
||||
minCompatibilityVersionMapping map[string]VersionMapping
|
||||
// dependentMinCompatibilityVersion stores whether or not this component's MinCompatibilityVersion is dependent through mapping on another component
|
||||
// If true, the min compatibility version cannot be set from the flag, or version mapping from another component.
|
||||
dependentMinCompatibilityVersion bool
|
||||
}
|
||||
|
||||
type ComponentGlobalsRegistry interface {
|
||||
// EffectiveVersionFor returns the EffectiveVersion registered under the component.
|
||||
// Returns nil if the component is not registered.
|
||||
EffectiveVersionFor(component string) EffectiveVersion
|
||||
// FeatureGateFor returns the FeatureGate registered under the component.
|
||||
// Returns nil if the component is not registered.
|
||||
FeatureGateFor(component string) featuregate.FeatureGate
|
||||
// Register registers the EffectiveVersion and FeatureGate for a component.
|
||||
// returns error if the component is already registered.
|
||||
Register(component string, effectiveVersion MutableEffectiveVersion, featureGate featuregate.MutableVersionedFeatureGate) error
|
||||
// ComponentGlobalsOrRegister would return the registered global variables for the component if it already exists in the registry.
|
||||
// Otherwise, the provided variables would be registered under the component, and the same variables would be returned.
|
||||
ComponentGlobalsOrRegister(component string, effectiveVersion MutableEffectiveVersion, featureGate featuregate.MutableVersionedFeatureGate) (MutableEffectiveVersion, featuregate.MutableVersionedFeatureGate)
|
||||
// AddFlags adds flags of "--emulated-version" and "--feature-gates"
|
||||
AddFlags(fs *pflag.FlagSet)
|
||||
// Set sets the flags for all global variables for all components registered.
|
||||
Set() error
|
||||
// SetFallback calls Set() if it has never been called.
|
||||
SetFallback() error
|
||||
// Validate calls the Validate() function for all the global variables for all components registered.
|
||||
Validate() []error
|
||||
// Reset removes all stored ComponentGlobals, configurations, and version mappings.
|
||||
Reset()
|
||||
// SetEmulationVersionMapping sets the mapping from the emulation version of one component
|
||||
// to the emulation version of another component.
|
||||
// Once set, the emulation version of the toComponent will be determined by the emulation version of the fromComponent,
|
||||
// and cannot be set from cmd flags anymore.
|
||||
// For a given component, its emulation version can only depend on one other component, no multiple dependency is allowed.
|
||||
SetEmulationVersionMapping(fromComponent, toComponent string, f VersionMapping) error
|
||||
}
|
||||
|
||||
type componentGlobalsRegistry struct {
|
||||
componentGlobals map[string]*ComponentGlobals
|
||||
mutex sync.RWMutex
|
||||
// list of component name to emulation version set from the flag.
|
||||
emulationVersionConfig []string
|
||||
// map of component name to the list of feature gates set from the flag.
|
||||
featureGatesConfig map[string][]string
|
||||
// set stores if the Set() function for the registry is already called.
|
||||
set bool
|
||||
}
|
||||
|
||||
func NewComponentGlobalsRegistry() *componentGlobalsRegistry {
|
||||
return &componentGlobalsRegistry{
|
||||
componentGlobals: make(map[string]*ComponentGlobals),
|
||||
emulationVersionConfig: nil,
|
||||
featureGatesConfig: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) Reset() {
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
r.componentGlobals = make(map[string]*ComponentGlobals)
|
||||
r.emulationVersionConfig = nil
|
||||
r.featureGatesConfig = nil
|
||||
r.set = false
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) EffectiveVersionFor(component string) EffectiveVersion {
|
||||
r.mutex.RLock()
|
||||
defer r.mutex.RUnlock()
|
||||
globals, ok := r.componentGlobals[component]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return globals.effectiveVersion
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) FeatureGateFor(component string) featuregate.FeatureGate {
|
||||
r.mutex.RLock()
|
||||
defer r.mutex.RUnlock()
|
||||
globals, ok := r.componentGlobals[component]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return globals.featureGate
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) unsafeRegister(component string, effectiveVersion MutableEffectiveVersion, featureGate featuregate.MutableVersionedFeatureGate) error {
|
||||
if _, ok := r.componentGlobals[component]; ok {
|
||||
return fmt.Errorf("component globals of %s already registered", component)
|
||||
}
|
||||
if featureGate != nil {
|
||||
if err := featureGate.SetEmulationVersion(effectiveVersion.EmulationVersion()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
c := ComponentGlobals{
|
||||
effectiveVersion: effectiveVersion,
|
||||
featureGate: featureGate,
|
||||
emulationVersionMapping: make(map[string]VersionMapping),
|
||||
minCompatibilityVersionMapping: make(map[string]VersionMapping),
|
||||
}
|
||||
r.componentGlobals[component] = &c
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) Register(component string, effectiveVersion MutableEffectiveVersion, featureGate featuregate.MutableVersionedFeatureGate) error {
|
||||
if effectiveVersion == nil {
|
||||
return fmt.Errorf("cannot register nil effectiveVersion")
|
||||
}
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
return r.unsafeRegister(component, effectiveVersion, featureGate)
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) ComponentGlobalsOrRegister(component string, effectiveVersion MutableEffectiveVersion, featureGate featuregate.MutableVersionedFeatureGate) (MutableEffectiveVersion, featuregate.MutableVersionedFeatureGate) {
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
globals, ok := r.componentGlobals[component]
|
||||
if ok {
|
||||
return globals.effectiveVersion, globals.featureGate
|
||||
}
|
||||
utilruntime.Must(r.unsafeRegister(component, effectiveVersion, featureGate))
|
||||
return effectiveVersion, featureGate
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) unsafeKnownFeatures() []string {
|
||||
var known []string
|
||||
for component, globals := range r.componentGlobals {
|
||||
if globals.featureGate == nil {
|
||||
continue
|
||||
}
|
||||
for _, f := range globals.featureGate.KnownFeatures() {
|
||||
known = append(known, component+":"+f)
|
||||
}
|
||||
}
|
||||
sort.Strings(known)
|
||||
return known
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) unsafeVersionFlagOptions(isEmulation bool) []string {
|
||||
var vs []string
|
||||
for component, globals := range r.componentGlobals {
|
||||
binaryVer := globals.effectiveVersion.BinaryVersion()
|
||||
if isEmulation {
|
||||
if globals.dependentEmulationVersion {
|
||||
continue
|
||||
}
|
||||
// emulated version could be between binaryMajor.{binaryMinor} and binaryMajor.{binaryMinor}
|
||||
// TODO: change to binaryMajor.{binaryMinor-1} and binaryMajor.{binaryMinor} in 1.32
|
||||
vs = append(vs, fmt.Sprintf("%s=%s..%s (default=%s)", component,
|
||||
binaryVer.SubtractMinor(0).String(), binaryVer.String(), globals.effectiveVersion.EmulationVersion().String()))
|
||||
} else {
|
||||
if globals.dependentMinCompatibilityVersion {
|
||||
continue
|
||||
}
|
||||
// min compatibility version could be between binaryMajor.{binaryMinor-1} and binaryMajor.{binaryMinor}
|
||||
vs = append(vs, fmt.Sprintf("%s=%s..%s (default=%s)", component,
|
||||
binaryVer.SubtractMinor(1).String(), binaryVer.String(), globals.effectiveVersion.MinCompatibilityVersion().String()))
|
||||
}
|
||||
}
|
||||
sort.Strings(vs)
|
||||
return vs
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) AddFlags(fs *pflag.FlagSet) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
for _, globals := range r.componentGlobals {
|
||||
if globals.featureGate != nil {
|
||||
globals.featureGate.Close()
|
||||
}
|
||||
}
|
||||
if r.emulationVersionConfig != nil || r.featureGatesConfig != nil {
|
||||
klog.Warning("calling componentGlobalsRegistry.AddFlags more than once, the registry will be set by the latest flags")
|
||||
}
|
||||
r.emulationVersionConfig = []string{}
|
||||
r.featureGatesConfig = make(map[string][]string)
|
||||
|
||||
fs.StringSliceVar(&r.emulationVersionConfig, "emulated-version", r.emulationVersionConfig, ""+
|
||||
"The versions different components emulate their capabilities (APIs, features, ...) of.\n"+
|
||||
"If set, the component will emulate the behavior of this version instead of the underlying binary version.\n"+
|
||||
"Version format could only be major.minor, for example: '--emulated-version=wardle=1.2,kube=1.31'. Options are:\n"+strings.Join(r.unsafeVersionFlagOptions(true), "\n")+
|
||||
"If the component is not specified, defaults to \"kube\"")
|
||||
|
||||
fs.Var(cliflag.NewColonSeparatedMultimapStringStringAllowDefaultEmptyKey(&r.featureGatesConfig), "feature-gates", "Comma-separated list of component:key=value pairs that describe feature gates for alpha/experimental features of different components.\n"+
|
||||
"If the component is not specified, defaults to \"kube\". This flag can be repeatedly invoked. For example: --feature-gates 'wardle:featureA=true,wardle:featureB=false' --feature-gates 'kube:featureC=true'"+
|
||||
"Options are:\n"+strings.Join(r.unsafeKnownFeatures(), "\n"))
|
||||
}
|
||||
|
||||
type componentVersion struct {
|
||||
component string
|
||||
ver *version.Version
|
||||
}
|
||||
|
||||
// getFullEmulationVersionConfig expands the given version config with version registered version mapping,
|
||||
// and returns the map of component to Version.
|
||||
func (r *componentGlobalsRegistry) getFullEmulationVersionConfig(
|
||||
versionConfigMap map[string]*version.Version) (map[string]*version.Version, error) {
|
||||
result := map[string]*version.Version{}
|
||||
setQueue := []componentVersion{}
|
||||
for comp, ver := range versionConfigMap {
|
||||
if _, ok := r.componentGlobals[comp]; !ok {
|
||||
return result, fmt.Errorf("component not registered: %s", comp)
|
||||
}
|
||||
klog.V(klogLevel).Infof("setting version %s=%s", comp, ver.String())
|
||||
setQueue = append(setQueue, componentVersion{comp, ver})
|
||||
}
|
||||
for len(setQueue) > 0 {
|
||||
cv := setQueue[0]
|
||||
if _, visited := result[cv.component]; visited {
|
||||
return result, fmt.Errorf("setting version of %s more than once, probably version mapping loop", cv.component)
|
||||
}
|
||||
setQueue = setQueue[1:]
|
||||
result[cv.component] = cv.ver
|
||||
for toComp, f := range r.componentGlobals[cv.component].emulationVersionMapping {
|
||||
toVer := f(cv.ver)
|
||||
if toVer == nil {
|
||||
return result, fmt.Errorf("got nil version from mapping of %s=%s to component:%s", cv.component, cv.ver.String(), toComp)
|
||||
}
|
||||
klog.V(klogLevel).Infof("setting version %s=%s from version mapping of %s=%s", toComp, toVer.String(), cv.component, cv.ver.String())
|
||||
setQueue = append(setQueue, componentVersion{toComp, toVer})
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func toVersionMap(versionConfig []string) (map[string]*version.Version, error) {
|
||||
m := map[string]*version.Version{}
|
||||
for _, compVer := range versionConfig {
|
||||
// default to "kube" of component is not specified
|
||||
k := "kube"
|
||||
v := compVer
|
||||
if strings.Contains(compVer, "=") {
|
||||
arr := strings.SplitN(compVer, "=", 2)
|
||||
if len(arr) != 2 {
|
||||
return m, fmt.Errorf("malformed pair, expect string=string")
|
||||
}
|
||||
k = strings.TrimSpace(arr[0])
|
||||
v = strings.TrimSpace(arr[1])
|
||||
}
|
||||
ver, err := version.Parse(v)
|
||||
if err != nil {
|
||||
return m, err
|
||||
}
|
||||
if ver.Patch() != 0 {
|
||||
return m, fmt.Errorf("patch version not allowed, got: %s=%s", k, ver.String())
|
||||
}
|
||||
if existingVer, ok := m[k]; ok {
|
||||
return m, fmt.Errorf("duplicate version flag, %s=%s and %s=%s", k, existingVer.String(), k, ver.String())
|
||||
}
|
||||
m[k] = ver
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) SetFallback() error {
|
||||
r.mutex.Lock()
|
||||
set := r.set
|
||||
r.mutex.Unlock()
|
||||
if set {
|
||||
return nil
|
||||
}
|
||||
klog.Warning("setting componentGlobalsRegistry in SetFallback. We recommend calling componentGlobalsRegistry.Set()" +
|
||||
" right after parsing flags to avoid using feature gates before their final values are set by the flags.")
|
||||
return r.Set()
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) Set() error {
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
r.set = true
|
||||
emulationVersionConfigMap, err := toVersionMap(r.emulationVersionConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for comp := range emulationVersionConfigMap {
|
||||
if _, ok := r.componentGlobals[comp]; !ok {
|
||||
return fmt.Errorf("component not registered: %s", comp)
|
||||
}
|
||||
// only components without any dependencies can be set from the flag.
|
||||
if r.componentGlobals[comp].dependentEmulationVersion {
|
||||
return fmt.Errorf("EmulationVersion of %s is set by mapping, cannot set it by flag", comp)
|
||||
}
|
||||
}
|
||||
if emulationVersions, err := r.getFullEmulationVersionConfig(emulationVersionConfigMap); err != nil {
|
||||
return err
|
||||
} else {
|
||||
for comp, ver := range emulationVersions {
|
||||
r.componentGlobals[comp].effectiveVersion.SetEmulationVersion(ver)
|
||||
}
|
||||
}
|
||||
// Set feature gate emulation version before setting feature gate flag values.
|
||||
for comp, globals := range r.componentGlobals {
|
||||
if globals.featureGate == nil {
|
||||
continue
|
||||
}
|
||||
klog.V(klogLevel).Infof("setting %s:feature gate emulation version to %s", comp, globals.effectiveVersion.EmulationVersion().String())
|
||||
if err := globals.featureGate.SetEmulationVersion(globals.effectiveVersion.EmulationVersion()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for comp, fg := range r.featureGatesConfig {
|
||||
if comp == "" {
|
||||
if _, ok := r.featureGatesConfig[DefaultKubeComponent]; ok {
|
||||
return fmt.Errorf("set kube feature gates with default empty prefix or kube: prefix consistently, do not mix use")
|
||||
}
|
||||
comp = DefaultKubeComponent
|
||||
}
|
||||
if _, ok := r.componentGlobals[comp]; !ok {
|
||||
return fmt.Errorf("component not registered: %s", comp)
|
||||
}
|
||||
featureGate := r.componentGlobals[comp].featureGate
|
||||
if featureGate == nil {
|
||||
return fmt.Errorf("component featureGate not registered: %s", comp)
|
||||
}
|
||||
flagVal := strings.Join(fg, ",")
|
||||
klog.V(klogLevel).Infof("setting %s:feature-gates=%s", comp, flagVal)
|
||||
if err := featureGate.Set(flagVal); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) Validate() []error {
|
||||
var errs []error
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
for _, globals := range r.componentGlobals {
|
||||
errs = append(errs, globals.effectiveVersion.Validate()...)
|
||||
if globals.featureGate != nil {
|
||||
errs = append(errs, globals.featureGate.Validate()...)
|
||||
}
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
func (r *componentGlobalsRegistry) SetEmulationVersionMapping(fromComponent, toComponent string, f VersionMapping) error {
|
||||
if f == nil {
|
||||
return nil
|
||||
}
|
||||
klog.V(klogLevel).Infof("setting EmulationVersion mapping from %s to %s", fromComponent, toComponent)
|
||||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
if _, ok := r.componentGlobals[fromComponent]; !ok {
|
||||
return fmt.Errorf("component not registered: %s", fromComponent)
|
||||
}
|
||||
if _, ok := r.componentGlobals[toComponent]; !ok {
|
||||
return fmt.Errorf("component not registered: %s", toComponent)
|
||||
}
|
||||
// check multiple dependency
|
||||
if r.componentGlobals[toComponent].dependentEmulationVersion {
|
||||
return fmt.Errorf("mapping of %s already exists from another component", toComponent)
|
||||
}
|
||||
r.componentGlobals[toComponent].dependentEmulationVersion = true
|
||||
|
||||
versionMapping := r.componentGlobals[fromComponent].emulationVersionMapping
|
||||
if _, ok := versionMapping[toComponent]; ok {
|
||||
return fmt.Errorf("EmulationVersion from %s to %s already exists", fromComponent, toComponent)
|
||||
}
|
||||
versionMapping[toComponent] = f
|
||||
klog.V(klogLevel).Infof("setting the default EmulationVersion of %s based on mapping from the default EmulationVersion of %s", fromComponent, toComponent)
|
||||
defaultFromVersion := r.componentGlobals[fromComponent].effectiveVersion.EmulationVersion()
|
||||
emulationVersions, err := r.getFullEmulationVersionConfig(map[string]*version.Version{fromComponent: defaultFromVersion})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for comp, ver := range emulationVersions {
|
||||
r.componentGlobals[comp].effectiveVersion.SetEmulationVersion(ver)
|
||||
}
|
||||
return nil
|
||||
}
|
169
vendor/k8s.io/apiserver/pkg/util/version/version.go
generated
vendored
Normal file
169
vendor/k8s.io/apiserver/pkg/util/version/version.go
generated
vendored
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
Copyright 2024 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 version
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/version"
|
||||
baseversion "k8s.io/component-base/version"
|
||||
)
|
||||
|
||||
type EffectiveVersion interface {
|
||||
BinaryVersion() *version.Version
|
||||
EmulationVersion() *version.Version
|
||||
MinCompatibilityVersion() *version.Version
|
||||
EqualTo(other EffectiveVersion) bool
|
||||
String() string
|
||||
Validate() []error
|
||||
}
|
||||
|
||||
type MutableEffectiveVersion interface {
|
||||
EffectiveVersion
|
||||
Set(binaryVersion, emulationVersion, minCompatibilityVersion *version.Version)
|
||||
SetEmulationVersion(emulationVersion *version.Version)
|
||||
SetMinCompatibilityVersion(minCompatibilityVersion *version.Version)
|
||||
}
|
||||
|
||||
type effectiveVersion struct {
|
||||
binaryVersion atomic.Pointer[version.Version]
|
||||
// If the emulationVersion is set by the users, it could only contain major and minor versions.
|
||||
// In tests, emulationVersion could be the same as the binary version, or set directly,
|
||||
// which can have "alpha" as pre-release to continue serving expired apis while we clean up the test.
|
||||
emulationVersion atomic.Pointer[version.Version]
|
||||
// minCompatibilityVersion could only contain major and minor versions.
|
||||
minCompatibilityVersion atomic.Pointer[version.Version]
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) BinaryVersion() *version.Version {
|
||||
return m.binaryVersion.Load()
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) EmulationVersion() *version.Version {
|
||||
ver := m.emulationVersion.Load()
|
||||
if ver != nil {
|
||||
// Emulation version can have "alpha" as pre-release to continue serving expired apis while we clean up the test.
|
||||
// The pre-release should not be accessible to the users.
|
||||
return ver.WithPreRelease(m.BinaryVersion().PreRelease())
|
||||
}
|
||||
return ver
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) MinCompatibilityVersion() *version.Version {
|
||||
return m.minCompatibilityVersion.Load()
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) EqualTo(other EffectiveVersion) bool {
|
||||
return m.BinaryVersion().EqualTo(other.BinaryVersion()) && m.EmulationVersion().EqualTo(other.EmulationVersion()) && m.MinCompatibilityVersion().EqualTo(other.MinCompatibilityVersion())
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) String() string {
|
||||
if m == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("{BinaryVersion: %s, EmulationVersion: %s, MinCompatibilityVersion: %s}",
|
||||
m.BinaryVersion().String(), m.EmulationVersion().String(), m.MinCompatibilityVersion().String())
|
||||
}
|
||||
|
||||
func majorMinor(ver *version.Version) *version.Version {
|
||||
if ver == nil {
|
||||
return ver
|
||||
}
|
||||
return version.MajorMinor(ver.Major(), ver.Minor())
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) Set(binaryVersion, emulationVersion, minCompatibilityVersion *version.Version) {
|
||||
m.binaryVersion.Store(binaryVersion)
|
||||
m.emulationVersion.Store(majorMinor(emulationVersion))
|
||||
m.minCompatibilityVersion.Store(majorMinor(minCompatibilityVersion))
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) SetEmulationVersion(emulationVersion *version.Version) {
|
||||
m.emulationVersion.Store(majorMinor(emulationVersion))
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) SetMinCompatibilityVersion(minCompatibilityVersion *version.Version) {
|
||||
m.minCompatibilityVersion.Store(majorMinor(minCompatibilityVersion))
|
||||
}
|
||||
|
||||
func (m *effectiveVersion) Validate() []error {
|
||||
var errs []error
|
||||
// Validate only checks the major and minor versions.
|
||||
binaryVersion := m.binaryVersion.Load().WithPatch(0)
|
||||
emulationVersion := m.emulationVersion.Load()
|
||||
minCompatibilityVersion := m.minCompatibilityVersion.Load()
|
||||
|
||||
// emulationVersion can only be 1.{binaryMinor-1}...1.{binaryMinor}.
|
||||
maxEmuVer := binaryVersion
|
||||
minEmuVer := binaryVersion.SubtractMinor(1)
|
||||
if emulationVersion.GreaterThan(maxEmuVer) || emulationVersion.LessThan(minEmuVer) {
|
||||
errs = append(errs, fmt.Errorf("emulation version %s is not between [%s, %s]", emulationVersion.String(), minEmuVer.String(), maxEmuVer.String()))
|
||||
}
|
||||
// minCompatibilityVersion can only be 1.{binaryMinor-1} for alpha.
|
||||
maxCompVer := binaryVersion.SubtractMinor(1)
|
||||
minCompVer := binaryVersion.SubtractMinor(1)
|
||||
if minCompatibilityVersion.GreaterThan(maxCompVer) || minCompatibilityVersion.LessThan(minCompVer) {
|
||||
errs = append(errs, fmt.Errorf("minCompatibilityVersion version %s is not between [%s, %s]", minCompatibilityVersion.String(), minCompVer.String(), maxCompVer.String()))
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
func newEffectiveVersion(binaryVersion *version.Version) MutableEffectiveVersion {
|
||||
effective := &effectiveVersion{}
|
||||
compatVersion := binaryVersion.SubtractMinor(1)
|
||||
effective.Set(binaryVersion, binaryVersion, compatVersion)
|
||||
return effective
|
||||
}
|
||||
|
||||
func NewEffectiveVersion(binaryVer string) MutableEffectiveVersion {
|
||||
if binaryVer == "" {
|
||||
return &effectiveVersion{}
|
||||
}
|
||||
binaryVersion := version.MustParse(binaryVer)
|
||||
return newEffectiveVersion(binaryVersion)
|
||||
}
|
||||
|
||||
// DefaultBuildEffectiveVersion returns the MutableEffectiveVersion based on the
|
||||
// current build information.
|
||||
func DefaultBuildEffectiveVersion() MutableEffectiveVersion {
|
||||
verInfo := baseversion.Get()
|
||||
binaryVersion := version.MustParse(verInfo.String()).WithInfo(verInfo)
|
||||
if binaryVersion.Major() == 0 && binaryVersion.Minor() == 0 {
|
||||
return DefaultKubeEffectiveVersion()
|
||||
}
|
||||
return newEffectiveVersion(binaryVersion)
|
||||
}
|
||||
|
||||
// DefaultKubeEffectiveVersion returns the MutableEffectiveVersion based on the
|
||||
// latest K8s release.
|
||||
func DefaultKubeEffectiveVersion() MutableEffectiveVersion {
|
||||
binaryVersion := version.MustParse(baseversion.DefaultKubeBinaryVersion).WithInfo(baseversion.Get())
|
||||
return newEffectiveVersion(binaryVersion)
|
||||
}
|
||||
|
||||
// ValidateKubeEffectiveVersion validates the EmulationVersion is equal to the binary version at 1.31 for kube components.
|
||||
// TODO: remove in 1.32
|
||||
// emulationVersion is introduced in 1.31, so it is only allowed to be equal to the binary version at 1.31.
|
||||
func ValidateKubeEffectiveVersion(effectiveVersion EffectiveVersion) error {
|
||||
binaryVersion := version.MajorMinor(effectiveVersion.BinaryVersion().Major(), effectiveVersion.BinaryVersion().Minor())
|
||||
if binaryVersion.EqualTo(version.MajorMinor(1, 31)) && !effectiveVersion.EmulationVersion().EqualTo(binaryVersion) {
|
||||
return fmt.Errorf("emulation version needs to be equal to binary version(%s) in compatibility-version alpha, got %s",
|
||||
binaryVersion.String(), effectiveVersion.EmulationVersion().String())
|
||||
}
|
||||
return nil
|
||||
}
|
10
vendor/k8s.io/apiserver/pkg/util/webhook/validation.go
generated
vendored
10
vendor/k8s.io/apiserver/pkg/util/webhook/validation.go
generated
vendored
@ -23,8 +23,18 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"k8s.io/client-go/transport"
|
||||
)
|
||||
|
||||
func ValidateCABundle(fldPath *field.Path, caBundle []byte) field.ErrorList {
|
||||
var allErrors field.ErrorList
|
||||
_, err := transport.TLSConfigFor(&transport.Config{TLS: transport.TLSConfig{CAData: caBundle}})
|
||||
if err != nil {
|
||||
allErrors = append(allErrors, field.Invalid(fldPath, caBundle, err.Error()))
|
||||
}
|
||||
return allErrors
|
||||
}
|
||||
|
||||
// ValidateWebhookURL validates webhook's URL.
|
||||
func ValidateWebhookURL(fldPath *field.Path, URL string, forceHttps bool) field.ErrorList {
|
||||
var allErrors field.ErrorList
|
||||
|
Reference in New Issue
Block a user