Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor serving v0.11.0 and run tests against it #545

Merged
merged 2 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
k8s.io/client-go v0.0.0-20191016110837-54936ba21026
knative.dev/eventing v0.10.0
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
sigs.k8s.io/yaml v1.1.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ knative.dev/eventing v0.10.0 h1:dDrOjBWWgloOCUjxR8ixUIh8nqCTbmM5BbGo8rvf1bc=
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/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
knative.dev/serving v0.10.0 h1:T1csznAQrc/DvCE4KROz4NqOtJ24mnU9eF9RMeeYaCc=
knative.dev/serving v0.10.0/go.mod h1:x2n255JS2XBI39tmjZ8CwTxIf9EKNMCrkVuiOttLRm0=
knative.dev/serving v0.11.0 h1:FK8aPpMuiBHZbfBfT+Avxyk11TaIlOMDEw/Va2sw1w0=
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/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
Expand Down
2 changes: 1 addition & 1 deletion test/presubmit-integration-tests-latest-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
# We currently take 0.10.0 for Serving and 0.10.2 for Eventing as the
# latest release version.

export KNATIVE_SERVING_VERSION="0.10.0"
export KNATIVE_SERVING_VERSION="0.11.0"
export KNATIVE_EVENTING_VERSION="0.10.2"
$(dirname $0)/presubmit-tests.sh --integration-tests
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"knative.dev/pkg/apis/duck"
)

// +genduck
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// PodScalable is a duck type that the resources referenced by the
Expand Down
6 changes: 6 additions & 0 deletions vendor/knative.dev/serving/pkg/apis/networking/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ const (
// WildcardCertDomainLabelKey is the label key attached to a certificate to indicate the
// domain for which it was issued.
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
Expand All @@ -95,6 +100,7 @@ const (
ServiceTypePublic ServiceType = "Public"
// ServiceTypeMetrics is the label value for Metrics services. Such services
// are used for meric scraping.
// TODO(5900): Remove after 0.12 is cut.
ServiceTypeMetrics ServiceType = "Metrics"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ limitations under the License.
package v1alpha1

// 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
// information about the modifications that we made.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ var ingressCondSet = apis.NewLivingConditionSet(
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
func (i *Ingress) GetGroupVersionKind() schema.GroupVersionKind {
return SchemeGroupVersion.WithKind("Ingress")
Expand Down Expand Up @@ -71,13 +75,18 @@ func (is *IngressStatus) MarkLoadBalancerReady(lbs []LoadBalancerIngressStatus,
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.
func (is *IngressStatus) MarkLoadBalancerPending() {
func (is *IngressStatus) MarkLoadBalancerNotReady() {
ingressCondSet.Manage(is).MarkUnknown(IngressConditionLoadBalancerReady, "Uninitialized",
"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.
func (is *IngressStatus) MarkIngressNotReady(reason, message string) {
ingressCondSet.Manage(is).MarkUnknown(IngressConditionReady, reason, message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
// by a backend. An Ingress can be configured to give services externally-reachable URLs, load
// 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.
type Ingress struct {
metav1.TypeMeta `json:",inline"`
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/serving/pkg/apis/serving/fieldmask.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func PodSpecMask(in *corev1.PodSpec) *corev1.PodSpec {
out.ServiceAccountName = in.ServiceAccountName
out.Containers = in.Containers
out.Volumes = in.Volumes
out.ImagePullSecrets = in.ImagePullSecrets

// Disallowed fields
// This list is unnecessary, but added here for clarity
Expand All @@ -163,7 +164,6 @@ func PodSpecMask(in *corev1.PodSpec) *corev1.PodSpec {
out.HostIPC = false
out.ShareProcessNamespace = nil
out.SecurityContext = nil
out.ImagePullSecrets = nil
out.Hostname = ""
out.Subdomain = ""
out.Affinity = nil
Expand Down
37 changes: 37 additions & 0 deletions vendor/knative.dev/serving/pkg/apis/serving/metadata_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ package serving

import (
"context"
"fmt"
"strconv"
"strings"

"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/validation"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
"knative.dev/serving/pkg/apis/autoscaling"
Expand Down Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ func (c *Configuration) Validate(ctx context.Context) (errs *apis.FieldError) {

if apis.IsInUpdate(ctx) {
original := apis.GetBaseline(ctx).(*Configuration)
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, c.Spec, original.GetAnnotations(),
c.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
// Don't validate annotations(creator and lastModifier) when configuration owned by service
// 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)
errs = errs.Also(err.ViaField("spec.template"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package v1

import (
"context"
"fmt"
"strings"

"knative.dev/pkg/apis"
Expand Down Expand Up @@ -62,21 +61,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.
if rts.Name != "" {
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.ValidateRevisionName(ctx, rts.Name, rts.GenerateName))
errs = errs.Also(serving.ValidateQueueSidecarAnnotation(rts.Annotations).ViaField("metadata.annotations"))
return errs
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ func (r *Route) Validate(ctx context.Context) *apis.FieldError {

if apis.IsInUpdate(ctx) {
original := apis.GetBaseline(ctx).(*Route)
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, r.Spec, original.GetAnnotations(),
r.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
// Don't validate annotations(creator and lastModifier) when route owned by service
// 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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ func (cs *ConfigurationSpec) SetDefaults(ctx context.Context) {
}
}

cs.GetTemplate().Spec.SetDefaults(ctx)
cs.GetTemplate().SetDefaults(ctx)
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ func (cs *ConfigurationStatus) SetLatestCreatedRevisionName(name string) {

func (cs *ConfigurationStatus) SetLatestReadyRevisionName(name string) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ func (c *Configuration) Validate(ctx context.Context) (errs *apis.FieldError) {

if apis.IsInUpdate(ctx) {
original := apis.GetBaseline(ctx).(*Configuration)
errs = errs.Also(apis.ValidateCreatorAndModifier(original.Spec, c.Spec, original.GetAnnotations(),
c.GetAnnotations(), serving.GroupName).ViaField("metadata.annotations"))
// Don't validate annotations(creator and lastModifier) when configuration owned by service
// 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,
original.Spec.GetTemplate())
errs = errs.Also(err.ViaField("spec.revisionTemplate"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (source *RevisionSpec) ConvertUp(ctx context.Context, sink *v1.RevisionSpec
ServiceAccountName: source.ServiceAccountName,
Containers: []corev1.Container{*source.DeprecatedContainer},
Volumes: source.Volumes,
ImagePullSecrets: source.ImagePullSecrets,
}
case len(source.Containers) == 1:
sink.PodSpec = source.PodSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ func (r *Revision) SetDefaults(ctx context.Context) {
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) {
if v1.IsUpgradeViaDefaulting(ctx) {
v1 := v1.RevisionSpec{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ const (

// QueueAdminPortName specifies the port name for
// 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
// emitted by queue-proxy for autoscaler.
AutoscalingQueueMetricsPortName = "queue-metrics"

// UserQueueMetricsPortName specifies the port name to use for metrics
// emitted by queue-proxy for end user.
UserQueueMetricsPortName = "user-metrics"
UserQueueMetricsPortName = "http-usermetric"

// ServiceQueueMetricsPortName is the name of the port that serves metrics
// on the Kubernetes service.
ServiceQueueMetricsPortName = "metrics"
ServiceQueueMetricsPortName = "http-metrics"
)

var revCondSet = apis.NewLivingConditionSet(
Expand Down
Loading