Skip to content

Commit

Permalink
upgrade to latest dependencies (#1340)
Browse files Browse the repository at this point in the history
bumping knative.dev/networking 29c1fb2...53f45d6:
  > 53f45d6 upgrade to latest dependencies (# 450)
  > 2eeaa06 upgrade to latest dependencies (# 449)
  > 9b6da19 Change default for autocreateClusterDomainClaims (# 447)
  > 07ba22c Update community files (# 446)
  > 4a8bec0 upgrade to latest dependencies (# 445)
  > e291c80 upgrade to latest dependencies (# 444)
  > 91799da upgrade to latest dependencies (# 443)
bumping knative.dev/pkg ed09cd0...dd0db4b:
  > dd0db4b upgrade to latest dependencies (# 2163)
  > 7521c92 drop deprecated enabledComponents field (# 2162)
  > f454995 Update community files (# 2161)
  > 841aa73 fix package name (# 2159)
  > 77ff8d9 Bump k8s min k8s version to 1.19 (# 2157)
  > 192b0c9 Add KReference.Group field and ResolveGroup function (# 2127)
  > b2bf37c upgrade to latest dependencies (# 2156)
bumping knative.dev/hack 66ab1a0...e28525d:
  > e28525d Add knative-release-leads to OWNERS (# 69)
  > 13753fa update owner aliases manually (# 76)
bumping knative.dev/eventing b0b32c4...0cb7873:
  > 0cb7873 ./hack/update-deps.sh --upgrade (# 5545)
  > 95b4275 upgrade to latest dependencies (# 5540)
  > 74d711b Bump deps, fix tests (# 5541)
  > a02a8f2 RetryConfig.RequestTimeout to configure the timeout of a single request (# 5503)
  > 587958f Fix IMC webhook cluster role (# 5539)
  > 9cd2858 Delivery timeout (# 5149)
  > b312f0e Support `KReference.Group` in `Subscription.Spec.Channel` (# 5520)
  > 3247d83 Update community files (# 5530)
  > 39e1be2 upgrade to latest dependencies (# 5519)
  > b164d3c Fix subtest client scope (# 5531)
  > 6adafe5 Implement `KReference.Group` resolution for `Subscriber.Ref` (# 5440)
  > 193809a Use test namespaces with numeric suffix (# 5337)
  > c4bcc3a upgrade to latest dependencies (# 5514)
  > 4eb1738 Add API doc generation to codegen (# 5504)
  > af6744d 💫 Add permission to update namespace finalizer (# 5501)
  > 8a110a1 upgrade to latest dependencies (# 5495)
  > d4244d5 Fix tests (# 5498)
  > fc21a1a pass transformers to executeRequest (# 5512)
  > 02403a5 Remove flaky test (# 5508)
  > 39d1977 Wait for receiver to be done (# 5509)
bumping knative.dev/serving 380a090...c54eeab:
  > c54eeab Update net-kourier nightly (# 11580)
  > 94b240e Update net-istio nightly (# 11576)
  > 478b5e7 Move DomainMapping feature to beta (# 11573)
  > f6c40af install the latest net-istio release first when performing upgrade tests (# 11583)
  > 9ec6fb9 Update net-contour nightly (# 11579)
  > 58ca921 Update community files (# 11584)
  > 110416c Remove YAML anchors (# 11581)
  > 2110f33 upgrade to latest dependencies (# 11577)
  > 913d966 Update net-contour nightly (# 11574)
  > 939accb Update net-certmanager nightly (# 11575)
  > 91d0441 Add short option to scale test (# 11571)
  > 9958145 update names of components (# 11560)
  > eeacc0d nits from # 11551 (# 11570)
  > eee7741 Add $TEST_OPTIONS to hpa test (# 11561)
  > 31d5683 upgrade to latest dependencies (# 11563)
  > add5507 Wait until HPA status is available (# 11562)
  > 8d83ada Set autocreateClusterDomainClaims true for DomainMapping tests 7152b50 (# 11565)
  > a8a5c2d Update net-contour nightly (# 11567)
  > 0ff6b0f Update net-kourier nightly (# 11569)
  > 28fae98 Update net-istio nightly (# 11568)
  > 6d5efe3 Update net-certmanager nightly (# 11566)
  > c8a7098 update ytt files to support smooth renaming of net-* components (# 11551)
  > 010f96a Use https to verify the access when https option is enabled (# 11537)
  > 1c042a1 rename namespace certificate controller & service (# 11559)
  > 4c6b64d Update net-contour nightly (# 11554)
  > 4f509fc Update net-istio nightly (# 11557)
  > c9a9f2f Update net-certmanager nightly (# 11555)
  > c77ba94 Update net-kourier nightly (# 11556)
  > 7624462 Remove unreachable code in testActivatorHA (# 11549)
  > 9298c6b Update community files (# 11550)
  > 629598c Update net-kourier nightly (# 11546)
  > 4d5784b Update net-istio nightly (# 11545)
  > 003e133 upgrade to latest dependencies (# 11543)
  > c9cdc34 Update net-kourier nightly (# 11539)
  > fb38239 Update net-certmanager nightly (# 11542)
  > bf28585 Update net-istio nightly (# 11540)
  > 4195b66 Update net-contour nightly (# 11541)
  > 7103234 Make TestProjectedServiceAccountToken not need to run as root (# 11538)
  > e94b287 upgrade to latest dependencies (# 11536)
  > 4386c6b Update net-contour nightly (# 11527)
  > 183f686 Update net-istio nightly (# 11526)
  > e1a5164 Revert "Temporarily remove routetags for queue metrics (# 8969)" (# 11534)
  > 561d9d0 upgrade to latest dependencies (# 11530)
  > b2ad8e0 Update net-certmanager nightly (# 11528)
  > 36883da Update net-kourier nightly (# 11525)
  > cd8839f Add permission to update namespaces/finalizers (# 11517)
  > d638cf7 upgrade to latest dependencies (# 11524)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation authored Jun 24, 2021
1 parent 8ac780f commit 46297a7
Show file tree
Hide file tree
Showing 50 changed files with 392 additions and 102 deletions.
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ require (
k8s.io/cli-runtime v0.20.7
k8s.io/client-go v0.20.7
k8s.io/code-generator v0.20.7
knative.dev/eventing v0.23.1-0.20210614135520-b0b32c47d7d3
knative.dev/hack v0.0.0-20210614141220-66ab1a098940
knative.dev/networking v0.0.0-20210614195820-29c1fb2f824d
knative.dev/pkg v0.0.0-20210614053220-ed09cd052101
knative.dev/serving v0.23.1-0.20210614141420-380a090c2039
knative.dev/eventing v0.23.1-0.20210623160544-0cb787308255
knative.dev/hack v0.0.0-20210622141627-e28525d8d260
knative.dev/networking v0.0.0-20210622182128-53f45d6d2cfa
knative.dev/pkg v0.0.0-20210622173328-dd0db4b05c80
knative.dev/serving v0.23.1-0.20210623204144-c54eeabbb984
sigs.k8s.io/yaml v1.2.0
)

Expand Down
98 changes: 17 additions & 81 deletions go.sum

Large diffs are not rendered by default.

Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
21 changes: 21 additions & 0 deletions vendor/knative.dev/eventing/pkg/apis/duck/v1/delivery_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"

"github.com/rickb777/date/period"
"knative.dev/eventing/pkg/apis/feature"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"
)
Expand All @@ -37,6 +38,15 @@ type DeliverySpec struct {
// +optional
Retry *int32 `json:"retry,omitempty"`

// Timeout is the timeout of each single request. The value must be greater than 0.
// More information on Duration format:
// - https://www.iso.org/iso-8601-date-and-time-format.html
// - https://en.wikipedia.org/wiki/ISO_8601
//
// Note: This API is EXPERIMENTAL and might break anytime. For more details: https://github.com/knative/eventing/issues/5148
// +optional
Timeout *string `json:"timeout,omitempty"`

// BackoffPolicy is the retry backoff policy (linear, exponential).
// +optional
BackoffPolicy *BackoffPolicyType `json:"backoffPolicy,omitempty"`
Expand Down Expand Up @@ -65,6 +75,17 @@ func (ds *DeliverySpec) Validate(ctx context.Context) *apis.FieldError {
errs = errs.Also(apis.ErrInvalidValue(*ds.Retry, "retry"))
}

if ds.Timeout != nil {
if feature.FromContext(ctx).IsEnabled(feature.DeliveryTimeout) {
t, te := period.Parse(*ds.Timeout)
if te != nil || t.IsZero() {
errs = errs.Also(apis.ErrInvalidValue(*ds.Timeout, "timeout"))
}
} else {
errs = errs.Also(apis.ErrDisallowedFields("timeout"))
}
}

if ds.BackoffPolicy != nil {
switch *ds.BackoffPolicy {
case BackoffPolicyExponential, BackoffPolicyLinear:
Expand Down

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

85 changes: 85 additions & 0 deletions vendor/knative.dev/eventing/pkg/apis/feature/api_validation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
Copyright 2021 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 feature

import (
"context"
"fmt"
"reflect"
"strings"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
)

// ValidateAPIFields checks that the experimental features fields are disabled if the experimental flag is disabled.
// experimentalFields can contain a string with dots, to identify sub-structs, like "Destination.Ref.APIVersion"
func ValidateAPIFields(ctx context.Context, featureName string, object interface{}, experimentalFields ...string) (errs *apis.FieldError) {
obj := reflect.ValueOf(object)
obj = reflect.Indirect(obj)
if obj.Kind() != reflect.Struct {
return nil
}

// If feature not enabled, let's check the field is not used
if !FromContext(ctx).IsEnabled(featureName) {
for _, fieldName := range experimentalFields {
fieldVal := walk(obj, strings.Split(fieldName, ".")...)

if !fieldVal.IsZero() {
errs = errs.Also(&apis.FieldError{
Message: fmt.Sprintf("Disallowed field because the experimental feature '%s' is disabled", featureName),
Paths: []string{fmt.Sprintf("%s.%s", obj.Type().Name(), fieldName)},
})
}
}
}

return errs
}

// ValidateAnnotations checks that the experimental features annotations are disabled if the experimental flag is disabled
func ValidateAnnotations(ctx context.Context, featureName string, object metav1.Object, experimentalAnnotations ...string) (errs *apis.FieldError) {
// If feature not enabled, let's check the annotation is not used
if !FromContext(ctx).IsEnabled(featureName) {
for _, annotation := range experimentalAnnotations {
if _, ok := object.GetAnnotations()[annotation]; ok {
errs = errs.Also(&apis.FieldError{
Message: fmt.Sprintf("Disallowed annotation because the experimental feature '%s' is disabled", featureName),
Paths: []string{annotation},
})
}
}
}

return errs
}

func walk(value reflect.Value, paths ...string) reflect.Value {
switch value.Kind() {
case reflect.Struct:
newVal := value.FieldByName(paths[0])
if len(paths) == 1 {
return newVal
}
return walk(value.FieldByName(paths[0]), paths[1:]...)
case reflect.Ptr:
return walk(reflect.Indirect(value), paths...)
default:
return reflect.Zero(value.Type())
}
}
80 changes: 80 additions & 0 deletions vendor/knative.dev/eventing/pkg/apis/feature/features.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
Copyright 2021 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 feature

import (
"fmt"
"strings"

corev1 "k8s.io/api/core/v1"
)

// Flag is a string value which can be either Enabled, Disabled, or Allowed.
type Flag string

const (
// Enabled turns on an optional behavior.
Enabled Flag = "Enabled"
// Disabled turns off an optional behavior.
Disabled Flag = "Disabled"
// Allowed neither explicitly disables or enables a behavior.
// eg. allow a client to control behavior with an annotation or allow a new value through validation.
Allowed Flag = "Allowed"
)

// Flags is a map containing all the enabled/disabled flags for the experimental features.
// Missing entry in the map means feature is equal to feature not enabled.
type Flags map[string]Flag

// IsEnabled returns true if the feature is enabled
func (e Flags) IsEnabled(featureName string) bool {
return e != nil && e[featureName] == Enabled
}

// IsAllowed returns true if the feature is enabled or allowed
func (e Flags) IsAllowed(featureName string) bool {
return e.IsEnabled(featureName) || (e != nil && e[featureName] == Allowed)
}

// NewFlagsConfigFromMap creates a Flags from the supplied Map
func NewFlagsConfigFromMap(data map[string]string) (Flags, error) {
flags := Flags{}

for k, v := range data {
if strings.HasPrefix(k, "_") {
// Ignore all the keys starting with _
continue
}
sanitizedKey := strings.TrimSpace(k)
if strings.EqualFold(v, string(Allowed)) {
flags[sanitizedKey] = Allowed
} else if strings.EqualFold(v, string(Disabled)) {
flags[sanitizedKey] = Disabled
} else if strings.EqualFold(v, string(Enabled)) {
flags[sanitizedKey] = Enabled
} else {
return Flags{}, fmt.Errorf("cannot parse the boolean flag '%s' = '%s'. Allowed values: [true, false]", k, v)
}
}

return flags, nil
}

// NewFlagsConfigFromConfigMap creates a Flags from the supplied configMap
func NewFlagsConfigFromConfigMap(config *corev1.ConfigMap) (Flags, error) {
return NewFlagsConfigFromMap(config.Data)
}
22 changes: 22 additions & 0 deletions vendor/knative.dev/eventing/pkg/apis/feature/flag_names.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Copyright 2021 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 feature

const (
KReferenceGroup = "kreference-group"
DeliveryTimeout = "delivery-timeout"
)
108 changes: 108 additions & 0 deletions vendor/knative.dev/eventing/pkg/apis/feature/store.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
Copyright 2021 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 feature

import (
"context"

duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/configmap"
)

const (
// FlagsConfigName is the name of config map containing the experimental features flags
FlagsConfigName = "config-features"
)

type cfgKey struct{}

// FromContext extracts a Config from the provided context.
func FromContext(ctx context.Context) Flags {
x, ok := ctx.Value(cfgKey{}).(Flags)
if ok {
return x
}
return nil
}

// FromContextOrDefaults is like FromContext, but when no Flags is attached it
// returns an empty Flags.
func FromContextOrDefaults(ctx context.Context) Flags {
if cfg := FromContext(ctx); cfg != nil {
return cfg
}
return Flags{}
}

// ToContext attaches the provided Flags to the provided context, returning the
// new context with the Flags attached.
func ToContext(ctx context.Context, c Flags) context.Context {
return fillContextWithFeatureSpecificFlags(context.WithValue(ctx, cfgKey{}, c), c)
}

// Store is a typed wrapper around configmap.Untyped store to handle our configmaps.
// +k8s:deepcopy-gen=false
type Store struct {
*configmap.UntypedStore
}

// NewStore creates a new store of Configs and optionally calls functions when ConfigMaps are updated.
func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value interface{})) *Store {
store := &Store{
UntypedStore: configmap.NewUntypedStore(
"feature-flags",
logger,
configmap.Constructors{
FlagsConfigName: NewFlagsConfigFromConfigMap,
},
onAfterStore...,
),
}

return store
}

// ToContext attaches the current Config state to the provided context.
func (s *Store) ToContext(ctx context.Context) context.Context {
return ToContext(ctx, s.Load())
}

// IsEnabled is a shortcut for Load().IsEnabled(featureName)
func (s *Store) IsEnabled(featureName string) bool {
return s.Load().IsEnabled(featureName)
}

// IsAllowed is a shortcut for Load().IsAllowed(featureName)
func (s *Store) IsAllowed(featureName string) bool {
return s.Load().IsAllowed(featureName)
}

// Load creates a Config from the current config state of the Store.
func (s *Store) Load() Flags {
loaded := s.UntypedLoad(FlagsConfigName)
if loaded == nil {
return Flags(nil)
}
return loaded.(Flags)
}

func fillContextWithFeatureSpecificFlags(ctx context.Context, flags Flags) context.Context {
if flags.IsEnabled(KReferenceGroup) {
ctx = duckv1.KReferenceGroupAllowed(ctx)
}
return ctx
}
2 changes: 1 addition & 1 deletion vendor/knative.dev/networking/pkg/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func defaultConfig() *Config {
TagTemplate: DefaultTagTemplate,
AutoTLS: false,
HTTPProtocol: HTTPEnabled,
AutocreateClusterDomainClaims: true,
AutocreateClusterDomainClaims: false,
DefaultExternalScheme: "http",
}
}
Expand Down
Loading

0 comments on commit 46297a7

Please sign in to comment.