Skip to content

Commit

Permalink
[master] Auto-update dependencies (knative#128)
Browse files Browse the repository at this point in the history
Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott shashwathi tanzeeb
/cc n3wscott shashwathi tanzeeb
  • Loading branch information
mattmoor authored May 27, 2020
1 parent d62309d commit 4f563d1
Show file tree
Hide file tree
Showing 25 changed files with 238 additions and 60 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ require (
k8s.io/api v0.18.2
k8s.io/apimachinery v0.18.2
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
knative.dev/pkg v0.0.0-20200525211048-874e3e0c13f5
knative.dev/serving v0.15.1-0.20200526164950-5efb4a11746c
knative.dev/test-infra v0.0.0-20200522180958-6a0a9b9d893a
knative.dev/pkg v0.0.0-20200527024749-495174c96651
knative.dev/serving v0.15.1-0.20200527113659-fd494b3d37a7
knative.dev/test-infra v0.0.0-20200527032149-1fa26194e82d
)

replace (
Expand Down
12 changes: 8 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1479,10 +1479,11 @@ knative.dev/pkg v0.0.0-20200515002500-16d7b963416f/go.mod h1:tMOHGbxtRz8zYFGEGpV
knative.dev/pkg v0.0.0-20200519155757-14eb3ae3a5a7 h1:9S2r59HZJF9nKvoRLg5zJzx6XpVlVyvVRqz/C/h6h2s=
knative.dev/pkg v0.0.0-20200519155757-14eb3ae3a5a7/go.mod h1:QgNZTxnwpB/oSpNcfnLVlw+WpEwwyKAvJlvR3hgeltA=
knative.dev/pkg v0.0.0-20200520073958-94316e20e860/go.mod h1:QgNZTxnwpB/oSpNcfnLVlw+WpEwwyKAvJlvR3hgeltA=
knative.dev/pkg v0.0.0-20200525211048-874e3e0c13f5 h1:IceZ3yVS9Yp/9lxs6YlDL/a8lios0kIM2JHCVvDVLxg=
knative.dev/pkg v0.0.0-20200525211048-874e3e0c13f5/go.mod h1:QgNZTxnwpB/oSpNcfnLVlw+WpEwwyKAvJlvR3hgeltA=
knative.dev/serving v0.15.1-0.20200526164950-5efb4a11746c h1:gtSJzuBCJXV8NL1YOOP7rbZwOWPVvKT7TlVO0qV8vgI=
knative.dev/serving v0.15.1-0.20200526164950-5efb4a11746c/go.mod h1:cc+LozTiaDvg3802drxoRta8qovnJbxxbtw5l5mqV3o=
knative.dev/pkg v0.0.0-20200526194649-c48d2ebdae96/go.mod h1:4ipprwHqpqiyYHbrEjSf1kNwL+sJOqHhj1ujO2WxvpE=
knative.dev/pkg v0.0.0-20200527024749-495174c96651 h1:/LhCktTMhJrCDXGg3KCWeSQTLLGy3Ms4AaqM9O/05dI=
knative.dev/pkg v0.0.0-20200527024749-495174c96651/go.mod h1:4ipprwHqpqiyYHbrEjSf1kNwL+sJOqHhj1ujO2WxvpE=
knative.dev/serving v0.15.1-0.20200527113659-fd494b3d37a7 h1:HCbhRRtXbgc2ChknfTgEBXh078cCl2BldfHIKtZe+Io=
knative.dev/serving v0.15.1-0.20200527113659-fd494b3d37a7/go.mod h1:Qv35BrBQ5NYXzwdi+gK4fIZu+Y2S+kxXOG8UfW0T8UE=
knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU=
knative.dev/test-infra v0.0.0-20200513011557-d03429a76034 h1:JxqONCZVS7or+Fv3ebVQoipuIBH7Ig3Qbx170hgIF+A=
Expand All @@ -1492,6 +1493,9 @@ knative.dev/test-infra v0.0.0-20200519161858-554a95a37986 h1:ZDy43jkWPQ75d4l4DGy
knative.dev/test-infra v0.0.0-20200519161858-554a95a37986/go.mod h1:LeNa1Wvn47efeQUkpkn3XG7Fx9Ga+rhAP13SZyjaEGg=
knative.dev/test-infra v0.0.0-20200522180958-6a0a9b9d893a h1:c0qTABRcNoxZVu5gsryLWPZtGa/s4zsvovz0nGefuzg=
knative.dev/test-infra v0.0.0-20200522180958-6a0a9b9d893a/go.mod h1:n9eQkzmSNj8BiqNFl1lzoz68D09uMeJfyOjc132Gbik=
knative.dev/test-infra v0.0.0-20200526171149-39b911556285/go.mod h1:n9eQkzmSNj8BiqNFl1lzoz68D09uMeJfyOjc132Gbik=
knative.dev/test-infra v0.0.0-20200527032149-1fa26194e82d h1:+GIpY1Du4eW4UKj+m/esjmo3NbfgzZ9Ke6x6/6sClco=
knative.dev/test-infra v0.0.0-20200527032149-1fa26194e82d/go.mod h1:n9eQkzmSNj8BiqNFl1lzoz68D09uMeJfyOjc132Gbik=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
Expand Down
5 changes: 5 additions & 0 deletions vendor/knative.dev/pkg/apis/duck/v1/status_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"knative.dev/pkg/apis"
"knative.dev/pkg/apis/duck"
"knative.dev/pkg/kmeta"
)

// +genduck
Expand Down Expand Up @@ -93,6 +94,10 @@ func (s *Status) GetCondition(t apis.ConditionType) *apis.Condition {
// return true the condition type will be copied to the sink
func (source *Status) ConvertTo(ctx context.Context, sink *Status, predicates ...func(apis.ConditionType) bool) {
sink.ObservedGeneration = source.ObservedGeneration
if source.Annotations != nil {
// This will deep copy the map.
sink.Annotations = kmeta.UnionMaps(source.Annotations, nil)
}

conditions := make(apis.Conditions, 0, len(source.Conditions))
for _, c := range source.Conditions {
Expand Down
4 changes: 4 additions & 0 deletions vendor/knative.dev/pkg/apis/duck/v1beta1/status_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"knative.dev/pkg/apis"
"knative.dev/pkg/apis/duck"
"knative.dev/pkg/kmeta"
)

// +genduck
Expand Down Expand Up @@ -107,6 +108,9 @@ func (s *Status) GetCondition(t apis.ConditionType) *apis.Condition {
// ConvertTo helps implement apis.Convertible for types embedding this Status.
func (source *Status) ConvertTo(ctx context.Context, sink *Status) {
sink.ObservedGeneration = source.ObservedGeneration
if source.Annotations != nil {
sink.Annotations = kmeta.UnionMaps(source.Annotations, nil)
}
for _, c := range source.Conditions {
switch c.Type {
// Copy over the "happy" condition, which is the only condition that
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/hack/update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cd ${ROOT_DIR}
# The list of dependencies that we track at HEAD and periodically
# float forward in this repository.
FLOATING_DEPS=(
"knative.dev/test-infra@release-0.15"
"knative.dev/test-infra@master"
)

# Parse flags to determine any we should pass to dep.
Expand Down
20 changes: 11 additions & 9 deletions vendor/knative.dev/pkg/kmeta/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ func CopyMap(a map[string]string) map[string]string {
return ret
}

// UnionMaps returns a map constructed from the union of `a` and `b`,
// where value from `b` wins.
func UnionMaps(a, b map[string]string) map[string]string {
out := make(map[string]string, len(a)+len(b))

for k, v := range a {
out[k] = v
// UnionMaps returns a map constructed from the union of input maps.
// where values from latter maps win.
func UnionMaps(maps ...map[string]string) map[string]string {
if len(maps) == 0 {
return map[string]string{}
}
for k, v := range b {
out[k] = v
out := make(map[string]string, len(maps[0]))

for _, m := range maps {
for k, v := range m {
out[k] = v
}
}
return out
}
Expand Down
1 change: 1 addition & 0 deletions vendor/knative.dev/pkg/webhook/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
w.WriteHeader(http.StatusOK)
}
return
}

// Verify the content type is accurate.
Expand Down
41 changes: 41 additions & 0 deletions vendor/knative.dev/serving/config/core/configmaps/features.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2020 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
#
# https://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.

apiVersion: v1
kind: ConfigMap
metadata:
name: config-features
namespace: knative-serving
labels:
serving.knative.dev/release: devel

data:
_example: |
################################
# #
# EXAMPLE CONFIGURATION #
# #
################################
# This block is not actually functional configuration,
# but serves to illustrate the available configuration
# options and document them in a way that is accessible
# to users that `kubectl edit` this config map.
#
# These sample configuration options may be copied out of
# this example block and unindented to be in the data block
# to actually change the configuration.
# Indicates whether multi container support is enabled
multi-container: "disabled"
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ func (*PodAutoscaler) GetConditionSet() apis.ConditionSet {
return podCondSet
}

// GetGroupVersionKind returns the GVK for the PodAutoscaler.
func (pa *PodAutoscaler) GetGroupVersionKind() schema.GroupVersionKind {
return SchemeGroupVersion.WithKind("PodAutoscaler")
}

// Class returns the Autoscaler class from Annotation or `KPA` if none is set.
func (pa *PodAutoscaler) Class() string {
if c, ok := pa.Annotations[autoscaling.ClassAnnotationKey]; ok {
return c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"knative.dev/serving/pkg/apis/serving"
)

// Validate implements apis.Validatable interface.
func (pa *PodAutoscaler) Validate(ctx context.Context) *apis.FieldError {
return serving.ValidateObjectMetadata(ctx, pa.GetObjectMeta()).ViaField("metadata").
Also(pa.Spec.Validate(apis.WithinSpec(ctx)).ViaField("spec"))
Expand Down
8 changes: 2 additions & 6 deletions vendor/knative.dev/serving/pkg/apis/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const (
DefaultAllowContainerConcurrencyZero bool = true
)

func defaultConfig() *Defaults {
func defaultDefaultsConfig() *Defaults {
return &Defaults{
RevisionTimeoutSeconds: DefaultRevisionTimeoutSeconds,
MaxRevisionTimeoutSeconds: DefaultMaxRevisionTimeoutSeconds,
Expand All @@ -71,12 +71,11 @@ func defaultConfig() *Defaults {

// NewDefaultsConfigFromMap creates a Defaults from the supplied Map.
func NewDefaultsConfigFromMap(data map[string]string) (*Defaults, error) {
nc := defaultConfig()
nc := defaultDefaultsConfig()

if err := cm.Parse(data,
cm.AsString("container-name-template", &nc.UserContainerNameTemplate),

cm.AsBool("enable-multi-container", &nc.EnableMultiContainer),
cm.AsBool("allow-container-concurrency-zero", &nc.AllowContainerConcurrencyZero),

cm.AsInt64("revision-timeout-seconds", &nc.RevisionTimeoutSeconds),
Expand Down Expand Up @@ -123,9 +122,6 @@ func NewDefaultsConfigFromConfigMap(config *corev1.ConfigMap) (*Defaults, error)

// Defaults includes the default values to be populated by the webhook.
type Defaults struct {
// Feature flag to enable multi container support.
EnableMultiContainer bool

RevisionTimeoutSeconds int64
// This is the timeout set for ingress.
// RevisionTimeoutSeconds must be less than this value.
Expand Down
76 changes: 76 additions & 0 deletions vendor/knative.dev/serving/pkg/apis/config/features.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
Copyright 2020 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
https://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 config

import (
"strings"

corev1 "k8s.io/api/core/v1"
cm "knative.dev/pkg/configmap"
)

type Flag string

const (
// FeaturesConfigName is the name of the ConfigMap for the features.
FeaturesConfigName = "config-features"

Enabled Flag = "Enabled"
Allowed Flag = "Allowed"
Disabled Flag = "Disabled"
)

func defaultFeaturesConfig() *Features {
return &Features{
MultiContainer: Disabled,
}
}

// NewFeaturesConfigFromMap creates a Features from the supplied Map
func NewFeaturesConfigFromMap(data map[string]string) (*Features, error) {
nc := defaultFeaturesConfig()

if err := cm.Parse(data, AsFlag("multi-container", &nc.MultiContainer)); err != nil {
return nil, err
}
return nc, nil
}

// NewFeaturesConfigFromConfigMap creates a Features from the supplied ConfigMap
func NewFeaturesConfigFromConfigMap(config *corev1.ConfigMap) (*Features, error) {
return NewFeaturesConfigFromMap(config.Data)
}

// Features specifies which features are allowed by the webhook.
type Features struct {
MultiContainer Flag
}

// AsFlag parses the value at key as a Flag into the target, if it exists.
func AsFlag(key string, target *Flag) cm.ParseFunc {
return func(data map[string]string) error {
if raw, ok := data[key]; ok {
for _, flag := range []Flag{Enabled, Allowed, Disabled} {
if strings.EqualFold(raw, string(flag)) {
*target = flag
return nil
}
}
}
return nil
}
}
7 changes: 6 additions & 1 deletion vendor/knative.dev/serving/pkg/apis/config/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type cfgKey struct{}
// +k8s:deepcopy-gen=false
type Config struct {
Defaults *Defaults
Features *Features
Autoscaler *autoscalerconfig.Config
}

Expand All @@ -48,9 +49,11 @@ func FromContextOrDefaults(ctx context.Context) *Config {
return cfg
}
defaults, _ := NewDefaultsConfigFromMap(map[string]string{})
features, _ := NewFeaturesConfigFromMap(map[string]string{})
autoscaler, _ := autoscalerconfig.NewConfigFromMap(map[string]string{})
return &Config{
Defaults: defaults,
Features: features,
Autoscaler: autoscaler,
}
}
Expand All @@ -71,10 +74,11 @@ type Store struct {
func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value interface{})) *Store {
store := &Store{
UntypedStore: configmap.NewUntypedStore(
"defaults",
"apis",
logger,
configmap.Constructors{
DefaultsConfigName: NewDefaultsConfigFromConfigMap,
FeaturesConfigName: NewFeaturesConfigFromConfigMap,
autoscalerconfig.ConfigName: autoscalerconfig.NewConfigFromConfigMap,
},
onAfterStore...,
Expand All @@ -93,6 +97,7 @@ func (s *Store) ToContext(ctx context.Context) context.Context {
func (s *Store) Load() *Config {
return &Config{
Defaults: s.UntypedLoad(DefaultsConfigName).(*Defaults).DeepCopy(),
Features: s.UntypedLoad(FeaturesConfigName).(*Features).DeepCopy(),
Autoscaler: s.UntypedLoad(autoscalerconfig.ConfigName).(*autoscalerconfig.Config).DeepCopy(),
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,19 @@ type HTTPIngressPath struct {
// +optional
Path string `json:"path,omitempty"`

// RewriteHost rewrites the incoming request's host header. The request will
// then be re-evaluated based on the new host header.
//
// This field is currently experimental and not supported by all Ingress
// implementations.
//
// If RewriteHost is specified, Splits must not be.
RewriteHost string `json:"rewriteHost,omitempty"`

// Splits defines the referenced service endpoints to which the traffic
// will be forwarded to.
//
// If Splits are specified, RewriteHost must not be.
Splits []IngressBackendSplit `json:"splits"`

// AppendHeaders allow specifying additional HTTP headers to add
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ func (h HTTPIngressPath) Validate(ctx context.Context) *apis.FieldError {
return apis.ErrMissingField(apis.CurrentField)
}
var all *apis.FieldError
// Must provide as least one split.
if len(h.Splits) == 0 {
all = all.Also(apis.ErrMissingField("splits"))
} else {
switch {
case len(h.Splits) == 0 && h.RewriteHost == "":
all = all.Also(apis.ErrMissingOneOf("splits", "rewriteHost"))
case len(h.Splits) != 0 && h.RewriteHost != "":
all = all.Also(apis.ErrMultipleOneOf("splits", "rewriteHost"))
case len(h.Splits) != 0:
totalPct := 0
for idx, split := range h.Splits {
if err := split.Validate(ctx); err != nil {
Expand All @@ -108,6 +110,7 @@ func (h HTTPIngressPath) Validate(ctx context.Context) *apis.FieldError {
})
}
}

if h.Retries != nil {
all = all.Also(h.Retries.Validate(ctx).ViaField("retries"))
}
Expand Down
Loading

0 comments on commit 4f563d1

Please sign in to comment.