Skip to content

Commit

Permalink
upgrade to latest dependencies (#1411)
Browse files Browse the repository at this point in the history
bumping knative.dev/serving 492d71c...4dc9fc6:
  > 4dc9fc6 Allow setting priorityClassName in pod spec (# 11746)
  > 5710865 Use update API instead of patch API in conformance tests (# 11740)
  > d35a736 Change label and annotation key names in tests from camelCase to lowercase with dash (# 11750)
  > 0493df4 Adding section to DEVELOPMENT.md on updating schemas when iterating (# 11739)
  > 62544bd Adding test for automountServiceAccountToken=true (# 11743)
bumping knative.dev/pkg 889b567...64ab22b:
  > 64ab22b k8s-service-trailing-slash-fix (# 2178)
  > c367a9d Drop Client as it is only used in tests (# 2203)
  > bb4aaf0 Ignore special errors in codegen for events (# 2202)
  > 3826bb2 Add a new mechanism for requeuing a key. (# 2201)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation authored Aug 2, 2021
1 parent 5892b7c commit 4470416
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 11 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ require (
knative.dev/eventing v0.24.1-0.20210729101356-486c3495a26b
knative.dev/hack v0.0.0-20210622141627-e28525d8d260
knative.dev/networking v0.0.0-20210728163216-f3c57a05b7d8
knative.dev/pkg v0.0.0-20210726021015-889b5670e173
knative.dev/serving v0.24.1-0.20210729171456-492d71c96e7a
knative.dev/pkg v0.0.0-20210731072840-64ab22bbaab9
knative.dev/serving v0.24.1-0.20210730215204-4dc9fc69f5b7
sigs.k8s.io/yaml v1.2.0
)

Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1638,11 +1638,12 @@ knative.dev/networking v0.0.0-20210728163216-f3c57a05b7d8/go.mod h1:Q0ou6/Zb4/MY
knative.dev/pkg v0.0.0-20210713175550-7d1b0f19ef71/go.mod h1:d06VsGUT2grnlhA8GcUjsoePok8P859AYcIqWISMGtY=
knative.dev/pkg v0.0.0-20210715175632-d9b7180af6f2/go.mod h1:NYZRIPU+Pv39VfbZV1BtMIe4kCavNle1udsPrvOLm+Y=
knative.dev/pkg v0.0.0-20210722223844-842df75f5c02/go.mod h1:NYZRIPU+Pv39VfbZV1BtMIe4kCavNle1udsPrvOLm+Y=
knative.dev/pkg v0.0.0-20210726021015-889b5670e173 h1:IMxLC9lMWpobbFIu5MU7nENayFs2bVrKLGb4Ge/a4co=
knative.dev/pkg v0.0.0-20210726021015-889b5670e173/go.mod h1:NYZRIPU+Pv39VfbZV1BtMIe4kCavNle1udsPrvOLm+Y=
knative.dev/pkg v0.0.0-20210731072840-64ab22bbaab9 h1:eeRutJPRJ6tR7LVkeaD7H2BaKeKwadHaR66+Z1QRVcs=
knative.dev/pkg v0.0.0-20210731072840-64ab22bbaab9/go.mod h1:NYZRIPU+Pv39VfbZV1BtMIe4kCavNle1udsPrvOLm+Y=
knative.dev/reconciler-test v0.0.0-20210714231231-91e5b206e1d5/go.mod h1:Zp2WHfJuh6+rOpOAq78My82drT4Bxjm/K4etmKcA7ko=
knative.dev/serving v0.24.1-0.20210729171456-492d71c96e7a h1:el6RWF04zES9dCz9tYojnPtVH7OirdW8+PsuLaBS8zU=
knative.dev/serving v0.24.1-0.20210729171456-492d71c96e7a/go.mod h1:Gl5B3ZiPtmzv/yqZhBlnxPdayhTjwrUQwAOhqYyotKE=
knative.dev/serving v0.24.1-0.20210730215204-4dc9fc69f5b7 h1:LFXICwfTyPDNPCLpiSqJ2fnmQsVL8dLhAt1FsOo+fiI=
knative.dev/serving v0.24.1-0.20210730215204-4dc9fc69f5b7/go.mod h1:Gl5B3ZiPtmzv/yqZhBlnxPdayhTjwrUQwAOhqYyotKE=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
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=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ func (g *reconcilerReconcilerGenerator) GenerateType(c *generator.Context, t *ty
Package: "knative.dev/pkg/reconciler",
Name: "DoObserveFinalizeKind",
}),
"controllerIsSkipKey": c.Universe.Function(types.Name{
Package: "knative.dev/pkg/controller",
Name: "IsSkipKey",
}),
"controllerIsRequeueKey": c.Universe.Function(types.Name{
Package: "knative.dev/pkg/controller",
Name: "IsRequeueKey",
}),
}

sw.Do(reconcilerInterfaceFactory, m)
Expand Down Expand Up @@ -517,8 +525,14 @@ func (r *reconcilerImpl) Reconcile(ctx {{.contextContext|raw}}, key string) erro
return nil
}
logger.Errorw("Returned an error", zap.Error(reconcileEvent))
r.Recorder.Event(resource, {{.corev1EventTypeWarning|raw}}, "InternalError", reconcileEvent.Error())
if {{ .controllerIsSkipKey|raw }}(reconcileEvent) {
// This is a wrapped error, don't emit an event.
} else if ok, _ := {{ .controllerIsRequeueKey|raw }}(reconcileEvent); ok {
// This is a wrapped error, don't emit an event.
} else {
logger.Errorw("Returned an error", zap.Error(reconcileEvent))
r.Recorder.Event(resource, {{.corev1EventTypeWarning|raw}}, "InternalError", reconcileEvent.Error())
}
return reconcileEvent
}
Expand Down
49 changes: 49 additions & 0 deletions vendor/knative.dev/pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,12 @@ func (c *Impl) handleErr(err error, key types.NamespacedName, startTime time.Tim
c.workQueue.Forget(key)
return
}
if ok, delay := IsRequeueKey(err); ok {
c.workQueue.AddAfter(key, delay)
c.logger.Debugf("Requeuing key %s (by request) after %v (depth: %d)", safeKey(key), delay, c.workQueue.Len())
return
}

c.logger.Errorw("Reconcile error", zap.Duration("duration", time.Since(startTime)), zap.Error(err))

// Re-queue the key if it's a transient error.
Expand Down Expand Up @@ -666,6 +672,49 @@ func (err permanentError) Unwrap() error {
return err.e
}

// NewRequeueImmediately returns a new instance of requeueKeyError.
// Users can return this type of error to immediately requeue a key.
func NewRequeueImmediately() error {
return requeueKeyError{}
}

// NewRequeueAfter returns a new instance of requeueKeyError.
// Users can return this type of error to requeue a key after a delay.
func NewRequeueAfter(dur time.Duration) error {
return requeueKeyError{duration: dur}
}

// requeueKeyError is an error that indicates the reconciler wants to reprocess
// the key after a particular duration (possibly zero).
// We should re-queue keys with the desired duration when this is returned by Reconcile.
type requeueKeyError struct {
duration time.Duration
}

var _ error = requeueKeyError{}

// Error implements the Error() interface of error.
func (err requeueKeyError) Error() string {
return fmt.Sprintf("requeue after: %s", err.duration)
}

// IsRequeueKey returns true if the given error is a requeueKeyError.
func IsRequeueKey(err error) (bool, time.Duration) {
rqe := requeueKeyError{}
if errors.As(err, &rqe) {
return true, rqe.duration
}
return false, 0
}

// Is implements the Is() interface of error. It returns whether the target
// error can be treated as equivalent to a requeueKeyError.
func (requeueKeyError) Is(target error) bool {
//nolint: errorlint // This check is actually fine.
_, ok := target.(requeueKeyError)
return ok
}

// Informer is the group of methods that a type must implement to be passed to
// StartInformers.
type Informer interface {
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/resolver/addressable_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (r *URIResolver) URIFromObjectReference(ctx context.Context, ref *corev1.Ob
url := &apis.URL{
Scheme: "http",
Host: network.GetServiceHostname(ref.Name, ref.Namespace),
Path: "/",
Path: "",
}
return url, nil
}
Expand Down
3 changes: 3 additions & 0 deletions vendor/knative.dev/serving/pkg/apis/config/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func defaultFeaturesConfig() *Features {
PodSpecNodeSelector: Disabled,
PodSpecRuntimeClassName: Disabled,
PodSpecSecurityContext: Disabled,
PodSpecPriorityClassName: Disabled,
ContainerSpecAddCapabilities: Disabled,
PodSpecTolerations: Disabled,
PodSpecVolumesEmptyDir: Disabled,
Expand All @@ -70,6 +71,7 @@ func NewFeaturesConfigFromMap(data map[string]string) (*Features, error) {
asFlag("kubernetes.podspec-nodeselector", &nc.PodSpecNodeSelector),
asFlag("kubernetes.podspec-runtimeclassname", &nc.PodSpecRuntimeClassName),
asFlag("kubernetes.podspec-securitycontext", &nc.PodSpecSecurityContext),
asFlag("kubernetes.podspec-priorityclassname", &nc.PodSpecPriorityClassName),
asFlag("kubernetes.containerspec-addcapabilities", &nc.ContainerSpecAddCapabilities),
asFlag("kubernetes.podspec-tolerations", &nc.PodSpecTolerations),
asFlag("kubernetes.podspec-volumes-emptydir", &nc.PodSpecVolumesEmptyDir),
Expand All @@ -95,6 +97,7 @@ type Features struct {
PodSpecNodeSelector Flag
PodSpecRuntimeClassName Flag
PodSpecSecurityContext Flag
PodSpecPriorityClassName Flag
ContainerSpecAddCapabilities Flag
PodSpecTolerations Flag
PodSpecVolumesEmptyDir Flag
Expand Down
4 changes: 3 additions & 1 deletion vendor/knative.dev/serving/pkg/apis/serving/fieldmask.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ func PodSpecMask(ctx context.Context, in *corev1.PodSpec) *corev1.PodSpec {
if cfg.Features.PodSpecSecurityContext != config.Disabled {
out.SecurityContext = in.SecurityContext
}
if cfg.Features.PodSpecPriorityClassName != config.Disabled {
out.PriorityClassName = in.PriorityClassName
}

// Disallowed fields
// This list is unnecessary, but added here for clarity
Expand All @@ -223,7 +226,6 @@ func PodSpecMask(ctx context.Context, in *corev1.PodSpec) *corev1.PodSpec {
out.Hostname = ""
out.Subdomain = ""
out.SchedulerName = ""
out.PriorityClassName = ""
out.Priority = nil
out.DNSConfig = nil
out.ReadinessGates = nil
Expand Down
7 changes: 7 additions & 0 deletions vendor/knative.dev/serving/pkg/testing/v1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ func WithServiceImage(img string) ServiceOption {
}
}

// WithTrafficTarget sets the traffic to be the provided traffic target.
func WithTrafficTarget(tt []v1.TrafficTarget) ServiceOption {
return func(svc *v1.Service) {
svc.Spec.Traffic = tt
}
}

// WithServiceTemplateMeta sets the container image to be the provided string.
func WithServiceTemplateMeta(m metav1.ObjectMeta) ServiceOption {
return func(svc *v1.Service) {
Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ knative.dev/hack
knative.dev/networking/pkg
knative.dev/networking/pkg/apis/networking
knative.dev/networking/pkg/apis/networking/v1alpha1
# knative.dev/pkg v0.0.0-20210726021015-889b5670e173
# knative.dev/pkg v0.0.0-20210731072840-64ab22bbaab9
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
Expand Down Expand Up @@ -765,7 +765,7 @@ knative.dev/pkg/tracing/propagation
knative.dev/pkg/tracing/propagation/tracecontextb3
knative.dev/pkg/tracker
knative.dev/pkg/unstructured
# knative.dev/serving v0.24.1-0.20210729171456-492d71c96e7a
# knative.dev/serving v0.24.1-0.20210730215204-4dc9fc69f5b7
## explicit
knative.dev/serving/pkg/apis/autoscaling
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
Expand Down

0 comments on commit 4470416

Please sign in to comment.