mirror of https://github.com/knative/client.git
Vendor serving v0.11.0 and run tests against it (#545)
* Vendor serving v0.11.0 * Run tests against serving v0.11.0
This commit is contained in:
parent
7dbb5a5bb0
commit
4f0eb99f8e
2
go.mod
2
go.mod
|
|
@ -21,7 +21,7 @@ require (
|
||||||
k8s.io/client-go v0.0.0-20191016110837-54936ba21026
|
k8s.io/client-go v0.0.0-20191016110837-54936ba21026
|
||||||
knative.dev/eventing v0.10.0
|
knative.dev/eventing v0.10.0
|
||||||
knative.dev/pkg v0.0.0-20191107185656-884d50f09454
|
knative.dev/pkg v0.0.0-20191107185656-884d50f09454
|
||||||
knative.dev/serving v0.10.0
|
knative.dev/serving v0.11.0
|
||||||
knative.dev/test-infra v0.0.0-20191205012837-30f1a1f7b77e
|
knative.dev/test-infra v0.0.0-20191205012837-30f1a1f7b77e
|
||||||
sigs.k8s.io/yaml v1.1.0
|
sigs.k8s.io/yaml v1.1.0
|
||||||
)
|
)
|
||||||
|
|
|
||||||
4
go.sum
4
go.sum
|
|
@ -532,8 +532,8 @@ knative.dev/eventing v0.10.0 h1:dDrOjBWWgloOCUjxR8ixUIh8nqCTbmM5BbGo8rvf1bc=
|
||||||
knative.dev/eventing v0.10.0/go.mod h1:UxweNv8yXhsdHJitcb9R6rmfNaUD2DFi9GWwNRyIs58=
|
knative.dev/eventing v0.10.0/go.mod h1:UxweNv8yXhsdHJitcb9R6rmfNaUD2DFi9GWwNRyIs58=
|
||||||
knative.dev/pkg v0.0.0-20191107185656-884d50f09454 h1:nkslWFyRWaJp3nPDm+GSQOSvN8NpZg8qIYTR+XssNNg=
|
knative.dev/pkg v0.0.0-20191107185656-884d50f09454 h1:nkslWFyRWaJp3nPDm+GSQOSvN8NpZg8qIYTR+XssNNg=
|
||||||
knative.dev/pkg v0.0.0-20191107185656-884d50f09454/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
|
knative.dev/pkg v0.0.0-20191107185656-884d50f09454/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
|
||||||
knative.dev/serving v0.10.0 h1:T1csznAQrc/DvCE4KROz4NqOtJ24mnU9eF9RMeeYaCc=
|
knative.dev/serving v0.11.0 h1:FK8aPpMuiBHZbfBfT+Avxyk11TaIlOMDEw/Va2sw1w0=
|
||||||
knative.dev/serving v0.10.0/go.mod h1:x2n255JS2XBI39tmjZ8CwTxIf9EKNMCrkVuiOttLRm0=
|
knative.dev/serving v0.11.0/go.mod h1:x2n255JS2XBI39tmjZ8CwTxIf9EKNMCrkVuiOttLRm0=
|
||||||
knative.dev/test-infra v0.0.0-20191205012837-30f1a1f7b77e h1:QTlOxV+M072CNdbKkqn6gmLWPETuLs+EiZ/pOv1jcrw=
|
knative.dev/test-infra v0.0.0-20191205012837-30f1a1f7b77e h1:QTlOxV+M072CNdbKkqn6gmLWPETuLs+EiZ/pOv1jcrw=
|
||||||
knative.dev/test-infra v0.0.0-20191205012837-30f1a1f7b77e/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
|
knative.dev/test-infra v0.0.0-20191205012837-30f1a1f7b77e/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
|
||||||
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
|
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,6 @@
|
||||||
# We currently take 0.10.0 for Serving and 0.10.2 for Eventing as the
|
# We currently take 0.10.0 for Serving and 0.10.2 for Eventing as the
|
||||||
# latest release version.
|
# latest release version.
|
||||||
|
|
||||||
export KNATIVE_SERVING_VERSION="0.10.0"
|
export KNATIVE_SERVING_VERSION="0.11.0"
|
||||||
export KNATIVE_EVENTING_VERSION="0.10.2"
|
export KNATIVE_EVENTING_VERSION="0.10.2"
|
||||||
$(dirname $0)/presubmit-tests.sh --integration-tests
|
$(dirname $0)/presubmit-tests.sh --integration-tests
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"knative.dev/pkg/apis/duck"
|
"knative.dev/pkg/apis/duck"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// +genduck
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
// PodScalable is a duck type that the resources referenced by the
|
// PodScalable is a duck type that the resources referenced by the
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,11 @@ const (
|
||||||
// WildcardCertDomainLabelKey is the label key attached to a certificate to indicate the
|
// WildcardCertDomainLabelKey is the label key attached to a certificate to indicate the
|
||||||
// domain for which it was issued.
|
// domain for which it was issued.
|
||||||
WildcardCertDomainLabelKey = "networking.knative.dev/wildcardDomain"
|
WildcardCertDomainLabelKey = "networking.knative.dev/wildcardDomain"
|
||||||
|
|
||||||
|
// KnativeIngressGateway is the name of the ingress gateway
|
||||||
|
KnativeIngressGateway = "knative-ingress-gateway"
|
||||||
|
// ClusterLocalGateway is the name of the local gateway
|
||||||
|
ClusterLocalGateway = "cluster-local-gateway"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceType is the enumeration type for the Kubernetes services
|
// ServiceType is the enumeration type for the Kubernetes services
|
||||||
|
|
@ -95,6 +100,7 @@ const (
|
||||||
ServiceTypePublic ServiceType = "Public"
|
ServiceTypePublic ServiceType = "Public"
|
||||||
// ServiceTypeMetrics is the label value for Metrics services. Such services
|
// ServiceTypeMetrics is the label value for Metrics services. Such services
|
||||||
// are used for meric scraping.
|
// are used for meric scraping.
|
||||||
|
// TODO(5900): Remove after 0.12 is cut.
|
||||||
ServiceTypeMetrics ServiceType = "Metrics"
|
ServiceTypeMetrics ServiceType = "Metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,6 @@ limitations under the License.
|
||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
// Ingress is heavily based on K8s Ingress
|
// Ingress is heavily based on K8s Ingress
|
||||||
// https://godoc.org/k8s.io/api/extensions/v1beta1#Ingress with some
|
// https://godoc.org/k8s.io/api/networking/v1beta1#Ingress with some
|
||||||
// highlighted modifications. See ingress_types.go for more
|
// highlighted modifications. See ingress_types.go for more
|
||||||
// information about the modifications that we made.
|
// information about the modifications that we made.
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright 2019 The Knative 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 v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"knative.dev/pkg/kmeta"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IngressAccessor interfaces that exposes members of an Ingress
|
|
||||||
type IngressAccessor interface {
|
|
||||||
kmeta.OwnerRefableAccessor
|
|
||||||
|
|
||||||
GetStatus() *IngressStatus
|
|
||||||
SetStatus(IngressStatus)
|
|
||||||
|
|
||||||
GetSpec() *IngressSpec
|
|
||||||
SetSpec(IngressSpec)
|
|
||||||
|
|
||||||
// lifecycle methods
|
|
||||||
IsPublic() bool
|
|
||||||
// defaults methods
|
|
||||||
SetDefaults(ctx context.Context)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetStatus returns Status of an Ingress
|
|
||||||
func (ingress *Ingress) GetStatus() *IngressStatus {
|
|
||||||
return &ingress.Status
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetSpec returns Spec of an Ingress
|
|
||||||
func (ingress *Ingress) GetSpec() *IngressSpec {
|
|
||||||
return &ingress.Spec
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetStatus assigns ingress status
|
|
||||||
func (ingress *Ingress) SetStatus(status IngressStatus) {
|
|
||||||
ingress.Status = status
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetSpec assigns ingress spec
|
|
||||||
func (ingress *Ingress) SetSpec(spec IngressSpec) {
|
|
||||||
ingress.Spec = spec
|
|
||||||
}
|
|
||||||
|
|
@ -29,6 +29,10 @@ var ingressCondSet = apis.NewLivingConditionSet(
|
||||||
IngressConditionLoadBalancerReady,
|
IngressConditionLoadBalancerReady,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// VirtualServiceNotReconciled is used for the reason of MarkLoadBalancerFailed
|
||||||
|
// when VirtualService is failed to be reconciled.
|
||||||
|
var VirtualServiceNotReconciled = "ReconcileVirtualServiceFailed"
|
||||||
|
|
||||||
// GetGroupVersionKind returns SchemeGroupVersion of an Ingress
|
// GetGroupVersionKind returns SchemeGroupVersion of an Ingress
|
||||||
func (i *Ingress) GetGroupVersionKind() schema.GroupVersionKind {
|
func (i *Ingress) GetGroupVersionKind() schema.GroupVersionKind {
|
||||||
return SchemeGroupVersion.WithKind("Ingress")
|
return SchemeGroupVersion.WithKind("Ingress")
|
||||||
|
|
@ -71,13 +75,18 @@ func (is *IngressStatus) MarkLoadBalancerReady(lbs []LoadBalancerIngressStatus,
|
||||||
ingressCondSet.Manage(is).MarkTrue(IngressConditionLoadBalancerReady)
|
ingressCondSet.Manage(is).MarkTrue(IngressConditionLoadBalancerReady)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkLoadBalancerPending marks the "IngressConditionLoadBalancerReady" condition to unknown to
|
// MarkLoadBalancerNotReady marks the "IngressConditionLoadBalancerReady" condition to unknown to
|
||||||
// reflect that the load balancer is not ready yet.
|
// reflect that the load balancer is not ready yet.
|
||||||
func (is *IngressStatus) MarkLoadBalancerPending() {
|
func (is *IngressStatus) MarkLoadBalancerNotReady() {
|
||||||
ingressCondSet.Manage(is).MarkUnknown(IngressConditionLoadBalancerReady, "Uninitialized",
|
ingressCondSet.Manage(is).MarkUnknown(IngressConditionLoadBalancerReady, "Uninitialized",
|
||||||
"Waiting for VirtualService to be ready")
|
"Waiting for VirtualService to be ready")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarkLoadBalancerFailed marks the "IngressConditionLoadBalancerReady" condition to false.
|
||||||
|
func (is *IngressStatus) MarkLoadBalancerFailed(reason, message string) {
|
||||||
|
ingressCondSet.Manage(is).MarkFalse(IngressConditionLoadBalancerReady, reason, message)
|
||||||
|
}
|
||||||
|
|
||||||
// MarkIngressNotReady marks the "IngressConditionReady" condition to unknown.
|
// MarkIngressNotReady marks the "IngressConditionReady" condition to unknown.
|
||||||
func (is *IngressStatus) MarkIngressNotReady(reason, message string) {
|
func (is *IngressStatus) MarkIngressNotReady(reason, message string) {
|
||||||
ingressCondSet.Manage(is).MarkUnknown(IngressConditionReady, reason, message)
|
ingressCondSet.Manage(is).MarkUnknown(IngressConditionReady, reason, message)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import (
|
||||||
// by a backend. An Ingress can be configured to give services externally-reachable URLs, load
|
// by a backend. An Ingress can be configured to give services externally-reachable URLs, load
|
||||||
// balance traffic, offer name based virtual hosting, etc.
|
// balance traffic, offer name based virtual hosting, etc.
|
||||||
//
|
//
|
||||||
// This is heavily based on K8s Ingress https://godoc.org/k8s.io/api/extensions/v1beta1#Ingress
|
// This is heavily based on K8s Ingress https://godoc.org/k8s.io/api/networking/v1beta1#Ingress
|
||||||
// which some highlighted modifications.
|
// which some highlighted modifications.
|
||||||
type Ingress struct {
|
type Ingress struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,7 @@ func PodSpecMask(in *corev1.PodSpec) *corev1.PodSpec {
|
||||||
out.ServiceAccountName = in.ServiceAccountName
|
out.ServiceAccountName = in.ServiceAccountName
|
||||||
out.Containers = in.Containers
|
out.Containers = in.Containers
|
||||||
out.Volumes = in.Volumes
|
out.Volumes = in.Volumes
|
||||||
|
out.ImagePullSecrets = in.ImagePullSecrets
|
||||||
|
|
||||||
// Disallowed fields
|
// Disallowed fields
|
||||||
// This list is unnecessary, but added here for clarity
|
// This list is unnecessary, but added here for clarity
|
||||||
|
|
@ -163,7 +164,6 @@ func PodSpecMask(in *corev1.PodSpec) *corev1.PodSpec {
|
||||||
out.HostIPC = false
|
out.HostIPC = false
|
||||||
out.ShareProcessNamespace = nil
|
out.ShareProcessNamespace = nil
|
||||||
out.SecurityContext = nil
|
out.SecurityContext = nil
|
||||||
out.ImagePullSecrets = nil
|
|
||||||
out.Hostname = ""
|
out.Hostname = ""
|
||||||
out.Subdomain = ""
|
out.Subdomain = ""
|
||||||
out.Affinity = nil
|
out.Affinity = nil
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,12 @@ package serving
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/api/equality"
|
"k8s.io/apimachinery/pkg/api/equality"
|
||||||
|
"k8s.io/apimachinery/pkg/api/validation"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"knative.dev/pkg/apis"
|
"knative.dev/pkg/apis"
|
||||||
"knative.dev/serving/pkg/apis/autoscaling"
|
"knative.dev/serving/pkg/apis/autoscaling"
|
||||||
|
|
@ -132,3 +134,38 @@ func SetUserInfo(ctx context.Context, oldSpec, newSpec, resource interface{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ValidateRevisionName validates name and generateName for the revisionTemplate
|
||||||
|
func ValidateRevisionName(ctx context.Context, name, generateName string) *apis.FieldError {
|
||||||
|
if generateName != "" {
|
||||||
|
if msgs := validation.NameIsDNS1035Label(generateName, true); len(msgs) > 0 {
|
||||||
|
return apis.ErrInvalidValue(
|
||||||
|
fmt.Sprintf("not a DNS 1035 label prefix: %v", msgs),
|
||||||
|
"metadata.generateName")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if name != "" {
|
||||||
|
if msgs := validation.NameIsDNS1035Label(name, false); len(msgs) > 0 {
|
||||||
|
return apis.ErrInvalidValue(
|
||||||
|
fmt.Sprintf("not a DNS 1035 label: %v", msgs),
|
||||||
|
"metadata.name")
|
||||||
|
}
|
||||||
|
om := apis.ParentMeta(ctx)
|
||||||
|
prefix := om.Name + "-"
|
||||||
|
if om.Name != "" {
|
||||||
|
// Even if there is GenerateName, allow the use
|
||||||
|
// of Name post-creation.
|
||||||
|
} else if om.GenerateName != "" {
|
||||||
|
// We disallow bringing your own name when the parent
|
||||||
|
// resource uses generateName (at creation).
|
||||||
|
return apis.ErrDisallowedFields("metadata.name")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !strings.HasPrefix(name, prefix) {
|
||||||
|
return apis.ErrInvalidValue(
|
||||||
|
fmt.Sprintf("%q must have prefix %q", name, prefix),
|
||||||
|
"metadata.name")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,12 @@ func (c *Configuration) Validate(ctx context.Context) (errs *apis.FieldError) {
|
||||||
|
|
||||||
if apis.IsInUpdate(ctx) {
|
if apis.IsInUpdate(ctx) {
|
||||||
original := apis.GetBaseline(ctx).(*Configuration)
|
original := apis.GetBaseline(ctx).(*Configuration)
|
||||||
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, c.Spec, original.GetAnnotations(),
|
// Don't validate annotations(creator and lastModifier) when configuration owned by service
|
||||||
c.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
// validate only when configuration created independently.
|
||||||
|
if c.OwnerReferences == nil {
|
||||||
|
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, c.Spec, original.GetAnnotations(),
|
||||||
|
c.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
||||||
|
}
|
||||||
err := c.Spec.Template.VerifyNameChange(ctx, original.Spec.Template)
|
err := c.Spec.Template.VerifyNameChange(ctx, original.Spec.Template)
|
||||||
errs = errs.Also(err.ViaField("spec.template"))
|
errs = errs.Also(err.ViaField("spec.template"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"knative.dev/pkg/apis"
|
"knative.dev/pkg/apis"
|
||||||
|
|
@ -62,21 +61,7 @@ func (rts *RevisionTemplateSpec) Validate(ctx context.Context) *apis.FieldError
|
||||||
|
|
||||||
// If the RevisionTemplateSpec has a name specified, then check that
|
// If the RevisionTemplateSpec has a name specified, then check that
|
||||||
// it follows the requirements on the name.
|
// it follows the requirements on the name.
|
||||||
if rts.Name != "" {
|
errs = errs.Also(serving.ValidateRevisionName(ctx, rts.Name, rts.GenerateName))
|
||||||
var prefix string
|
|
||||||
if om := apis.ParentMeta(ctx); om.Name == "" {
|
|
||||||
prefix = om.GenerateName
|
|
||||||
} else {
|
|
||||||
prefix = om.Name + "-"
|
|
||||||
}
|
|
||||||
|
|
||||||
if !strings.HasPrefix(rts.Name, prefix) {
|
|
||||||
errs = errs.Also(apis.ErrInvalidValue(
|
|
||||||
fmt.Sprintf("%q must have prefix %q", rts.Name, prefix),
|
|
||||||
"metadata.name"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
errs = errs.Also(serving.ValidateQueueSidecarAnnotation(rts.Annotations).ViaField("metadata.annotations"))
|
errs = errs.Also(serving.ValidateQueueSidecarAnnotation(rts.Annotations).ViaField("metadata.annotations"))
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,12 @@ func (r *Route) Validate(ctx context.Context) *apis.FieldError {
|
||||||
|
|
||||||
if apis.IsInUpdate(ctx) {
|
if apis.IsInUpdate(ctx) {
|
||||||
original := apis.GetBaseline(ctx).(*Route)
|
original := apis.GetBaseline(ctx).(*Route)
|
||||||
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, r.Spec, original.GetAnnotations(),
|
// Don't validate annotations(creator and lastModifier) when route owned by service
|
||||||
r.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
// validate only when route created independently.
|
||||||
|
if r.OwnerReferences == nil {
|
||||||
|
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, r.Spec, original.GetAnnotations(),
|
||||||
|
r.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,5 +48,5 @@ func (cs *ConfigurationSpec) SetDefaults(ctx context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cs.GetTemplate().Spec.SetDefaults(ctx)
|
cs.GetTemplate().SetDefaults(ctx)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,9 @@ func (cs *ConfigurationStatus) SetLatestCreatedRevisionName(name string) {
|
||||||
|
|
||||||
func (cs *ConfigurationStatus) SetLatestReadyRevisionName(name string) {
|
func (cs *ConfigurationStatus) SetLatestReadyRevisionName(name string) {
|
||||||
cs.LatestReadyRevisionName = name
|
cs.LatestReadyRevisionName = name
|
||||||
confCondSet.Manage(cs).MarkTrue(ConfigurationConditionReady)
|
if cs.LatestReadyRevisionName == cs.LatestCreatedRevisionName {
|
||||||
|
confCondSet.Manage(cs).MarkTrue(ConfigurationConditionReady)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *ConfigurationStatus) MarkLatestCreatedFailed(name, message string) {
|
func (cs *ConfigurationStatus) MarkLatestCreatedFailed(name, message string) {
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,12 @@ func (c *Configuration) Validate(ctx context.Context) (errs *apis.FieldError) {
|
||||||
|
|
||||||
if apis.IsInUpdate(ctx) {
|
if apis.IsInUpdate(ctx) {
|
||||||
original := apis.GetBaseline(ctx).(*Configuration)
|
original := apis.GetBaseline(ctx).(*Configuration)
|
||||||
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, c.Spec, original.GetAnnotations(),
|
// Don't validate annotations(creator and lastModifier) when configuration owned by service
|
||||||
c.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
// validate only when configuration created independently.
|
||||||
|
if c.GetOwnerReferences() == nil {
|
||||||
|
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, c.Spec, original.GetAnnotations(),
|
||||||
|
c.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
||||||
|
}
|
||||||
err := c.Spec.GetTemplate().VerifyNameChange(ctx,
|
err := c.Spec.GetTemplate().VerifyNameChange(ctx,
|
||||||
original.Spec.GetTemplate())
|
original.Spec.GetTemplate())
|
||||||
errs = errs.Also(err.ViaField("spec.revisionTemplate"))
|
errs = errs.Also(err.ViaField("spec.revisionTemplate"))
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ func (source *RevisionSpec) ConvertUp(ctx context.Context, sink *v1.RevisionSpec
|
||||||
ServiceAccountName: source.ServiceAccountName,
|
ServiceAccountName: source.ServiceAccountName,
|
||||||
Containers: []corev1.Container{*source.DeprecatedContainer},
|
Containers: []corev1.Container{*source.DeprecatedContainer},
|
||||||
Volumes: source.Volumes,
|
Volumes: source.Volumes,
|
||||||
|
ImagePullSecrets: source.ImagePullSecrets,
|
||||||
}
|
}
|
||||||
case len(source.Containers) == 1:
|
case len(source.Containers) == 1:
|
||||||
sink.PodSpec = source.PodSpec
|
sink.PodSpec = source.PodSpec
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@ func (r *Revision) SetDefaults(ctx context.Context) {
|
||||||
r.Spec.SetDefaults(apis.WithinSpec(ctx))
|
r.Spec.SetDefaults(apis.WithinSpec(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetDefaults implements apis.Defaultable
|
||||||
|
func (rts *RevisionTemplateSpec) SetDefaults(ctx context.Context) {
|
||||||
|
rts.Spec.SetDefaults(apis.WithinSpec(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
func (rs *RevisionSpec) SetDefaults(ctx context.Context) {
|
func (rs *RevisionSpec) SetDefaults(ctx context.Context) {
|
||||||
if v1.IsUpgradeViaDefaulting(ctx) {
|
if v1.IsUpgradeViaDefaulting(ctx) {
|
||||||
v1 := v1.RevisionSpec{}
|
v1 := v1.RevisionSpec{}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ const (
|
||||||
|
|
||||||
// QueueAdminPortName specifies the port name for
|
// QueueAdminPortName specifies the port name for
|
||||||
// health check and lifecycle hooks for queue-proxy.
|
// health check and lifecycle hooks for queue-proxy.
|
||||||
QueueAdminPortName string = "queueadm-port"
|
QueueAdminPortName string = "http-queueadm"
|
||||||
|
|
||||||
// AutoscalingQueueMetricsPortName specifies the port name to use for metrics
|
// AutoscalingQueueMetricsPortName specifies the port name to use for metrics
|
||||||
// emitted by queue-proxy for autoscaler.
|
// emitted by queue-proxy for autoscaler.
|
||||||
|
|
@ -52,11 +52,11 @@ const (
|
||||||
|
|
||||||
// UserQueueMetricsPortName specifies the port name to use for metrics
|
// UserQueueMetricsPortName specifies the port name to use for metrics
|
||||||
// emitted by queue-proxy for end user.
|
// emitted by queue-proxy for end user.
|
||||||
UserQueueMetricsPortName = "user-metrics"
|
UserQueueMetricsPortName = "http-usermetric"
|
||||||
|
|
||||||
// ServiceQueueMetricsPortName is the name of the port that serves metrics
|
// ServiceQueueMetricsPortName is the name of the port that serves metrics
|
||||||
// on the Kubernetes service.
|
// on the Kubernetes service.
|
||||||
ServiceQueueMetricsPortName = "metrics"
|
ServiceQueueMetricsPortName = "http-metrics"
|
||||||
)
|
)
|
||||||
|
|
||||||
var revCondSet = apis.NewLivingConditionSet(
|
var revCondSet = apis.NewLivingConditionSet(
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/api/equality"
|
"k8s.io/apimachinery/pkg/api/equality"
|
||||||
"knative.dev/pkg/apis"
|
"knative.dev/pkg/apis"
|
||||||
|
|
@ -61,28 +59,9 @@ func (r *Revision) Validate(ctx context.Context) *apis.FieldError {
|
||||||
func (rt *RevisionTemplateSpec) Validate(ctx context.Context) *apis.FieldError {
|
func (rt *RevisionTemplateSpec) Validate(ctx context.Context) *apis.FieldError {
|
||||||
errs := rt.Spec.Validate(ctx).ViaField("spec")
|
errs := rt.Spec.Validate(ctx).ViaField("spec")
|
||||||
errs = errs.Also(autoscaling.ValidateAnnotations(rt.GetAnnotations()).ViaField("metadata.annotations"))
|
errs = errs.Also(autoscaling.ValidateAnnotations(rt.GetAnnotations()).ViaField("metadata.annotations"))
|
||||||
|
|
||||||
// If the DeprecatedRevisionTemplate has a name specified, then check that
|
// If the DeprecatedRevisionTemplate has a name specified, then check that
|
||||||
// it follows the requirements on the name.
|
// it follows the requirements on the name.
|
||||||
if rt.Name != "" {
|
errs = errs.Also(serving.ValidateRevisionName(ctx, rt.Name, rt.GenerateName))
|
||||||
om := apis.ParentMeta(ctx)
|
|
||||||
prefix := om.Name + "-"
|
|
||||||
if om.Name != "" {
|
|
||||||
// Even if there is GenerateName, allow the use
|
|
||||||
// of Name post-creation.
|
|
||||||
} else if om.GenerateName != "" {
|
|
||||||
// We disallow bringing your own name when the parent
|
|
||||||
// resource uses generateName (at creation).
|
|
||||||
return apis.ErrDisallowedFields("metadata.name")
|
|
||||||
}
|
|
||||||
|
|
||||||
if !strings.HasPrefix(rt.Name, prefix) {
|
|
||||||
errs = errs.Also(apis.ErrInvalidValue(
|
|
||||||
fmt.Sprintf("%q must have prefix %q", rt.Name, prefix),
|
|
||||||
"metadata.name"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
errs = errs.Also(serving.ValidateQueueSidecarAnnotation(rt.Annotations).ViaField("metadata.annotations"))
|
errs = errs.Also(serving.ValidateQueueSidecarAnnotation(rt.Annotations).ViaField("metadata.annotations"))
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,12 @@ func (r *Route) Validate(ctx context.Context) *apis.FieldError {
|
||||||
|
|
||||||
if apis.IsInUpdate(ctx) {
|
if apis.IsInUpdate(ctx) {
|
||||||
original := apis.GetBaseline(ctx).(*Route)
|
original := apis.GetBaseline(ctx).(*Route)
|
||||||
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, r.Spec, original.GetAnnotations(),
|
// Don't validate annotations(creator and lastModifier) when route owned by service
|
||||||
r.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
// validate only when route created independently.
|
||||||
|
if r.OwnerReferences == nil {
|
||||||
|
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, r.Spec, original.GetAnnotations(),
|
||||||
|
r.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,12 @@ func (c *Configuration) Validate(ctx context.Context) (errs *apis.FieldError) {
|
||||||
|
|
||||||
if apis.IsInUpdate(ctx) {
|
if apis.IsInUpdate(ctx) {
|
||||||
original := apis.GetBaseline(ctx).(*Configuration)
|
original := apis.GetBaseline(ctx).(*Configuration)
|
||||||
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, c.Spec, original.GetAnnotations(),
|
// Don't validate annotations(creator and lastModifier) when configuration owned by service
|
||||||
c.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
// validate only when configuration created independently.
|
||||||
|
if c.OwnerReferences == nil {
|
||||||
|
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, c.Spec, original.GetAnnotations(),
|
||||||
|
c.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
||||||
|
}
|
||||||
err := c.Spec.Template.VerifyNameChange(ctx, original.Spec.Template)
|
err := c.Spec.Template.VerifyNameChange(ctx, original.Spec.Template)
|
||||||
errs = errs.Also(err.ViaField("spec.template"))
|
errs = errs.Also(err.ViaField("spec.template"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,12 @@ func (r *Route) Validate(ctx context.Context) *apis.FieldError {
|
||||||
|
|
||||||
if apis.IsInUpdate(ctx) {
|
if apis.IsInUpdate(ctx) {
|
||||||
original := apis.GetBaseline(ctx).(*Route)
|
original := apis.GetBaseline(ctx).(*Route)
|
||||||
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, r.Spec, original.GetAnnotations(),
|
// Don't validate annotations(creator and lastModifier) when route owned by service
|
||||||
r.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
// validate only when route created independently.
|
||||||
|
if r.OwnerReferences == nil {
|
||||||
|
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, r.Spec, original.GetAnnotations(),
|
||||||
|
r.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -654,7 +654,7 @@ knative.dev/pkg/logging/logkey
|
||||||
knative.dev/pkg/controller
|
knative.dev/pkg/controller
|
||||||
knative.dev/pkg/metrics
|
knative.dev/pkg/metrics
|
||||||
knative.dev/pkg/metrics/metricskey
|
knative.dev/pkg/metrics/metricskey
|
||||||
# knative.dev/serving v0.10.0
|
# knative.dev/serving v0.11.0
|
||||||
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1
|
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1
|
||||||
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake
|
knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake
|
||||||
knative.dev/serving/pkg/apis/serving
|
knative.dev/serving/pkg/apis/serving
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue