diff --git a/go.mod b/go.mod index 809117e59c..d336ab2daf 100644 --- a/go.mod +++ b/go.mod @@ -20,11 +20,11 @@ require ( k8s.io/cli-runtime v0.25.2 k8s.io/client-go v0.26.5 k8s.io/code-generator v0.26.5 - knative.dev/eventing v0.37.1-0.20230627143052-8f7409444808 - knative.dev/hack v0.0.0-20230615155948-d7586a218601 - knative.dev/networking v0.0.0-20230622190036-3a75df5dd93d - knative.dev/pkg v0.0.0-20230616134650-eb63a40adfb0 - knative.dev/serving v0.37.1-0.20230626132048-0462ce6dd994 + knative.dev/eventing v0.37.1-0.20230628105954-4b5fde82647d + knative.dev/hack v0.0.0-20230628110129-fc42790854e8 + knative.dev/networking v0.0.0-20230628105954-91821ae96399 + knative.dev/pkg v0.0.0-20230628105954-6eb4b40a9a30 + knative.dev/serving v0.37.1-0.20230628110702-2e7d6e4a0233 sigs.k8s.io/yaml v1.3.0 ) diff --git a/go.sum b/go.sum index 30854a92bb..9d2630b1c9 100644 --- a/go.sum +++ b/go.sum @@ -1063,16 +1063,16 @@ k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+O k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8= k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -knative.dev/eventing v0.37.1-0.20230627143052-8f7409444808 h1:9xzp250Vqqj+3K/306/th9v5u+n1X+cRdNPgD5Ffyn4= -knative.dev/eventing v0.37.1-0.20230627143052-8f7409444808/go.mod h1:MRpJ0pRqodV9mlPvRTLXnUOo0ExPDHyEk04Zxjn3bA0= -knative.dev/hack v0.0.0-20230615155948-d7586a218601 h1:yMe29SMHrAIt3+J+APvf4WVP6cW7ZDtUhh5uxD5ERdA= -knative.dev/hack v0.0.0-20230615155948-d7586a218601/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= -knative.dev/networking v0.0.0-20230622190036-3a75df5dd93d h1:jrODmEPU3SYcmaec2pErrcH5AvXVDdK70XJvblTj7RE= -knative.dev/networking v0.0.0-20230622190036-3a75df5dd93d/go.mod h1:/CM22Ocewr85rfI84I+WUMoOVZSczpsif4fScImHdfU= -knative.dev/pkg v0.0.0-20230616134650-eb63a40adfb0 h1:weQWWxEEbNOPuL4qtGiBZuMSFhcjF/Cu163uktd/xFE= -knative.dev/pkg v0.0.0-20230616134650-eb63a40adfb0/go.mod h1:dqC6IrvyBE7E+oZocs5PkVhq1G59pDTA7r8U17EAKMk= -knative.dev/serving v0.37.1-0.20230626132048-0462ce6dd994 h1:pGlaiue/Ux4Gzlb2eTIPmQksmmrNv5xeXsg9GRW4mWE= -knative.dev/serving v0.37.1-0.20230626132048-0462ce6dd994/go.mod h1:G5sRe4RpjxCaNdRI/EQagvtCioMtjOIdfoboauNMpSk= +knative.dev/eventing v0.37.1-0.20230628105954-4b5fde82647d h1:GF9+9uKyWY32xQa4+JJzH3E2V/wdREpgjFTdMAi1b7A= +knative.dev/eventing v0.37.1-0.20230628105954-4b5fde82647d/go.mod h1:MRpJ0pRqodV9mlPvRTLXnUOo0ExPDHyEk04Zxjn3bA0= +knative.dev/hack v0.0.0-20230628110129-fc42790854e8 h1:l7CnU4IiRB0TTQAWqOSXg9MnB2bxWjx4o/Vw6Yb27eM= +knative.dev/hack v0.0.0-20230628110129-fc42790854e8/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= +knative.dev/networking v0.0.0-20230628105954-91821ae96399 h1:pGHHUiDqIkoYcz9r28Jr186d4dE3TFDpshaMKf72RK0= +knative.dev/networking v0.0.0-20230628105954-91821ae96399/go.mod h1:/CM22Ocewr85rfI84I+WUMoOVZSczpsif4fScImHdfU= +knative.dev/pkg v0.0.0-20230628105954-6eb4b40a9a30 h1:UUjxZMKgK907IfFY3b7xj9sY53c+feiYvzUwPtajN8I= +knative.dev/pkg v0.0.0-20230628105954-6eb4b40a9a30/go.mod h1:dqC6IrvyBE7E+oZocs5PkVhq1G59pDTA7r8U17EAKMk= +knative.dev/serving v0.37.1-0.20230628110702-2e7d6e4a0233 h1:QGEa8Y321Q/lXi/HJpsDEFNJSoEXaG3CZgsiIkwA7c4= +knative.dev/serving v0.37.1-0.20230628110702-2e7d6e4a0233/go.mod h1:G5sRe4RpjxCaNdRI/EQagvtCioMtjOIdfoboauNMpSk= 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= diff --git a/vendor/knative.dev/serving/pkg/apis/serving/register.go b/vendor/knative.dev/serving/pkg/apis/serving/register.go index 51eada3e9d..7fc51964f1 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/register.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/register.go @@ -116,8 +116,27 @@ const ( // QueueSidecarResourcePercentageAnnotationKey is the percentage of user container resources to be used for queue-proxy // It has to be in [0.1,100] + // Deprecated: Please consider setting resources explicitly for the QP per service, see `QueueSidecarCPUResourceRequestAnnotationKey` for example. QueueSidecarResourcePercentageAnnotationKey = "queue.sidecar." + GroupName + "/resource-percentage" + // QueueSidecarCPUResourceRequestAnnotationKey is the explicit value of the cpu request for queue-proxy's request resources + QueueSidecarCPUResourceRequestAnnotationKey = "queue.sidecar." + GroupName + "/cpu-resource-request" + + // QueueSidecarCPUResourceLimitAnnotationKey is the explicit value of the cpu limit for queue-proxy's limit resources + QueueSidecarCPUResourceLimitAnnotationKey = "queue.sidecar." + GroupName + "/cpu-resource-limit" + + // QueueSidecarMemoryResourceRequestAnnotationKey is the explicit value of the memory request for queue-proxy's request resources + QueueSidecarMemoryResourceRequestAnnotationKey = "queue.sidecar." + GroupName + "/memory-resource-request" + + // QueueSidecarMemoryResourceLimitAnnotationKey is the explicit value of the memory limit for queue-proxy's limit resources + QueueSidecarMemoryResourceLimitAnnotationKey = "queue.sidecar." + GroupName + "/memory-resource-limit" + + // QueueSidecarEphemeralStorageResourceRequestAnnotationKey is the explicit value of the ephemeral storage request for queue-proxy's request resources + QueueSidecarEphemeralStorageResourceRequestAnnotationKey = "queue.sidecar." + GroupName + "/ephemeral-storage-resource-request" + + // QueueSidecarEphemeralStorageResourceLimitAnnotationKey is the explicit value of the ephemeral storage limit for queue-proxy's limit resources + QueueSidecarEphemeralStorageResourceLimitAnnotationKey = "queue.sidecar." + GroupName + "/ephemeral-storage-resource-limit" + // VisibilityClusterLocal is the label value for VisibilityLabelKey // that will result to the Route/KService getting a cluster local // domain suffix. @@ -162,6 +181,24 @@ var ( QueueSidecarResourcePercentageAnnotationKey, "queue.sidecar." + GroupName + "/resourcePercentage", } + QueueSidecarCPUResourceRequestAnnotation = kmap.KeyPriority{ + QueueSidecarCPUResourceRequestAnnotationKey, + } + QueueSidecarCPUResourceLimitAnnotation = kmap.KeyPriority{ + QueueSidecarCPUResourceLimitAnnotationKey, + } + QueueSidecarMemoryResourceRequestAnnotation = kmap.KeyPriority{ + QueueSidecarMemoryResourceRequestAnnotationKey, + } + QueueSidecarMemoryResourceLimitAnnotation = kmap.KeyPriority{ + QueueSidecarMemoryResourceLimitAnnotationKey, + } + QueueSidecarEphemeralStorageResourceRequestAnnotation = kmap.KeyPriority{ + QueueSidecarEphemeralStorageResourceRequestAnnotationKey, + } + QueueSidecarEphemeralStorageResourceLimitAnnotation = kmap.KeyPriority{ + QueueSidecarEphemeralStorageResourceLimitAnnotationKey, + } ProgressDeadlineAnnotation = kmap.KeyPriority{ ProgressDeadlineAnnotationKey, } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_validation.go index 9351f91f12..2508bf8bbc 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_validation.go @@ -23,8 +23,10 @@ import ( "strings" "time" + "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/validation" "knative.dev/pkg/apis" + "knative.dev/pkg/kmap" "knative.dev/pkg/kmp" "knative.dev/serving/pkg/apis/autoscaling" "knative.dev/serving/pkg/apis/config" @@ -68,7 +70,7 @@ func (rts *RevisionTemplateSpec) Validate(ctx context.Context) *apis.FieldError // If the RevisionTemplateSpec has a name specified, then check that // it follows the requirements on the name. errs = errs.Also(validateRevisionName(ctx, rts.Name, rts.GenerateName)) - errs = errs.Also(validateQueueSidecarAnnotation(rts.Annotations).ViaField("metadata.annotations")) + errs = errs.Also(validateQueueSidecarResourceAnnotations(rts.Annotations).ViaField("metadata.annotations")) errs = errs.Also(validateProgressDeadlineAnnotation(rts.Annotations).ViaField("metadata.annotations")) return errs } @@ -179,23 +181,42 @@ func validateTimeoutSeconds(ctx context.Context, timeoutSeconds int64) *apis.Fie return nil } -// validateQueueSidecarAnnotation validates QueueSideCarResourcePercentageAnnotation -func validateQueueSidecarAnnotation(m map[string]string) *apis.FieldError { +// validateQueueSidecarResourceAnnotations validates QueueSideCarResourcePercentageAnnotation and other QP resource related annotations. +func validateQueueSidecarResourceAnnotations(m map[string]string) *apis.FieldError { if len(m) == 0 { return nil } - k, v, ok := serving.QueueSidecarResourcePercentageAnnotation.Get(m) - if !ok { - return nil - } - value, err := strconv.ParseFloat(v, 64) - if err != nil { - return apis.ErrInvalidValue(v, apis.CurrentField).ViaKey(k) + + var errs *apis.FieldError + if k, v, ok := serving.QueueSidecarResourcePercentageAnnotation.Get(m); ok { + errs = apis.ErrGeneric("Queue proxy resource percentage annotation is deprecated. Please use the available annotations to explicitly set resource values per service").ViaKey(k).At(apis.WarningLevel) + 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)) + } + } } - if value < 0.1 || value > 100 { - return apis.ErrOutOfBoundsValue(value, 0.1, 100.0, apis.CurrentField).ViaKey(k) + annoKeys := []kmap.KeyPriority{ + serving.QueueSidecarCPUResourceRequestAnnotation, + serving.QueueSidecarCPUResourceLimitAnnotation, + serving.QueueSidecarMemoryResourceRequestAnnotation, + serving.QueueSidecarMemoryResourceLimitAnnotation, + serving.QueueSidecarEphemeralStorageResourceRequestAnnotation, + serving.QueueSidecarEphemeralStorageResourceLimitAnnotation, + } + for _, resAnno := range annoKeys { + k, v, ok := resAnno.Get(m) + if !ok { + continue + } + if _, err := resource.ParseQuantity(v); err != nil { + errs = errs.Also(apis.ErrInvalidValue(v, apis.CurrentField).ViaKey(k)) + } } - return nil + return errs } // ValidateProgressDeadlineAnnotation validates the revision progress deadline annotation. diff --git a/vendor/modules.txt b/vendor/modules.txt index c63c03c1f1..fdd4fb958f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -934,7 +934,7 @@ k8s.io/utils/net k8s.io/utils/pointer k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/eventing v0.37.1-0.20230627143052-8f7409444808 +# knative.dev/eventing v0.37.1-0.20230628105954-4b5fde82647d ## explicit; go 1.19 knative.dev/eventing/pkg/apis/config knative.dev/eventing/pkg/apis/duck @@ -963,10 +963,10 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1/fake knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake -# knative.dev/hack v0.0.0-20230615155948-d7586a218601 +# knative.dev/hack v0.0.0-20230628110129-fc42790854e8 ## explicit; go 1.18 knative.dev/hack -# knative.dev/networking v0.0.0-20230622190036-3a75df5dd93d +# knative.dev/networking v0.0.0-20230628105954-91821ae96399 ## explicit; go 1.18 knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking @@ -981,7 +981,7 @@ knative.dev/networking/pkg/http/probe knative.dev/networking/pkg/http/proxy knative.dev/networking/pkg/http/stats knative.dev/networking/pkg/k8s -# knative.dev/pkg v0.0.0-20230616134650-eb63a40adfb0 +# knative.dev/pkg v0.0.0-20230628105954-6eb4b40a9a30 ## explicit; go 1.18 knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -1031,7 +1031,7 @@ knative.dev/pkg/tracing/config knative.dev/pkg/tracing/propagation knative.dev/pkg/tracing/propagation/tracecontextb3 knative.dev/pkg/tracker -# knative.dev/serving v0.37.1-0.20230626132048-0462ce6dd994 +# knative.dev/serving v0.37.1-0.20230628110702-2e7d6e4a0233 ## explicit; go 1.18 knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1