Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
bumping knative.dev/pkg fce44ea...58135c2:
  > 58135c2 Extra logging for leases (# 3049)
bumping knative.dev/serving 2fd8465...09b4cd3:
  > 09b4cd3 use cgr.dev/chainguard/static:latest which is nonroot (# 15310)
  > 30a77d1 Add affinity-rules feature to configmap config-deployment (# 15250)
  > 10b9152 Update net-gateway-api nightly (# 15307)
  > 19055d5 upgrade to latest dependencies (# 15306)
  > 3e53acc Run system-internal-tls tests only for kourier (# 15299)
  > 5a3aa98 Update net-kourier nightly (# 15303)
  > 4c71c49 Update net-istio nightly (# 15301)
  > d3f9a04 Update net-contour nightly (# 15302)
  > 57d2a26 Update net-gateway-api nightly (# 15300)
  > bb51203 upgrade to latest dependencies (# 15297)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation committed Jun 7, 2024
1 parent 93bec4d commit 5b41ee2
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 9 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ require (
knative.dev/caching v0.0.0-20240603132637-bb31986d9396
knative.dev/hack v0.0.0-20240529131459-3b6d6441e7ea
knative.dev/networking v0.0.0-20240603133819-41aa2087242d
knative.dev/pkg v0.0.0-20240603145758-fce44ead15bd
knative.dev/serving v0.41.1-0.20240603213049-2fd8465334ec
knative.dev/pkg v0.0.0-20240604134003-58135c2c0694
knative.dev/serving v0.41.1-0.20240606173551-09b4cd3ec097
)

require (
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,10 @@ knative.dev/hack v0.0.0-20240529131459-3b6d6441e7ea h1:iWW6SNMrVd2hI5Y+ltKIEzXVe
knative.dev/hack v0.0.0-20240529131459-3b6d6441e7ea/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20240603133819-41aa2087242d h1:B0psbCJrgnQLE8fibEga8NHE04Ay6L8CctdG4a+1CaY=
knative.dev/networking v0.0.0-20240603133819-41aa2087242d/go.mod h1:WS5A291Vy2unZ1L54ZSKBkz/gVzVmIy15cCcdA6PRN4=
knative.dev/pkg v0.0.0-20240603145758-fce44ead15bd h1:SxwfJkmXwxl2PT5xZjtKKHO7URgHuigOoyzelaIGb2g=
knative.dev/pkg v0.0.0-20240603145758-fce44ead15bd/go.mod h1:E5OxJHFsQiW7pL0lVJ02XEVm2QUc0ZVdSUHiarUJHrU=
knative.dev/serving v0.41.1-0.20240603213049-2fd8465334ec h1:aL75B5j+6B7o6tm4fVgWyrystaxzhuGh+2UQZ68RKb8=
knative.dev/serving v0.41.1-0.20240603213049-2fd8465334ec/go.mod h1:DuULKFxW70yqYzYf0+LVla73AXXyB2kgCnMZ61hFFYw=
knative.dev/pkg v0.0.0-20240604134003-58135c2c0694 h1:trbVXm0WFXxxjcuSCKrYHKQwRQCuDrE8T5+yqXAI1NA=
knative.dev/pkg v0.0.0-20240604134003-58135c2c0694/go.mod h1:E5OxJHFsQiW7pL0lVJ02XEVm2QUc0ZVdSUHiarUJHrU=
knative.dev/serving v0.41.1-0.20240606173551-09b4cd3ec097 h1:QMgemyOgb1GQJ/HS0ABNRmIj+AlFgbjCWUZVCuuWSig=
knative.dev/serving v0.41.1-0.20240606173551-09b4cd3ec097/go.mod h1:2HcdNS0hQKfa5Y1hPdqoxLNaOQAP6OXSrRFUuceUOJ8=
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
28 changes: 27 additions & 1 deletion vendor/knative.dev/serving/pkg/deployment/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/sets"

cm "knative.dev/pkg/configmap"
)

Expand Down Expand Up @@ -68,6 +67,9 @@ const (
// qpoptions
queueSidecarTokenAudiencesKey = "queue-sidecar-token-audiences"
queueSidecarRooCAKey = "queue-sidecar-rootca"

defaultAffinityTypeKey = "default-affinity-type"
defaultAffinityTypeValue = PreferSpreadRevisionOverNodes
)

var (
Expand Down Expand Up @@ -103,6 +105,7 @@ func defaultConfig() *Config {
DigestResolutionTimeout: digestResolutionTimeoutDefault,
RegistriesSkippingTagResolving: sets.New("kind.local", "ko.local", "dev.local"),
QueueSidecarCPURequest: &QueueSidecarCPURequestDefault,
DefaultAffinityType: defaultAffinityTypeValue,
}
// The following code is needed for ConfigMap testing.
// defaultConfig must match the example in deployment.yaml which includes: `queue-sidecar-token-audiences: ""`
Expand Down Expand Up @@ -164,6 +167,14 @@ func NewConfigFromMap(configMap map[string]string) (*Config, error) {
return nil, fmt.Errorf("digest-resolution-timeout cannot be a non-positive duration, was %v", nc.DigestResolutionTimeout)
}

if affinity, ok := configMap[defaultAffinityTypeKey]; ok {
switch opt := AffinityType(affinity); opt {
case None, PreferSpreadRevisionOverNodes:
nc.DefaultAffinityType = opt
default:
return nil, fmt.Errorf("unsupported %s value: %q", defaultAffinityTypeKey, affinity)
}
}
return nc, nil
}

Expand All @@ -172,6 +183,17 @@ func NewConfigFromConfigMap(config *corev1.ConfigMap) (*Config, error) {
return NewConfigFromMap(config.Data)
}

// AffinityType specifies which affinity requirements will be automatically applied to the PodSpec of all Knative services.
type AffinityType string

const (
// None is used for deactivating affinity configuration for user workloads.
None AffinityType = "none"

// PreferSpreadRevisionOverNodes is used to set pod anti-affinity requirements for user workloads.
PreferSpreadRevisionOverNodes AffinityType = "prefer-spread-revision-over-nodes"
)

// Config includes the configurations for the controller.
type Config struct {
// QueueSidecarImage is the name of the image used for the queue sidecar
Expand Down Expand Up @@ -214,4 +236,8 @@ type Config struct {

// QueueSidecarRootCA is a root certificate to be trusted by the queue proxy sidecar qpoptions.
QueueSidecarRootCA string

// DefaultAffinityType is a string that controls what affinity rules will be automatically
// applied to the PodSpec of all Knative services.
DefaultAffinityType AffinityType
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"

apiconfig "knative.dev/serving/pkg/apis/config"
deploymentconfig "knative.dev/serving/pkg/deployment"
)

const certVolumeName = "server-certs"
Expand Down Expand Up @@ -150,6 +151,22 @@ func rewriteUserLivenessProbe(p *corev1.Probe, userPort int) {
}
}

func makePreferSpreadRevisionOverNodes(revisionLabelValue string) *corev1.PodAntiAffinity {
return &corev1.PodAntiAffinity{
PreferredDuringSchedulingIgnoredDuringExecution: []corev1.WeightedPodAffinityTerm{{
Weight: 100,
PodAffinityTerm: corev1.PodAffinityTerm{
TopologyKey: corev1.LabelHostname,
LabelSelector: &metav1.LabelSelector{
MatchLabels: map[string]string{
serving.RevisionLabelKey: revisionLabelValue,
},
},
},
}},
}
}

func makePodSpec(rev *v1.Revision, cfg *config.Config) (*corev1.PodSpec, error) {
queueContainer, err := makeQueueContainer(rev, cfg)
tokenVolume := varTokenVolume.DeepCopy()
Expand Down Expand Up @@ -210,6 +227,10 @@ func makePodSpec(rev *v1.Revision, cfg *config.Config) (*corev1.PodSpec, error)
}
}

if cfg.Deployment.DefaultAffinityType == deploymentconfig.PreferSpreadRevisionOverNodes && rev.Spec.Affinity == nil {
podSpec.Affinity = &corev1.Affinity{PodAntiAffinity: makePreferSpreadRevisionOverNodes(rev.Name)}
}

return podSpec, nil
}

Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ knative.dev/networking/pkg/http/stats
knative.dev/networking/pkg/ingress
knative.dev/networking/pkg/k8s
knative.dev/networking/pkg/prober
# knative.dev/pkg v0.0.0-20240603145758-fce44ead15bd
# knative.dev/pkg v0.0.0-20240604134003-58135c2c0694
## explicit; go 1.21
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
Expand Down Expand Up @@ -1224,7 +1224,7 @@ knative.dev/pkg/version
knative.dev/pkg/webhook
knative.dev/pkg/webhook/certificates/resources
knative.dev/pkg/websocket
# knative.dev/serving v0.41.1-0.20240603213049-2fd8465334ec
# knative.dev/serving v0.41.1-0.20240606173551-09b4cd3ec097
## explicit; go 1.21
knative.dev/serving/pkg/activator
knative.dev/serving/pkg/apis/autoscaling
Expand Down

0 comments on commit 5b41ee2

Please sign in to comment.