Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
bumping knative.dev/serving 3e6d275...b484fa2:
  > b484fa2 Update net-contour nightly (# 15691)
  > a829571 Update net-kourier nightly (# 15689)
  > 19b9a09 Fix all linter warnings (# 15684)
  > db2721f Update net-gateway-api nightly (# 15690)
  > 243e1ea upgrade to latest dependencies (# 15687)
  > dd48437 Bump the github-actions group with 3 updates (# 15686)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation committed Jan 15, 2025
1 parent de1b706 commit 019ad4a
Show file tree
Hide file tree
Showing 61 changed files with 169 additions and 167 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36
knative.dev/networking v0.0.0-20250113195501-679796878afc
knative.dev/pkg v0.0.0-20250113161000-0c2a238a16ed
knative.dev/serving v0.43.1-0.20250113163001-3e6d275e2bc4
knative.dev/serving v0.43.1-0.20250115103709-b484fa275687
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,8 @@ knative.dev/networking v0.0.0-20250113195501-679796878afc h1:bzQlBSOXd7Uz+/ugX8b
knative.dev/networking v0.0.0-20250113195501-679796878afc/go.mod h1:Coz36qc6dZK219RRTPuzQf4YTrCjoqN5T2hcr14RNfI=
knative.dev/pkg v0.0.0-20250113161000-0c2a238a16ed h1:PUMNZc1CBUg5G4JYio3wjpCJuCJG2ZeCuLvlBTpDiZI=
knative.dev/pkg v0.0.0-20250113161000-0c2a238a16ed/go.mod h1:p7c7yCCf1YVX04FQ8YDyJaHciknu726qVWOXRX5tIBM=
knative.dev/serving v0.43.1-0.20250113163001-3e6d275e2bc4 h1:khvS0c6FTsz7Rrto0YzNMiqHYvzNWW5STDhu/G/aMlE=
knative.dev/serving v0.43.1-0.20250113163001-3e6d275e2bc4/go.mod h1:r6fkQURyTwcCiu/4dXFJbCW/Jp+lPUO9ULCARdTYjT8=
knative.dev/serving v0.43.1-0.20250115103709-b484fa275687 h1:bACr2Bzt12kMTKJA/LkC0Dj7xhcX45yoRsdJeCJEjj8=
knative.dev/serving v0.43.1-0.20250115103709-b484fa275687/go.mod h1:idwHPJ+HPW8/RPna8J2lQfkNQsYaWa7Y5K4bm6pJkDE=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
Expand Down
14 changes: 6 additions & 8 deletions vendor/knative.dev/serving/pkg/activator/activator.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ const (
RevisionHeaderNamespace = "Knative-Serving-Namespace"
)

var (
// RevisionHeaders are the headers the activator uses to identify the
// revision. They are removed before reaching the user container.
RevisionHeaders = []string{
RevisionHeaderName,
RevisionHeaderNamespace,
}
)
// RevisionHeaders are the headers the activator uses to identify the
// revision. They are removed before reaching the user container.
var RevisionHeaders = []string{
RevisionHeaderName,
RevisionHeaderNamespace,
}
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ func validateInitialScale(config *autoscalerconfig.Config, m map[string]string)
if err != nil {
return apis.ErrInvalidValue(v, k)
} else if initScaleInt < 0 {
return apis.ErrInvalidValue(v, fmt.Sprintf("%s must be greater than 0", k))
return apis.ErrInvalidValue(v, k+" must be greater than 0")
} else if !config.AllowZeroInitialScale && initScaleInt == 0 {
return apis.ErrInvalidValue(v, fmt.Sprintf("%s=0 not allowed by cluster", k))
return apis.ErrInvalidValue(v, k+"=0 not allowed by cluster")
}
}
return nil
Expand Down
2 changes: 0 additions & 2 deletions vendor/knative.dev/serving/pkg/apis/autoscaling/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ const (
// points will be missed entirely by the panic window which is
// smaller than the stable window. Anything less than 6 seconds
// isn't going to work well.
//
// nolint:revive // False positive, Min means minimum, not minutes.
WindowMin = 6 * time.Second
// WindowMax is the maximum permitted stable autoscaling window.
// This keeps the event horizon to a reasonable enough limit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ type PodScalableStatus struct {
Replicas int32 `json:"replicas,omitempty"`
}

var _ duck.Populatable = (*PodScalable)(nil)
var _ duck.Implementable = (*PodScalable)(nil)
var _ apis.Listable = (*PodScalable)(nil)
var (
_ duck.Populatable = (*PodScalable)(nil)
_ duck.Implementable = (*PodScalable)(nil)
_ apis.Listable = (*PodScalable)(nil)
)

// GetFullType implements duck.Implementable
func (*PodScalable) GetFullType() duck.Populatable {
Expand Down
8 changes: 1 addition & 7 deletions vendor/knative.dev/serving/pkg/apis/serving/fieldmask.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ func HandlerMask(in *corev1.ProbeHandler) *corev1.ProbeHandler {
out.GRPC = in.GRPC

return out

}

// ExecActionMask performs a _shallow_ copy of the Kubernetes ExecAction object to a new
Expand Down Expand Up @@ -473,7 +472,7 @@ func ContainerPortMask(in *corev1.ContainerPort) *corev1.ContainerPort {
out.Name = in.Name
out.Protocol = in.Protocol

//Disallowed fields
// Disallowed fields
// This list is unnecessary, but added here for clarity
out.HostIP = ""
out.HostPort = 0
Expand Down Expand Up @@ -552,7 +551,6 @@ func ConfigMapKeySelectorMask(in *corev1.ConfigMapKeySelector) *corev1.ConfigMap
out.LocalObjectReference = in.LocalObjectReference

return out

}

// SecretKeySelectorMask performs a _shallow_ copy of the Kubernetes SecretKeySelector object to a new
Expand All @@ -571,7 +569,6 @@ func SecretKeySelectorMask(in *corev1.SecretKeySelector) *corev1.SecretKeySelect
out.LocalObjectReference = in.LocalObjectReference

return out

}

// ConfigMapEnvSourceMask performs a _shallow_ copy of the Kubernetes ConfigMapEnvSource object to a new
Expand All @@ -589,7 +586,6 @@ func ConfigMapEnvSourceMask(in *corev1.ConfigMapEnvSource) *corev1.ConfigMapEnvS
out.LocalObjectReference = in.LocalObjectReference

return out

}

// SecretEnvSourceMask performs a _shallow_ copy of the Kubernetes SecretEnvSource object to a new
Expand All @@ -607,7 +603,6 @@ func SecretEnvSourceMask(in *corev1.SecretEnvSource) *corev1.SecretEnvSource {
out.LocalObjectReference = in.LocalObjectReference

return out

}

// EnvFromSourceMask performs a _shallow_ copy of the Kubernetes EnvFromSource object to a new
Expand Down Expand Up @@ -643,7 +638,6 @@ func ResourceRequirementsMask(in *corev1.ResourceRequirements) *corev1.ResourceR
out.Requests = in.Requests

return out

}

// PodSecurityContextMask performs a _shallow_ copy of the Kubernetes PodSecurityContext object into a new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func TransformDeploymentStatus(ds *appsv1.DeploymentStatus) *duckv1.Status {
depCondSet.Manage(s).MarkTrue(DeploymentConditionReplicaSetReady)
}
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:stylecheck // ignore complaints about receiver having different names
package v1

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:stylecheck // ignore complaints about receiver having different names
package v1

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,8 @@ func validateQueueSidecarResourceAnnotations(m map[string]string) *apis.FieldErr
value, err := strconv.ParseFloat(v, 64)
if err != nil {
errs = errs.Also(apis.ErrInvalidValue(v, apis.CurrentField).ViaKey(k))
} else {
if value < 0.1 || value > 100 {
errs = errs.Also(apis.ErrOutOfBoundsValue(value, 0.1, 100.0, apis.CurrentField).ViaKey(k))
}
} else if value < 0.1 || value > 100 {
errs = errs.Also(apis.ErrOutOfBoundsValue(value, 0.1, 100.0, apis.CurrentField).ViaKey(k))
}
}
annoKeys := []kmap.KeyPriority{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:stylecheck // ignore complaints about receiver having different names
package v1

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:stylecheck // ignore complaints about receiver having different names
package v1

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func (s *Service) SetDefaults(ctx context.Context) {

s.Spec.SetDefaults(apis.WithinSpec(ctx))
serving.SetUserInfo(ctx, prevSpec, &s.Spec, s)

}

// SetDefaults implements apis.Defaultable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ func (t *WeightedFloat64Buckets) WindowAverage(now time.Time) float64 {
if now.After(t.lastWrite) {
numZ := now.Sub(t.lastWrite) / t.granularity
// Skip to this multiplier directly: m*(1-m)^(nz-1).
multiplier = multiplier * math.Pow(1-t.smoothingCoeff, float64(numZ))
multiplier *= math.Pow(1-t.smoothingCoeff, float64(numZ))
// Reduce effective number of buckets.
numB -= int(numZ)
}
startIdx := t.timeToIndex(t.lastWrite) + totalB // To ensure always positive % operation.
ret := 0.
for i := 0; i < numB; i++ {
for i := range numB {
effectiveIdx := (startIdx - i) % totalB
v := t.buckets[effectiveIdx] * multiplier
ret += v
Expand Down Expand Up @@ -336,7 +336,7 @@ func (t *TimedFloat64Buckets) ResizeWindow(w time.Duration) {
// `newBuckets` buckets.
oldNumBuckets := len(t.buckets)
tIdx := t.timeToIndex(t.lastWrite)
for i := 0; i < min(numBuckets, oldNumBuckets); i++ {
for range min(numBuckets, oldNumBuckets) {
oi := tIdx % oldNumBuckets
ni := tIdx % numBuckets
newBuckets[ni] = t.buckets[oi]
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/serving/pkg/autoscaler/bucket/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func AutoscalerBucketName(ordinal, total uint32) string {
// buckets with the given `total` count.
func AutoscalerBucketSet(total uint32) *hash.BucketSet {
names := make(sets.Set[string], total)
for i := uint32(0); i < total; i++ {
for i := range total {
names.Insert(AutoscalerBucketName(i, total))
}
return hash.NewBucketSet(names)
Expand Down
1 change: 0 additions & 1 deletion vendor/knative.dev/serving/pkg/autoscaler/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ func validate(lc *autoscalerconfig.Config) (*autoscalerconfig.Config, error) {
lc.PanicWindowPercentage > autoscaling.PanicWindowPercentageMax {
return nil, fmt.Errorf("panic-window-percentage = %v, must be in [%v, %v] interval",
lc.PanicWindowPercentage, autoscaling.PanicWindowPercentageMin, autoscaling.PanicWindowPercentageMax)

}

if lc.InitialScale < 0 || (lc.InitialScale == 0 && !lc.AllowZeroInitialScale) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ type MetricCollector struct {
watcher func(types.NamespacedName)
}

var _ Collector = (*MetricCollector)(nil)
var _ MetricClient = (*MetricCollector)(nil)
var (
_ Collector = (*MetricCollector)(nil)
_ MetricClient = (*MetricCollector)(nil)
)

// NewMetricCollector creates a new metric collector.
func NewMetricCollector(statsScraperFactory StatsScraperFactory, logger *zap.SugaredLogger) *MetricCollector {
Expand Down Expand Up @@ -263,7 +265,8 @@ func (c *collection) getScraper() StatsScraper {
// newCollection creates a new collection, which uses the given scraper to
// collect stats every scrapeTickInterval.
func newCollection(metric *autoscalingv1alpha1.Metric, scraper StatsScraper, clock clock.WithTicker,
callback func(types.NamespacedName), logger *zap.SugaredLogger) *collection {
callback func(types.NamespacedName), logger *zap.SugaredLogger,
) *collection {
// Pick the constructor to use to build the buckets.
// NB: this relies on the fact that aggregation algorithm is set on annotation of revision
// and as such is immutable.
Expand Down
17 changes: 10 additions & 7 deletions vendor/knative.dev/serving/pkg/autoscaler/metrics/stats_scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
"net/http"
"strconv"
"sync"
"sync/atomic"
"time"

"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
"go.uber.org/atomic"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"

Expand Down Expand Up @@ -160,7 +160,8 @@ type serviceScraper struct {
// NewStatsScraper creates a new StatsScraper for the Revision which
// the given Metric is responsible for.
func NewStatsScraper(metric *autoscalingv1alpha1.Metric, revisionName string, podAccessor resources.PodAccessor,
usePassthroughLb bool, meshMode netcfg.MeshCompatibilityMode, logger *zap.SugaredLogger) StatsScraper {
usePassthroughLb bool, meshMode netcfg.MeshCompatibilityMode, logger *zap.SugaredLogger,
) StatsScraper {
directClient := newHTTPScrapeClient(client)
meshClient := newHTTPScrapeClient(noKeepaliveClient)
return newServiceScraperWithClient(metric, revisionName, podAccessor, usePassthroughLb, meshMode, directClient, meshClient, logger)
Expand All @@ -173,7 +174,8 @@ func newServiceScraperWithClient(
usePassthroughLb bool,
meshMode netcfg.MeshCompatibilityMode,
directClient, meshClient scrapeClient,
logger *zap.SugaredLogger) *serviceScraper {
logger *zap.SugaredLogger,
) *serviceScraper {
svcName := metric.Labels[serving.ServiceLabelKey]
cfgName := metric.Labels[serving.ConfigurationLabelKey]

Expand Down Expand Up @@ -276,16 +278,17 @@ func (s *serviceScraper) scrapePods(window time.Duration) (Stat, error) {
pods = append(pods, youngPods...)

grp, egCtx := errgroup.WithContext(context.Background())
idx := atomic.NewInt32(-1)
var idx atomic.Int32
idx.Store(-1)
var sawNonMeshError atomic.Bool
// Start |sampleSize| threads to scan in parallel.
for i := 0; i < sampleSize; i++ {
for range sampleSize {
grp.Go(func() error {
// If a given pod failed to scrape, we want to continue
// scanning pods down the line.
for {
// Acquire next pod.
myIdx := int(idx.Inc())
myIdx := int(idx.Add(1))
// All out?
if myIdx >= len(pods) {
return errPodsExhausted
Expand Down Expand Up @@ -378,7 +381,7 @@ func (s *serviceScraper) scrapeService(window time.Duration) (Stat, error) {

grp, egCtx := errgroup.WithContext(context.Background())
youngPodCutOffSecs := window.Seconds()
for i := 0; i < sampleSize; i++ {
for range sampleSize {
grp.Go(func() error {
for tries := 1; ; tries++ {
stat, err := s.tryScrape(egCtx, scrapedPods)
Expand Down
10 changes: 5 additions & 5 deletions vendor/knative.dev/serving/pkg/autoscaler/scaling/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func New(
namespace, revision string,
metricClient metrics.MetricClient,
podCounter resources.EndpointsCounter,
deciderSpec *DeciderSpec) UniScaler {

deciderSpec *DeciderSpec,
) UniScaler {
var delayer *max.TimeWindow
if deciderSpec.ScaleDownDelay > 0 {
delayer = max.NewTimeWindow(deciderSpec.ScaleDownDelay, tickInterval)
Expand All @@ -85,8 +85,8 @@ func newAutoscaler(
metricClient metrics.MetricClient,
podCounter podCounter,
deciderSpec *DeciderSpec,
delayWindow *max.TimeWindow) *autoscaler {

delayWindow *max.TimeWindow,
) *autoscaler {
// We always start in the panic mode, if the deployment is scaled up over 1 pod.
// If the scale is 0 or 1, normal Autoscaler behavior is fine.
// When Autoscaler restarts we lose metric history, which causes us to
Expand Down Expand Up @@ -120,7 +120,7 @@ func newAutoscaler(
delayWindow: delayWindow,

panicTime: pt,
maxPanicPods: int32(curC),
maxPanicPods: int32(curC), //nolint:gosec // k8s replica count is bounded by int32
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ type MultiScaler struct {
func NewMultiScaler(
stopCh <-chan struct{},
uniScalerFactory UniScalerFactory,
logger *zap.SugaredLogger) *MultiScaler {
logger *zap.SugaredLogger,
) *MultiScaler {
return &MultiScaler{
scalers: make(map[types.NamespacedName]*scalerRunner),
scalersStopCh: stopCh,
Expand Down
Loading

0 comments on commit 019ad4a

Please sign in to comment.