mirror of https://github.com/knative/client.git
upgrade to latest dependencies (#1196)
bumping knative.dev/networking 07a8160...b17f435:
> b17f435 upgrade to latest dependencies (# 337)
> dcc8744 Remove out-of-date documentation (# 336)
> 4751606 upgrade to latest dependencies (# 335)
> 07536a6 Move RewriteHost conformance tests to Beta (# 334)
> e223a89 upgrade to latest dependencies (# 333)
> 356d71b upgrade to latest dependencies (# 332)
bumping knative.dev/pkg f0ea5e6...1bbf0a6:
> 1bbf0a6 add LabelSelector to InformerFactory so that the informers only list and watch resources with the given labels (# 1940)
> 75d66b5 preserve the stable webhook logger names we had before (# 1994)
> 22f4898 upgrade to latest dependencies (# 1990)
> 5bb97df fix duration logging (# 1992)
> a74906c Use structured logging to augment our logger vs. naming (# 1991)
bumping knative.dev/eventing 1c94ef8...5dc363d:
> 5dc363d [# 4744] Update conformance test helper (# 4756)
> 764685c upgrade to latest dependencies (# 4761)
> b10d720 [# 4744] Bump test zipkin version (# 4755)
> 2b95f45 upgrade to latest dependencies (# 4747)
> d395f6f Cleanup channel template internal types (# 4749)
> 8e0e286 💽 Change KIND's k8s to 1.19.4 and add 1.20.0 (# 4729)
> 0f2f567 Format markdown (# 4746)
bumping knative.dev/serving 84421cd...db82b33:
> db82b33 Backfill missing test (# 10585)
> 7dc411c Update net-kourier nightly (# 10584)
> 197b97f upgrade to latest dependencies (# 10582)
> 76e9ba5 Update net-kourier nightly (# 10578)
> 11f0b4b Add validation to the route and service annotations for rollout duration (# 10581)
> 44bd297 Update net-istio nightly (# 10577)
> 2488c73 Use more consistent constant name (# 10580)
> 2ed1f20 rename configUID to configurationUID to be consistent with the other labels (# 10579)
> 4a7c82a Update net-contour nightly (# 10573)
> dab32d1 Update net-kourier nightly (# 10572)
> 404ef98 upgrade to latest dependencies (# 10576)
> da1db84 Allow setting ReadOnlyRootFilesystem (# 10560)
> 5fbe2f1 upgrade to latest dependencies (# 10574)
> 3177cc7 Add a serviceUID label to ksvc (and implicitly to config) (# 10539)
> 59e35cd Add the new annotation for the rollout duration and its validation (# 10561)
> b7a7c18 Drop logger annotations (# 10570)
> 078edf2 Be consistent in reading revision headers (# 10563)
> 8509e6e Fixed comment about autoscaler logging config override (# 10569)
> b5cd2eb Update net-contour nightly (# 10565)
> a8c2dae Update net-certmanager nightly (# 10564)
> 3135ad4 upgrade to latest dependencies (# 10568)
> 80321c4 Update net-kourier nightly (# 10552)
> cb128a4 Update net-istio nightly (# 10550)
> 66389d3 Cut down queue health tests from 2s to basically nothing (# 10556)
> fbd3968 Cut down the probe test runtime from 18s to 3s (# 10546)
> 9b69859 Widen timeouts for queue probe tests to harden them (# 10555)
> 9979954 upgrade to latest dependencies (# 10562)
Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
eda6a844ed
commit
90c70efe9e
8
go.mod
8
go.mod
|
|
@ -22,11 +22,11 @@ require (
|
|||
k8s.io/cli-runtime v0.18.12
|
||||
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
|
||||
k8s.io/code-generator v0.18.12
|
||||
knative.dev/eventing v0.20.1-0.20210115015220-1c94ef83b6b5
|
||||
knative.dev/eventing v0.20.1-0.20210120133253-5dc363dcb5be
|
||||
knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8
|
||||
knative.dev/networking v0.0.0-20210113172032-07a8160d1971
|
||||
knative.dev/pkg v0.0.0-20210114223020-f0ea5e6b9c4e
|
||||
knative.dev/serving v0.20.1-0.20210115004319-84421cde1553
|
||||
knative.dev/networking v0.0.0-20210120054853-b17f43505630
|
||||
knative.dev/pkg v0.0.0-20210119162123-1bbf0a6436c3
|
||||
knative.dev/serving v0.20.1-0.20210120133453-db82b331e658
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
)
|
||||
|
||||
|
|
|
|||
26
go.sum
26
go.sum
|
|
@ -1255,26 +1255,24 @@ k8s.io/legacy-cloud-providers v0.18.8/go.mod h1:tgp4xYf6lvjrWnjQwTOPvWQE9IVqSBGP
|
|||
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
|
||||
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 h1:v8ud2Up6QK1lNOKFgiIVrZdMg7MpmSnvtrOieolJKoE=
|
||||
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
knative.dev/caching v0.0.0-20210107021736-1ee47505018d/go.mod h1:N3jOlbf/CWZsEcfEpthv5b+LB9e+TqiDTVLH/Ti+vWE=
|
||||
knative.dev/eventing v0.20.1-0.20210115015220-1c94ef83b6b5 h1:Gb18mayz8CukHpC6SFXUVDbd2YVdgrkUbJ50zdNX140=
|
||||
knative.dev/eventing v0.20.1-0.20210115015220-1c94ef83b6b5/go.mod h1:HdS7UgtDbKQuCuEwgS3+jxtHvpm+PPp/eEsjaQwfWl8=
|
||||
knative.dev/caching v0.0.0-20210119135417-c987c4666761/go.mod h1:ehhgTeWXYyQIrFw3ci83kqi2FsDka2QCS+rKqlhRhAA=
|
||||
knative.dev/eventing v0.20.1-0.20210120133253-5dc363dcb5be h1:djUnZoRaf177Bl4Hyst7H6tz3bDW02cwIi8CNZjDdvg=
|
||||
knative.dev/eventing v0.20.1-0.20210120133253-5dc363dcb5be/go.mod h1:oOTcsXCXgKH2YbsPuF+eFdxXfNI3H7jSOaUKsbdyTSs=
|
||||
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24 h1:kIztWfvnIFV8Lhlea02K3YO2mIzcDyQNzrBLn0Oq9sA=
|
||||
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20210112093330-d946d2557383/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8 h1:N/Kt6C5zZzTtFcTntRThB+vEJ7WcLKaZ5Q2Jm7b23vw=
|
||||
knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/networking v0.0.0-20210112144630-4c4c2378e90e/go.mod h1:N123KICErXy+bPo1oBszM6TVYGG0Za2wMmnEqX4MlFg=
|
||||
knative.dev/networking v0.0.0-20210113172032-07a8160d1971 h1:Iig2pviCKuZYoIH+wgeUoJz1U4gQ18LXX7JpwRO5AYo=
|
||||
knative.dev/networking v0.0.0-20210113172032-07a8160d1971/go.mod h1:lAll0+JcN2iKex0P9hOXZ4siOdryW+HIuK4KBRM+ca4=
|
||||
knative.dev/pkg v0.0.0-20201224024804-27db5ac24cfb/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
|
||||
knative.dev/pkg v0.0.0-20210107022335-51c72e24c179 h1:lkrgrv69iUk2qhOG9symy15kJUaJZmMybSloi7C3gIw=
|
||||
knative.dev/pkg v0.0.0-20210107022335-51c72e24c179/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
|
||||
knative.dev/pkg v0.0.0-20210112143930-acbf2af596cf/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
|
||||
knative.dev/networking v0.0.0-20210119144923-dcc874493756/go.mod h1:3jifXugd2qsI6AxbF/yrdsQTaIhrG77WiLd7tYa8pa8=
|
||||
knative.dev/networking v0.0.0-20210120054853-b17f43505630 h1:nw8ius50Qp4cyqJGEGfGsmwRM23qF6Ssoa46AZllcks=
|
||||
knative.dev/networking v0.0.0-20210120054853-b17f43505630/go.mod h1:clj5nwP53Dd+nI1Z/JiLY5gJkPZpV2CNM+VtGkSQsYM=
|
||||
knative.dev/pkg v0.0.0-20210114223020-f0ea5e6b9c4e h1:3k5tzvlM9VGZFiXRj8UKc3CUpMGpqBlEbIY0Dp3F3NU=
|
||||
knative.dev/pkg v0.0.0-20210114223020-f0ea5e6b9c4e/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
|
||||
knative.dev/reconciler-test v0.0.0-20210111135237-9b251467ccb6/go.mod h1:rmQpZseeqDpg6/ToFzIeV5hTRkOJujaXBCK7iYL7M4E=
|
||||
knative.dev/serving v0.20.1-0.20210115004319-84421cde1553 h1:YkSm62v8bmAdeXgHNxLVMsjEcWrokQ3OuPCKmjONUxQ=
|
||||
knative.dev/serving v0.20.1-0.20210115004319-84421cde1553/go.mod h1:m24eWeQ394GFbz3WnacOiQXFx/mSTBSgpQf+9/c4YMs=
|
||||
knative.dev/pkg v0.0.0-20210118192521-75d66b58948d/go.mod h1:cZdMjcJE6JGSNaEypgbUigX1TjteMIwQsW2woNBPVCA=
|
||||
knative.dev/pkg v0.0.0-20210119162123-1bbf0a6436c3 h1:kvBQKadSBqhTMveExPsvlkTWNS8yQcvxes6PS5RxDQs=
|
||||
knative.dev/pkg v0.0.0-20210119162123-1bbf0a6436c3/go.mod h1:cZdMjcJE6JGSNaEypgbUigX1TjteMIwQsW2woNBPVCA=
|
||||
knative.dev/reconciler-test v0.0.0-20210115075620-6fe6ef693370/go.mod h1:A5ZaQo+1lWGw2OoSc06wSyReX6huzBPJ2ra/R48s1yo=
|
||||
knative.dev/serving v0.20.1-0.20210120133453-db82b331e658 h1:hgxTECR+NIstdPXlmOuOL/ne/hQZsJcdWxnT8U+Ffkg=
|
||||
knative.dev/serving v0.20.1-0.20210120133453-db82b331e658/go.mod h1:xKtOClBVUggQ/PwEjDUlL+tFfNWAW8dedJj+VVcSJUU=
|
||||
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=
|
||||
|
|
|
|||
|
|
@ -17,13 +17,8 @@ limitations under the License.
|
|||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/equality"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
v1 "knative.dev/eventing/pkg/apis/duck/v1"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
|
@ -35,77 +30,3 @@ type ChannelTemplateSpec struct {
|
|||
// +optional
|
||||
Spec *runtime.RawExtension `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// ChannelTemplateSpecInternal is an internal only version that includes ObjectMeta so that
|
||||
// we can easily create new Channels off of it.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type ChannelTemplateSpecInternal struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Spec includes the Channel CR ChannelableSpec and the physical channel spec.
|
||||
// In order to create a new ChannelTemplateSpecInternalSpec, you must use NewChannelTemplateSpecInternalSpec
|
||||
Spec *ChannelTemplateSpecInternalSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// ChannelTemplateSpecInternalSpec merges the "general" spec from Channel CR and the template of the physical channel spec.
|
||||
// Note that this struct properly implements only Marshalling, unmarshalling doesn't work!
|
||||
type ChannelTemplateSpecInternalSpec struct {
|
||||
// ChannelableSpec includes the fields from the Channel Spec section
|
||||
v1.ChannelableSpec
|
||||
|
||||
// PhysicalChannelSpec includes the fields from the physical channel Spec. Passed
|
||||
// in verbatim to the Channel CRD as Spec section.
|
||||
// +optional
|
||||
PhysicalChannelSpec *runtime.RawExtension
|
||||
}
|
||||
|
||||
// NewChannelTemplateSpecInternalSpec creates a new ChannelTemplateSpecInternalSpec, returning nil if channelableSpec is empty and physicalChannelSpec is nil.
|
||||
func NewChannelTemplateSpecInternalSpec(channelableSpec v1.ChannelableSpec, physicalChannelSpec *runtime.RawExtension) *ChannelTemplateSpecInternalSpec {
|
||||
if physicalChannelSpec == nil && equality.Semantic.DeepEqual(channelableSpec, v1.ChannelableSpec{}) {
|
||||
return nil
|
||||
}
|
||||
return &ChannelTemplateSpecInternalSpec{
|
||||
ChannelableSpec: channelableSpec,
|
||||
PhysicalChannelSpec: physicalChannelSpec,
|
||||
}
|
||||
}
|
||||
|
||||
func (s ChannelTemplateSpecInternalSpec) MarshalJSON() ([]byte, error) {
|
||||
// Check if empty
|
||||
if s.PhysicalChannelSpec == nil && equality.Semantic.DeepEqual(s.ChannelableSpec, v1.ChannelableSpec{}) {
|
||||
return []byte{}, nil
|
||||
}
|
||||
|
||||
// Let's merge the channel template spec and the channelable spec from channel
|
||||
channelableSpec := make(map[string]interface{})
|
||||
physicalChannelTemplateSpec := make(map[string]interface{})
|
||||
|
||||
rawChannelSpec, err := json.Marshal(s.ChannelableSpec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := json.Unmarshal(rawChannelSpec, &channelableSpec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if s.PhysicalChannelSpec != nil {
|
||||
rawPhysicalChannelTemplateSpec, err := json.Marshal(s.PhysicalChannelSpec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := json.Unmarshal(rawPhysicalChannelTemplateSpec, &physicalChannelTemplateSpec); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Merge the two maps into channelableSpec
|
||||
for k, v := range physicalChannelTemplateSpec {
|
||||
channelableSpec[k] = v
|
||||
}
|
||||
|
||||
// Just return the merged map marshalled
|
||||
return json.Marshal(channelableSpec)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,59 +162,6 @@ func (in *ChannelTemplateSpec) DeepCopyObject() runtime.Object {
|
|||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ChannelTemplateSpecInternal) DeepCopyInto(out *ChannelTemplateSpecInternal) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Spec != nil {
|
||||
in, out := &in.Spec, &out.Spec
|
||||
*out = new(ChannelTemplateSpecInternalSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelTemplateSpecInternal.
|
||||
func (in *ChannelTemplateSpecInternal) DeepCopy() *ChannelTemplateSpecInternal {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ChannelTemplateSpecInternal)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ChannelTemplateSpecInternal) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ChannelTemplateSpecInternalSpec) DeepCopyInto(out *ChannelTemplateSpecInternalSpec) {
|
||||
*out = *in
|
||||
in.ChannelableSpec.DeepCopyInto(&out.ChannelableSpec)
|
||||
if in.PhysicalChannelSpec != nil {
|
||||
in, out := &in.PhysicalChannelSpec, &out.PhysicalChannelSpec
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelTemplateSpecInternalSpec.
|
||||
func (in *ChannelTemplateSpecInternalSpec) DeepCopy() *ChannelTemplateSpecInternalSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ChannelTemplateSpecInternalSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *InMemoryChannel) DeepCopyInto(out *InMemoryChannel) {
|
||||
*out = *in
|
||||
|
|
|
|||
|
|
@ -30,18 +30,3 @@ type ChannelTemplateSpec struct {
|
|||
// +optional
|
||||
Spec *runtime.RawExtension `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// ChannelTemplateSpecInternal is an internal only version that includes ObjectMeta so that
|
||||
// we can easily create new Channels off of it.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type ChannelTemplateSpecInternal struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Spec defines the Spec to use for each channel created. Passed
|
||||
// in verbatim to the Channel CRD as Spec section.
|
||||
// +optional
|
||||
Spec *runtime.RawExtension `json:"spec,omitempty"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,37 +162,6 @@ func (in *ChannelTemplateSpec) DeepCopyObject() runtime.Object {
|
|||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ChannelTemplateSpecInternal) DeepCopyInto(out *ChannelTemplateSpecInternal) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Spec != nil {
|
||||
in, out := &in.Spec, &out.Spec
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChannelTemplateSpecInternal.
|
||||
func (in *ChannelTemplateSpecInternal) DeepCopy() *ChannelTemplateSpecInternal {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ChannelTemplateSpecInternal)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ChannelTemplateSpecInternal) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *InMemoryChannel) DeepCopyInto(out *InMemoryChannel) {
|
||||
*out = *in
|
||||
|
|
|
|||
|
|
@ -235,8 +235,6 @@ type HTTPIngressPath struct {
|
|||
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -301,7 +301,8 @@ is used with duck types:
|
|||
Base: reconciler.NewBase(opt, controllerAgentName),
|
||||
...
|
||||
}
|
||||
impl := controller.NewImpl(c, c.Logger, "Revisions")
|
||||
logger := c.Logger.Named("Revisions")
|
||||
impl := controller.NewImpl(c, logger, "Revisions")
|
||||
|
||||
// Calls to Track create a 30 minute lease before they must be renewed.
|
||||
// Coordinate this value with controller resync periods.
|
||||
|
|
|
|||
131
vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/fake_filtered_factory.go
vendored
Normal file
131
vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/fake_filtered_factory.go
vendored
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
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 generators
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"k8s.io/gengo/generator"
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// fakeFilteredFactoryGenerator produces a file of listers for a given GroupVersion and
|
||||
// type.
|
||||
type fakeFilteredFactoryGenerator struct {
|
||||
generator.DefaultGen
|
||||
outputPackage string
|
||||
imports namer.ImportTracker
|
||||
filtered bool
|
||||
|
||||
factoryInjectionPkg string
|
||||
fakeClientInjectionPkg string
|
||||
sharedInformerFactoryPackage string
|
||||
}
|
||||
|
||||
var _ generator.Generator = (*fakeFilteredFactoryGenerator)(nil)
|
||||
|
||||
func (g *fakeFilteredFactoryGenerator) Filter(c *generator.Context, t *types.Type) bool {
|
||||
// We generate a single factory, so return true once.
|
||||
if !g.filtered {
|
||||
g.filtered = true
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (g *fakeFilteredFactoryGenerator) Namers(c *generator.Context) namer.NameSystems {
|
||||
return namer.NameSystems{
|
||||
"raw": namer.NewRawNamer(g.outputPackage, g.imports),
|
||||
}
|
||||
}
|
||||
|
||||
func (g *fakeFilteredFactoryGenerator) Imports(c *generator.Context) (imports []string) {
|
||||
imports = append(imports, g.imports.ImportLines()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (g *fakeFilteredFactoryGenerator) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
|
||||
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
|
||||
|
||||
klog.V(5).Info("processing type ", t)
|
||||
|
||||
m := map[string]interface{}{
|
||||
"factoryKey": c.Universe.Type(types.Name{Package: g.factoryInjectionPkg, Name: "Key"}),
|
||||
"factoryLabelKey": c.Universe.Type(types.Name{Package: g.factoryInjectionPkg, Name: "LabelKey"}),
|
||||
"factoryGet": c.Universe.Function(types.Name{Package: g.factoryInjectionPkg, Name: "Get"}),
|
||||
"clientGet": c.Universe.Function(types.Name{Package: g.fakeClientInjectionPkg, Name: "Get"}),
|
||||
"informersNewSharedInformerFactoryWithOptions": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "NewSharedInformerFactoryWithOptions"}),
|
||||
"informersSharedInformerOption": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "SharedInformerOption"}),
|
||||
"informersWithNamespace": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "WithNamespace"}),
|
||||
"informersWithTweakListOptions": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "WithTweakListOptions"}),
|
||||
"injectionRegisterInformerFactory": c.Universe.Function(types.Name{
|
||||
Package: "knative.dev/pkg/injection",
|
||||
Name: "Fake.RegisterInformerFactory",
|
||||
}),
|
||||
"injectionHasNamespace": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "HasNamespaceScope"}),
|
||||
"injectionGetNamespace": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "GetNamespaceScope"}),
|
||||
"controllerGetResyncPeriod": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "GetResyncPeriod"}),
|
||||
"contextContext": c.Universe.Type(types.Name{
|
||||
Package: "context",
|
||||
Name: "Context",
|
||||
}),
|
||||
"loggingFromContext": c.Universe.Function(types.Name{
|
||||
Package: "knative.dev/pkg/logging",
|
||||
Name: "FromContext",
|
||||
}),
|
||||
"metav1ListOptions": c.Universe.Type(types.Name{
|
||||
Package: "k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
Name: "ListOptions",
|
||||
}),
|
||||
}
|
||||
|
||||
sw.Do(injectionFakeFilteredInformerFactory, m)
|
||||
|
||||
return sw.Error()
|
||||
}
|
||||
|
||||
var injectionFakeFilteredInformerFactory = `
|
||||
var Get = {{.factoryGet|raw}}
|
||||
|
||||
func init() {
|
||||
{{.injectionRegisterInformerFactory|raw}}(withInformerFactory)
|
||||
}
|
||||
|
||||
func withInformerFactory(ctx {{.contextContext|raw}}) {{.contextContext|raw}} {
|
||||
c := {{.clientGet|raw}}(ctx)
|
||||
opts := []{{.informersSharedInformerOption|raw}}{}
|
||||
if {{.injectionHasNamespace|raw}}(ctx) {
|
||||
opts = append(opts, {{.informersWithNamespace|raw}}({{.injectionGetNamespace|raw}}(ctx)))
|
||||
}
|
||||
untyped := ctx.Value({{.factoryLabelKey|raw}}{})
|
||||
if untyped == nil {
|
||||
{{.loggingFromContext|raw}}(ctx).Panic(
|
||||
"Unable to fetch labelkey from context.")
|
||||
}
|
||||
labelSelectors := untyped.([]string)
|
||||
for _, selector := range labelSelectors {
|
||||
thisOpts := append(opts, {{.informersWithTweakListOptions|raw}}(func(l *{{.metav1ListOptions|raw}}) {
|
||||
l.LabelSelector = selector
|
||||
}))
|
||||
ctx = context.WithValue(ctx, {{.factoryKey|raw}}{Selector: selector},
|
||||
{{.informersNewSharedInformerFactoryWithOptions|raw}}(c, {{.controllerGetResyncPeriod|raw}}(ctx), thisOpts...))
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
`
|
||||
133
vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/fake_filtered_informer.go
vendored
Normal file
133
vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/fake_filtered_informer.go
vendored
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
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 generators
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
||||
"k8s.io/gengo/generator"
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// fakeFilteredInformerGenerator produces a file of listers for a given GroupVersion and
|
||||
// type.
|
||||
type fakeFilteredInformerGenerator struct {
|
||||
generator.DefaultGen
|
||||
outputPackage string
|
||||
imports namer.ImportTracker
|
||||
|
||||
typeToGenerate *types.Type
|
||||
groupVersion clientgentypes.GroupVersion
|
||||
groupGoName string
|
||||
informerInjectionPkg string
|
||||
fakeFactoryInjectionPkg string
|
||||
}
|
||||
|
||||
var _ generator.Generator = (*fakeFilteredInformerGenerator)(nil)
|
||||
|
||||
func (g *fakeFilteredInformerGenerator) Filter(c *generator.Context, t *types.Type) bool {
|
||||
// Only process the type for this informer generator.
|
||||
return t == g.typeToGenerate
|
||||
}
|
||||
|
||||
func (g *fakeFilteredInformerGenerator) Namers(c *generator.Context) namer.NameSystems {
|
||||
publicPluralNamer := &ExceptionNamer{
|
||||
Exceptions: map[string]string{
|
||||
// these exceptions are used to deconflict the generated code
|
||||
// you can put your fully qualified package like
|
||||
// to generate a name that doesn't conflict with your group.
|
||||
// "k8s.io/apis/events/v1beta1.Event": "EventResource"
|
||||
},
|
||||
KeyFunc: func(t *types.Type) string {
|
||||
return t.Name.Package + "." + t.Name.Name
|
||||
},
|
||||
Delegate: namer.NewPublicPluralNamer(map[string]string{
|
||||
"Endpoints": "Endpoints",
|
||||
}),
|
||||
}
|
||||
|
||||
return namer.NameSystems{
|
||||
"raw": namer.NewRawNamer(g.outputPackage, g.imports),
|
||||
"publicPlural": publicPluralNamer,
|
||||
}
|
||||
}
|
||||
|
||||
func (g *fakeFilteredInformerGenerator) Imports(c *generator.Context) (imports []string) {
|
||||
imports = append(imports, g.imports.ImportLines()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (g *fakeFilteredInformerGenerator) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
|
||||
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
|
||||
|
||||
klog.V(5).Info("processing type ", t)
|
||||
|
||||
m := map[string]interface{}{
|
||||
"informerKey": c.Universe.Type(types.Name{Package: g.informerInjectionPkg, Name: "Key"}),
|
||||
"informerGet": c.Universe.Function(types.Name{Package: g.informerInjectionPkg, Name: "Get"}),
|
||||
"factoryGet": c.Universe.Function(types.Name{Package: g.fakeFactoryInjectionPkg, Name: "Get"}),
|
||||
"factoryLabelKey": c.Universe.Type(types.Name{Package: g.fakeFactoryInjectionPkg, Name: "LabelKey"}),
|
||||
"group": namer.IC(g.groupGoName),
|
||||
"type": t,
|
||||
"version": namer.IC(g.groupVersion.Version.String()),
|
||||
"controllerInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "Informer"}),
|
||||
"injectionRegisterFilteredInformers": c.Universe.Function(types.Name{
|
||||
Package: "knative.dev/pkg/injection",
|
||||
Name: "Fake.RegisterFilteredInformers",
|
||||
}),
|
||||
"loggingFromContext": c.Universe.Function(types.Name{
|
||||
Package: "knative.dev/pkg/logging",
|
||||
Name: "FromContext",
|
||||
}),
|
||||
"contextContext": c.Universe.Type(types.Name{
|
||||
Package: "context",
|
||||
Name: "Context",
|
||||
}),
|
||||
}
|
||||
|
||||
sw.Do(injectionFakeFilteredInformer, m)
|
||||
|
||||
return sw.Error()
|
||||
}
|
||||
|
||||
var injectionFakeFilteredInformer = `
|
||||
var Get = {{.informerGet|raw}}
|
||||
|
||||
func init() {
|
||||
{{.injectionRegisterFilteredInformers|raw}}(withInformer)
|
||||
}
|
||||
|
||||
func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, []{{.controllerInformer|raw}}) {
|
||||
untyped := ctx.Value({{.factoryLabelKey|raw}}{})
|
||||
if untyped == nil {
|
||||
{{.loggingFromContext|raw}}(ctx).Panic(
|
||||
"Unable to fetch labelkey from context.")
|
||||
}
|
||||
labelSelectors := untyped.([]string)
|
||||
infs := []{{.controllerInformer|raw}}{}
|
||||
for _, selector := range labelSelectors {
|
||||
f := {{.factoryGet|raw}}(ctx, selector)
|
||||
inf := f.{{.group}}().{{.version}}().{{.type|publicPlural}}()
|
||||
ctx = context.WithValue(ctx, {{.informerKey|raw}}{Selector: selector}, inf)
|
||||
infs = append(infs, inf.Informer())
|
||||
}
|
||||
return ctx, infs
|
||||
}
|
||||
`
|
||||
143
vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_factory.go
vendored
Normal file
143
vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_factory.go
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
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 generators
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"k8s.io/gengo/generator"
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// factoryTestGenerator produces a file of factory injection of a given type.
|
||||
type filteredFactoryGenerator struct {
|
||||
generator.DefaultGen
|
||||
outputPackage string
|
||||
imports namer.ImportTracker
|
||||
cachingClientSetPackage string
|
||||
sharedInformerFactoryPackage string
|
||||
filtered bool
|
||||
}
|
||||
|
||||
var _ generator.Generator = (*filteredFactoryGenerator)(nil)
|
||||
|
||||
func (g *filteredFactoryGenerator) Filter(c *generator.Context, t *types.Type) bool {
|
||||
// We generate a single factory, so return true once.
|
||||
if !g.filtered {
|
||||
g.filtered = true
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (g *filteredFactoryGenerator) Namers(c *generator.Context) namer.NameSystems {
|
||||
return namer.NameSystems{
|
||||
"raw": namer.NewRawNamer(g.outputPackage, g.imports),
|
||||
}
|
||||
}
|
||||
|
||||
func (g *filteredFactoryGenerator) Imports(c *generator.Context) (imports []string) {
|
||||
imports = append(imports, g.imports.ImportLines()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (g *filteredFactoryGenerator) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
|
||||
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
|
||||
|
||||
klog.V(5).Info("processing type ", t)
|
||||
|
||||
m := map[string]interface{}{
|
||||
"cachingClientGet": c.Universe.Type(types.Name{Package: g.cachingClientSetPackage, Name: "Get"}),
|
||||
"informersNewSharedInformerFactoryWithOptions": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "NewSharedInformerFactoryWithOptions"}),
|
||||
"informersSharedInformerOption": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "SharedInformerOption"}),
|
||||
"informersWithNamespace": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "WithNamespace"}),
|
||||
"informersWithTweakListOptions": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "WithTweakListOptions"}),
|
||||
"informersSharedInformerFactory": c.Universe.Function(types.Name{Package: g.sharedInformerFactoryPackage, Name: "SharedInformerFactory"}),
|
||||
"injectionRegisterInformerFactory": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterInformerFactory"}),
|
||||
"injectionHasNamespace": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "HasNamespaceScope"}),
|
||||
"injectionGetNamespace": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "GetNamespaceScope"}),
|
||||
"controllerGetResyncPeriod": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "GetResyncPeriod"}),
|
||||
"loggingFromContext": c.Universe.Function(types.Name{
|
||||
Package: "knative.dev/pkg/logging",
|
||||
Name: "FromContext",
|
||||
}),
|
||||
"contextContext": c.Universe.Type(types.Name{
|
||||
Package: "context",
|
||||
Name: "Context",
|
||||
}),
|
||||
"metav1ListOptions": c.Universe.Type(types.Name{
|
||||
Package: "k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
Name: "ListOptions",
|
||||
}),
|
||||
}
|
||||
|
||||
sw.Do(injectionFilteredFactory, m)
|
||||
|
||||
return sw.Error()
|
||||
}
|
||||
|
||||
var injectionFilteredFactory = `
|
||||
func init() {
|
||||
{{.injectionRegisterInformerFactory|raw}}(withInformerFactory)
|
||||
}
|
||||
|
||||
// Key is used as the key for associating information with a context.Context.
|
||||
type Key struct{
|
||||
Selector string
|
||||
}
|
||||
|
||||
type LabelKey struct{}
|
||||
|
||||
func WithSelectors(ctx {{.contextContext|raw}}, selector ...string) context.Context {
|
||||
return context.WithValue(ctx, LabelKey{}, selector)
|
||||
}
|
||||
|
||||
func withInformerFactory(ctx {{.contextContext|raw}}) {{.contextContext|raw}} {
|
||||
c := {{.cachingClientGet|raw}}(ctx)
|
||||
opts := []{{.informersSharedInformerOption|raw}}{}
|
||||
if {{.injectionHasNamespace|raw}}(ctx) {
|
||||
opts = append(opts, {{.informersWithNamespace|raw}}({{.injectionGetNamespace|raw}}(ctx)))
|
||||
}
|
||||
untyped := ctx.Value(LabelKey{})
|
||||
if untyped == nil {
|
||||
{{.loggingFromContext|raw}}(ctx).Panic(
|
||||
"Unable to fetch labelkey from context.")
|
||||
}
|
||||
labelSelectors := untyped.([]string)
|
||||
for _, selector := range labelSelectors {
|
||||
thisOpts := append(opts, {{.informersWithTweakListOptions|raw}}(func(l *{{.metav1ListOptions|raw}}) {
|
||||
l.LabelSelector = selector
|
||||
}))
|
||||
ctx = context.WithValue(ctx, Key{Selector: selector},
|
||||
{{.informersNewSharedInformerFactoryWithOptions|raw}}(c, {{.controllerGetResyncPeriod|raw}}(ctx), thisOpts...))
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
// Get extracts the InformerFactory from the context.
|
||||
func Get(ctx {{.contextContext|raw}}, selector string) {{.informersSharedInformerFactory|raw}} {
|
||||
untyped := ctx.Value(Key{Selector: selector})
|
||||
if untyped == nil {
|
||||
{{.loggingFromContext|raw}}(ctx).Panicf(
|
||||
"Unable to fetch {{.informersSharedInformerFactory}} with selector %s from context.", selector)
|
||||
}
|
||||
return untyped.({{.informersSharedInformerFactory|raw}})
|
||||
}
|
||||
`
|
||||
141
vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go
vendored
Normal file
141
vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/filtered_informer.go
vendored
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
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 generators
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
||||
"k8s.io/gengo/generator"
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// injectionTestGenerator produces a file of listers for a given GroupVersion and
|
||||
// type.
|
||||
type filteredInjectionGenerator struct {
|
||||
generator.DefaultGen
|
||||
outputPackage string
|
||||
groupVersion clientgentypes.GroupVersion
|
||||
groupGoName string
|
||||
typeToGenerate *types.Type
|
||||
imports namer.ImportTracker
|
||||
typedInformerPackage string
|
||||
groupInformerFactoryPackage string
|
||||
}
|
||||
|
||||
var _ generator.Generator = (*filteredInjectionGenerator)(nil)
|
||||
|
||||
func (g *filteredInjectionGenerator) Filter(c *generator.Context, t *types.Type) bool {
|
||||
// Only process the type for this informer generator.
|
||||
return t == g.typeToGenerate
|
||||
}
|
||||
|
||||
func (g *filteredInjectionGenerator) Namers(c *generator.Context) namer.NameSystems {
|
||||
publicPluralNamer := &ExceptionNamer{
|
||||
Exceptions: map[string]string{
|
||||
// these exceptions are used to deconflict the generated code
|
||||
// you can put your fully qualified package like
|
||||
// to generate a name that doesn't conflict with your group.
|
||||
// "k8s.io/apis/events/v1beta1.Event": "EventResource"
|
||||
},
|
||||
KeyFunc: func(t *types.Type) string {
|
||||
return t.Name.Package + "." + t.Name.Name
|
||||
},
|
||||
Delegate: namer.NewPublicPluralNamer(map[string]string{
|
||||
"Endpoints": "Endpoints",
|
||||
}),
|
||||
}
|
||||
|
||||
return namer.NameSystems{
|
||||
"raw": namer.NewRawNamer(g.outputPackage, g.imports),
|
||||
"publicPlural": publicPluralNamer,
|
||||
}
|
||||
}
|
||||
|
||||
func (g *filteredInjectionGenerator) Imports(c *generator.Context) (imports []string) {
|
||||
imports = append(imports, g.imports.ImportLines()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (g *filteredInjectionGenerator) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
|
||||
sw := generator.NewSnippetWriter(w, c, "{{", "}}")
|
||||
|
||||
klog.V(5).Info("processing type ", t)
|
||||
|
||||
m := map[string]interface{}{
|
||||
"group": namer.IC(g.groupGoName),
|
||||
"type": t,
|
||||
"version": namer.IC(g.groupVersion.Version.String()),
|
||||
"injectionRegisterFilteredInformers": c.Universe.Type(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterFilteredInformers"}),
|
||||
"controllerInformer": c.Universe.Type(types.Name{Package: "knative.dev/pkg/controller", Name: "Informer"}),
|
||||
"informersTypedInformer": c.Universe.Type(types.Name{Package: g.typedInformerPackage, Name: t.Name.Name + "Informer"}),
|
||||
"factoryLabelKey": c.Universe.Type(types.Name{Package: g.groupInformerFactoryPackage, Name: "LabelKey"}),
|
||||
"factoryGet": c.Universe.Function(types.Name{Package: g.groupInformerFactoryPackage, Name: "Get"}),
|
||||
"loggingFromContext": c.Universe.Function(types.Name{
|
||||
Package: "knative.dev/pkg/logging",
|
||||
Name: "FromContext",
|
||||
}),
|
||||
"contextContext": c.Universe.Type(types.Name{
|
||||
Package: "context",
|
||||
Name: "Context",
|
||||
}),
|
||||
}
|
||||
|
||||
sw.Do(filteredInjectionInformer, m)
|
||||
|
||||
return sw.Error()
|
||||
}
|
||||
|
||||
var filteredInjectionInformer = `
|
||||
func init() {
|
||||
{{.injectionRegisterFilteredInformers|raw}}(withInformer)
|
||||
}
|
||||
|
||||
// Key is used for associating the Informer inside the context.Context.
|
||||
type Key struct{
|
||||
Selector string
|
||||
}
|
||||
|
||||
func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, []{{.controllerInformer|raw}}) {
|
||||
untyped := ctx.Value({{.factoryLabelKey|raw}}{})
|
||||
if untyped == nil {
|
||||
{{.loggingFromContext|raw}}(ctx).Panic(
|
||||
"Unable to fetch labelkey from context.")
|
||||
}
|
||||
labelSelectors := untyped.([]string)
|
||||
infs := []{{.controllerInformer|raw}}{}
|
||||
for _, selector := range labelSelectors {
|
||||
f := {{.factoryGet|raw}}(ctx, selector)
|
||||
inf := f.{{.group}}().{{.version}}().{{.type|publicPlural}}()
|
||||
ctx = context.WithValue(ctx, Key{Selector: selector}, inf)
|
||||
infs = append(infs, inf.Informer())
|
||||
}
|
||||
return ctx, infs
|
||||
}
|
||||
|
||||
// Get extracts the typed informer from the context.
|
||||
func Get(ctx {{.contextContext|raw}}, selector string) {{.informersTypedInformer|raw}} {
|
||||
untyped := ctx.Value(Key{Selector: selector})
|
||||
if untyped == nil {
|
||||
{{.loggingFromContext|raw}}(ctx).Panicf(
|
||||
"Unable to fetch {{.informersTypedInformer}} with selector %s from context.", selector)
|
||||
}
|
||||
return untyped.({{.informersTypedInformer|raw}})
|
||||
}
|
||||
`
|
||||
|
|
@ -336,11 +336,61 @@ func versionFactoryPackages(basePackage string, boilerplate []byte, customArgs *
|
|||
return tags.NeedsInformerInjection()
|
||||
},
|
||||
},
|
||||
|
||||
// FilterFactoryImpl
|
||||
&generator.DefaultPackage{
|
||||
PackageName: "filteredFactory",
|
||||
PackagePath: filepath.Join(packagePath, "filtered"),
|
||||
HeaderText: boilerplate,
|
||||
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
|
||||
// Impl
|
||||
generators = append(generators, &filteredFactoryGenerator{
|
||||
DefaultGen: generator.DefaultGen{
|
||||
OptionalName: "filtered_factory",
|
||||
},
|
||||
outputPackage: filepath.Join(packagePath, "filtered"),
|
||||
cachingClientSetPackage: filepath.Join(basePackage, "client"),
|
||||
sharedInformerFactoryPackage: customArgs.ExternalVersionsInformersPackage,
|
||||
imports: generator.NewImportTracker(),
|
||||
})
|
||||
return generators
|
||||
},
|
||||
FilterFunc: func(c *generator.Context, t *types.Type) bool {
|
||||
tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...))
|
||||
return tags.NeedsInformerInjection()
|
||||
},
|
||||
},
|
||||
// FakeFilterFactory
|
||||
&generator.DefaultPackage{
|
||||
PackageName: "fakeFilteredFactory",
|
||||
PackagePath: filepath.Join(packagePath, "filtered", "fake"),
|
||||
HeaderText: boilerplate,
|
||||
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
|
||||
// Impl
|
||||
generators = append(generators, &fakeFilteredFactoryGenerator{
|
||||
DefaultGen: generator.DefaultGen{
|
||||
OptionalName: "fake_filtered_factory",
|
||||
},
|
||||
outputPackage: filepath.Join(packagePath, "filtered", "fake"),
|
||||
factoryInjectionPkg: filepath.Join(packagePath, "filtered"),
|
||||
fakeClientInjectionPkg: filepath.Join(basePackage, "client", "fake"),
|
||||
sharedInformerFactoryPackage: customArgs.ExternalVersionsInformersPackage,
|
||||
imports: generator.NewImportTracker(),
|
||||
})
|
||||
return generators
|
||||
},
|
||||
FilterFunc: func(c *generator.Context, t *types.Type) bool {
|
||||
tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...))
|
||||
return tags.NeedsInformerInjection()
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func versionInformerPackages(basePackage string, groupPkgName string, gv clientgentypes.GroupVersion, groupGoName string, boilerplate []byte, typesToGenerate []*types.Type, customArgs *informergenargs.CustomArgs) []generator.Package {
|
||||
factoryPackagePath := filepath.Join(basePackage, "informers", "factory")
|
||||
filteredFactoryPackagePath := filepath.Join(basePackage, "informers", "factory", "filtered")
|
||||
|
||||
packagePath := filepath.Join(basePackage, "informers", groupPkgName, strings.ToLower(gv.Version.NonEmpty()))
|
||||
|
||||
vers := make([]generator.Package, 0, 2*len(typesToGenerate))
|
||||
|
|
@ -404,6 +454,60 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg
|
|||
return tags.NeedsInformerInjection()
|
||||
},
|
||||
})
|
||||
// FilteredInformer
|
||||
vers = append(vers, &generator.DefaultPackage{
|
||||
PackageName: "filtered",
|
||||
PackagePath: filepath.Join(packagePath, "filtered"),
|
||||
HeaderText: boilerplate,
|
||||
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
|
||||
// Impl
|
||||
generators = append(generators, &filteredInjectionGenerator{
|
||||
DefaultGen: generator.DefaultGen{
|
||||
OptionalName: strings.ToLower(t.Name.Name),
|
||||
},
|
||||
outputPackage: filepath.Join(packagePath, "filtered"),
|
||||
groupVersion: gv,
|
||||
groupGoName: groupGoName,
|
||||
typeToGenerate: t,
|
||||
imports: generator.NewImportTracker(),
|
||||
typedInformerPackage: typedInformerPackage,
|
||||
groupInformerFactoryPackage: filteredFactoryPackagePath,
|
||||
})
|
||||
return generators
|
||||
},
|
||||
FilterFunc: func(c *generator.Context, t *types.Type) bool {
|
||||
tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...))
|
||||
return tags.NeedsInformerInjection()
|
||||
},
|
||||
})
|
||||
|
||||
// FakeFilteredInformer
|
||||
vers = append(vers, &generator.DefaultPackage{
|
||||
PackageName: "fake",
|
||||
PackagePath: filepath.Join(packagePath, "filtered", "fake"),
|
||||
HeaderText: boilerplate,
|
||||
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
|
||||
// Impl
|
||||
generators = append(generators, &fakeFilteredInformerGenerator{
|
||||
DefaultGen: generator.DefaultGen{
|
||||
OptionalName: "fake",
|
||||
},
|
||||
outputPackage: filepath.Join(packagePath, "filtered", "fake"),
|
||||
imports: generator.NewImportTracker(),
|
||||
typeToGenerate: t,
|
||||
groupVersion: gv,
|
||||
groupGoName: groupGoName,
|
||||
informerInjectionPkg: filepath.Join(packagePath, "filtered"),
|
||||
fakeFactoryInjectionPkg: filteredFactoryPackagePath,
|
||||
})
|
||||
return generators
|
||||
},
|
||||
FilterFunc: func(c *generator.Context, t *types.Type) bool {
|
||||
tags := MustParseClientGenTags(append(t.SecondClosestCommentLines, t.CommentLines...))
|
||||
return tags.NeedsInformerInjection()
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
return vers
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,18 @@ func (g *reconcilerControllerGenerator) GenerateType(c *generator.Context, t *ty
|
|||
Package: "fmt",
|
||||
Name: "Sprintf",
|
||||
}),
|
||||
"logkeyControllerType": c.Universe.Constant(types.Name{
|
||||
Package: "knative.dev/pkg/logging/logkey",
|
||||
Name: "ControllerType",
|
||||
}),
|
||||
"logkeyControllerKind": c.Universe.Constant(types.Name{
|
||||
Package: "knative.dev/pkg/logging/logkey",
|
||||
Name: "Kind",
|
||||
}),
|
||||
"zapString": c.Universe.Function(types.Name{
|
||||
Package: "go.uber.org/zap",
|
||||
Name: "String",
|
||||
}),
|
||||
}
|
||||
|
||||
sw.Do(reconcilerControllerNewImpl, m)
|
||||
|
|
@ -227,10 +239,17 @@ func NewImpl(ctx {{.contextContext|raw}}, r Interface{{if .hasClass}}, classValu
|
|||
{{if .hasClass}}classValue: classValue,{{end}}
|
||||
}
|
||||
|
||||
t := {{.reflectTypeOf|raw}}(r).Elem()
|
||||
queueName := {{.fmtSprintf|raw}}("%s.%s", {{.stringsReplaceAll|raw}}(t.PkgPath(), "/", "-"), t.Name())
|
||||
ctrType := {{.reflectTypeOf|raw}}(r).Elem()
|
||||
ctrTypeName := {{.fmtSprintf|raw}}("%s.%s", ctrType.PkgPath(), ctrType.Name())
|
||||
ctrTypeName = {{.stringsReplaceAll|raw}}(ctrTypeName, "/", ".")
|
||||
|
||||
impl := {{.controllerNewImpl|raw}}(rec, logger, queueName)
|
||||
logger = logger.With(
|
||||
{{.zapString|raw}}({{.logkeyControllerType|raw}}, ctrTypeName),
|
||||
{{.zapString|raw}}({{.logkeyControllerKind|raw}}, "{{ printf "%s.%s" .group .type.Name.Name }}"),
|
||||
)
|
||||
|
||||
|
||||
impl := {{.controllerNewImpl|raw}}(rec, logger, ctrTypeName)
|
||||
agentName := defaultControllerAgentName
|
||||
|
||||
// Pass impl to the options. Save any optional results.
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ func NewImplWithStats(r Reconciler, logger *zap.SugaredLogger, workQueueName str
|
|||
|
||||
// NewImplFull accepts the full set of options available to all controllers.
|
||||
func NewImplFull(r Reconciler, options ControllerOptions) *Impl {
|
||||
logger := options.Logger.Named(options.WorkQueueName)
|
||||
if options.RateLimiter == nil {
|
||||
options.RateLimiter = workqueue.DefaultControllerRateLimiter()
|
||||
}
|
||||
|
|
@ -241,7 +240,7 @@ func NewImplFull(r Reconciler, options ControllerOptions) *Impl {
|
|||
Name: options.WorkQueueName,
|
||||
Reconciler: r,
|
||||
workQueue: newTwoLaneWorkQueue(options.WorkQueueName, options.RateLimiter),
|
||||
logger: logger,
|
||||
logger: options.Logger,
|
||||
statsReporter: options.Reporter,
|
||||
}
|
||||
}
|
||||
|
|
@ -528,7 +527,7 @@ func (c *Impl) processNextWorkItem() bool {
|
|||
// Finally, if no error occurs we Forget this item so it does not
|
||||
// have any delay when another change happens.
|
||||
c.workQueue.Forget(key)
|
||||
logger.Info("Reconcile succeeded. Time taken: ", zap.Duration("duration", time.Since(startTime)))
|
||||
logger.Infow("Reconcile succeeded", zap.Duration("duration", time.Since(startTime)))
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ func NewController(ctx context.Context, cmw configmap.Watcher) *controller.Impl
|
|||
Client: kubeclient.Get(ctx),
|
||||
ServiceLister: svcInformer.Lister(),
|
||||
}
|
||||
logger = logger.Named("NameOfController")
|
||||
impl := controller.NewImpl(c, logger, "NameOfController")
|
||||
|
||||
// Set up event handlers.
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ import (
|
|||
// informer type to a context.
|
||||
type InformerInjector func(context.Context) (context.Context, controller.Informer)
|
||||
|
||||
// FilteredInformersInjector holds the type of a callback that attaches a set of particular
|
||||
// filtered informers type to a context.
|
||||
type FilteredInformersInjector func(context.Context) (context.Context, []controller.Informer)
|
||||
|
||||
func (i *impl) RegisterInformer(ii InformerInjector) {
|
||||
i.m.Lock()
|
||||
defer i.m.Unlock()
|
||||
|
|
@ -35,6 +39,13 @@ func (i *impl) RegisterInformer(ii InformerInjector) {
|
|||
i.informers = append(i.informers, ii)
|
||||
}
|
||||
|
||||
func (i *impl) RegisterFilteredInformers(fii FilteredInformersInjector) {
|
||||
i.m.Lock()
|
||||
defer i.m.Unlock()
|
||||
|
||||
i.filteredInformers = append(i.filteredInformers, fii)
|
||||
}
|
||||
|
||||
func (i *impl) GetInformers() []InformerInjector {
|
||||
i.m.RLock()
|
||||
defer i.m.RUnlock()
|
||||
|
|
@ -43,6 +54,14 @@ func (i *impl) GetInformers() []InformerInjector {
|
|||
return append(i.informers[:0:0], i.informers...)
|
||||
}
|
||||
|
||||
func (i *impl) GetFilteredInformers() []FilteredInformersInjector {
|
||||
i.m.RLock()
|
||||
defer i.m.RUnlock()
|
||||
|
||||
// Copy the slice before returning.
|
||||
return append(i.filteredInformers[:0:0], i.filteredInformers...)
|
||||
}
|
||||
|
||||
func (i *impl) SetupInformers(ctx context.Context, cfg *rest.Config) (context.Context, []controller.Informer) {
|
||||
// Based on the reconcilers we have linked, build up a set of clients and inject
|
||||
// them onto the context.
|
||||
|
|
@ -65,10 +84,16 @@ func (i *impl) SetupInformers(ctx context.Context, cfg *rest.Config) (context.Co
|
|||
// Based on the reconcilers we have linked, build up a set of informers
|
||||
// and inject them onto the context.
|
||||
var inf controller.Informer
|
||||
var filteredinfs []controller.Informer
|
||||
informers := make([]controller.Informer, 0, len(i.GetInformers()))
|
||||
for _, ii := range i.GetInformers() {
|
||||
ctx, inf = ii(ctx)
|
||||
informers = append(informers, inf)
|
||||
}
|
||||
for _, fii := range i.GetFilteredInformers() {
|
||||
ctx, filteredinfs = fii(ctx)
|
||||
informers = append(informers, filteredinfs...)
|
||||
|
||||
}
|
||||
return ctx, informers
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,16 @@ type Interface interface {
|
|||
// a new informer with a context.
|
||||
RegisterInformer(InformerInjector)
|
||||
|
||||
// RegisterFilteredInformers registers a new filtered informer injector callback for associating
|
||||
// a new set of informers with a context.
|
||||
RegisterFilteredInformers(FilteredInformersInjector)
|
||||
|
||||
// GetInformers fetches all of the registered informer injectors.
|
||||
GetInformers() []InformerInjector
|
||||
|
||||
// GetFilteredInformers fetches all of the registered filtered informer injectors.
|
||||
GetFilteredInformers() []FilteredInformersInjector
|
||||
|
||||
// SetupInformers runs all of the injectors against a context, starting with
|
||||
// the clients and the given rest.Config. The resulting context is returned
|
||||
// along with a list of the .Informer() for each of the injected informers,
|
||||
|
|
@ -84,8 +91,9 @@ var (
|
|||
type impl struct {
|
||||
m sync.RWMutex
|
||||
|
||||
clients []ClientInjector
|
||||
factories []InformerFactoryInjector
|
||||
informers []InformerInjector
|
||||
ducks []DuckFactoryInjector
|
||||
clients []ClientInjector
|
||||
factories []InformerFactoryInjector
|
||||
informers []InformerInjector
|
||||
filteredInformers []FilteredInformersInjector
|
||||
ducks []DuckFactoryInjector
|
||||
}
|
||||
|
|
|
|||
|
|
@ -593,6 +593,7 @@ func SecurityContextMask(ctx context.Context, in *corev1.SecurityContext) *corev
|
|||
|
||||
// Allowed fields
|
||||
out.RunAsUser = in.RunAsUser
|
||||
out.ReadOnlyRootFilesystem = in.ReadOnlyRootFilesystem
|
||||
|
||||
if config.FromContextOrDefaults(ctx).Features.PodSpecSecurityContext != config.Disabled {
|
||||
out.RunAsGroup = in.RunAsGroup
|
||||
|
|
@ -603,7 +604,6 @@ func SecurityContextMask(ctx context.Context, in *corev1.SecurityContext) *corev
|
|||
out.Capabilities = nil
|
||||
out.Privileged = nil
|
||||
out.SELinuxOptions = nil
|
||||
out.ReadOnlyRootFilesystem = nil
|
||||
out.AllowPrivilegeEscalation = nil
|
||||
out.ProcMount = nil
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ package serving
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/equality"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -31,13 +33,14 @@ import (
|
|||
|
||||
var (
|
||||
allowedAnnotations = sets.NewString(
|
||||
UpdaterAnnotation,
|
||||
CreatorAnnotation,
|
||||
RevisionLastPinnedAnnotationKey,
|
||||
RoutingStateModifiedAnnotationKey,
|
||||
ForceUpgradeAnnotationKey,
|
||||
RevisionLastPinnedAnnotationKey,
|
||||
RevisionPreservedAnnotationKey,
|
||||
RolloutDurationKey,
|
||||
RoutesAnnotationKey,
|
||||
RoutingStateModifiedAnnotationKey,
|
||||
UpdaterAnnotation,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -50,6 +53,34 @@ func ValidateObjectMetadata(ctx context.Context, meta metav1.Object) *apis.Field
|
|||
ViaField("annotations"))
|
||||
}
|
||||
|
||||
// ValidateRolloutDurationAnnotation validates the rollout duration annotation.
|
||||
// This annotation can be set on either service or route objects.
|
||||
func ValidateRolloutDurationAnnotation(annos map[string]string) (errs *apis.FieldError) {
|
||||
if v := annos[RolloutDurationKey]; v != "" {
|
||||
// Parse as duration.
|
||||
d, err := time.ParseDuration(v)
|
||||
if err != nil {
|
||||
return errs.Also(apis.ErrInvalidValue(v, RolloutDurationKey))
|
||||
}
|
||||
// Validate that it has second precision.
|
||||
if d.Round(time.Second) != d {
|
||||
return errs.Also(&apis.FieldError{
|
||||
// Even if tempting %v won't work here, since it might output the value spelled differently.
|
||||
Message: fmt.Sprintf("rolloutDuration=%s is not at second precision", v),
|
||||
Paths: []string{RolloutDurationKey},
|
||||
})
|
||||
}
|
||||
// And positive.
|
||||
if d < 0 {
|
||||
return errs.Also(&apis.FieldError{
|
||||
Message: fmt.Sprintf("rolloutDuration=%s must be positive", v),
|
||||
Paths: []string{RolloutDurationKey},
|
||||
})
|
||||
}
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
func validateKnativeAnnotations(annotations map[string]string) (errs *apis.FieldError) {
|
||||
for key := range annotations {
|
||||
if !allowedAnnotations.Has(key) && strings.HasPrefix(key, GroupNamePrefix) {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,12 @@ const (
|
|||
// referenced by one or many routes. The value is a comma separated list of Route names.
|
||||
RoutesAnnotationKey = GroupName + "/routes"
|
||||
|
||||
// RolloutDurationKey is an annotation attached to a Route to indicate the duration
|
||||
// of the rollout of the latest revision. The value must be a valid positive
|
||||
// Golang time.Duration value serialized to string.
|
||||
// The value can be specified with at most with a second precision.
|
||||
RolloutDurationKey = GroupName + "/rolloutDuration"
|
||||
|
||||
// RoutingStateLabelKey is the label attached to a Revision indicating
|
||||
// its state in relation to serving a Route.
|
||||
RoutingStateLabelKey = GroupName + "/routingState"
|
||||
|
|
@ -71,6 +77,14 @@ const (
|
|||
// its unique identifier
|
||||
RevisionUID = GroupName + "/revisionUID"
|
||||
|
||||
// ConfigurationUIDLabelKey is the label key attached to a pod to reference its
|
||||
// Knative Configuration by its unique UID
|
||||
ConfigurationUIDLabelKey = GroupName + "/configurationUID"
|
||||
|
||||
// ServiceUIDLabelKey is the label key attached to a pod to reference its
|
||||
// Knative Service by its unique UID
|
||||
ServiceUIDLabelKey = GroupName + "/serviceUID"
|
||||
|
||||
// ServiceLabelKey is the label key attached to a Route and Configuration indicating by
|
||||
// which Service they are created.
|
||||
ServiceLabelKey = GroupName + "/service"
|
||||
|
|
|
|||
|
|
@ -65,8 +65,10 @@ func (cs *ConfigurationSpec) Validate(ctx context.Context) *apis.FieldError {
|
|||
func (c *Configuration) validateLabels() (errs *apis.FieldError) {
|
||||
for key, val := range c.GetLabels() {
|
||||
switch key {
|
||||
case serving.RouteLabelKey:
|
||||
// Known valid labels.
|
||||
case serving.RouteLabelKey,
|
||||
serving.ConfigurationUIDLabelKey,
|
||||
serving.ServiceUIDLabelKey:
|
||||
// Known valid labels - so just skip them
|
||||
case serving.ServiceLabelKey:
|
||||
errs = errs.Also(verifyLabelOwnerRef(val, serving.ServiceLabelKey, "Service", c.GetOwnerReferences()))
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -128,6 +128,8 @@ func (r *Revision) ValidateLabels() (errs *apis.FieldError) {
|
|||
case serving.RoutingStateLabelKey,
|
||||
serving.RouteLabelKey,
|
||||
serving.ServiceLabelKey,
|
||||
serving.ConfigurationUIDLabelKey,
|
||||
serving.ServiceUIDLabelKey,
|
||||
serving.ConfigurationGenerationLabelKey:
|
||||
// Known valid labels.
|
||||
case serving.ConfigurationLabelKey:
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@ import (
|
|||
// Validate makes sure that Route is properly configured.
|
||||
func (r *Route) Validate(ctx context.Context) *apis.FieldError {
|
||||
errs := serving.ValidateObjectMetadata(ctx, r.GetObjectMeta()).Also(
|
||||
r.validateLabels().ViaField("labels")).ViaField("metadata")
|
||||
r.validateLabels().ViaField("labels"))
|
||||
errs = errs.Also(serving.ValidateRolloutDurationAnnotation(
|
||||
r.GetAnnotations()).ViaField("annotations"))
|
||||
errs = errs.ViaField("metadata")
|
||||
errs = errs.Also(r.Spec.Validate(apis.WithinSpec(ctx)).ViaField("spec"))
|
||||
|
||||
if apis.IsInUpdate(ctx) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,10 @@ func (s *Service) Validate(ctx context.Context) (errs *apis.FieldError) {
|
|||
if !apis.IsInStatusUpdate(ctx) {
|
||||
errs = errs.Also(serving.ValidateObjectMetadata(ctx, s.GetObjectMeta()))
|
||||
errs = errs.Also(s.validateLabels().ViaField("labels"))
|
||||
errs = errs.Also(serving.ValidateHasNoAutoscalingAnnotation(s.GetAnnotations()).ViaField("annotations"))
|
||||
errs = errs.Also(serving.ValidateRolloutDurationAnnotation(
|
||||
s.GetAnnotations()).ViaField("annotations"))
|
||||
errs = errs.Also(serving.ValidateHasNoAutoscalingAnnotation(
|
||||
s.GetAnnotations()).ViaField("annotations"))
|
||||
errs = errs.ViaField("metadata")
|
||||
|
||||
ctx = apis.WithinParent(ctx, s.ObjectMeta)
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ func Service(name, namespace string, so ...ServiceOption) *v1.Service {
|
|||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: namespace,
|
||||
UID: "cccccccc-cccc-cccc-cccc-cccccccccccc",
|
||||
},
|
||||
}
|
||||
for _, opt := range so {
|
||||
|
|
|
|||
|
|
@ -756,7 +756,7 @@ k8s.io/kube-openapi/pkg/util/sets
|
|||
k8s.io/utils/buffer
|
||||
k8s.io/utils/integer
|
||||
k8s.io/utils/trace
|
||||
# knative.dev/eventing v0.20.1-0.20210115015220-1c94ef83b6b5
|
||||
# knative.dev/eventing v0.20.1-0.20210120133253-5dc363dcb5be
|
||||
## explicit
|
||||
knative.dev/eventing/pkg/apis/config
|
||||
knative.dev/eventing/pkg/apis/configs
|
||||
|
|
@ -789,12 +789,12 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2/fake
|
|||
# knative.dev/hack v0.0.0-20210114150620-4422dcadb3c8
|
||||
## explicit
|
||||
knative.dev/hack
|
||||
# knative.dev/networking v0.0.0-20210113172032-07a8160d1971
|
||||
# knative.dev/networking v0.0.0-20210120054853-b17f43505630
|
||||
## explicit
|
||||
knative.dev/networking/pkg
|
||||
knative.dev/networking/pkg/apis/networking
|
||||
knative.dev/networking/pkg/apis/networking/v1alpha1
|
||||
# knative.dev/pkg v0.0.0-20210114223020-f0ea5e6b9c4e
|
||||
# knative.dev/pkg v0.0.0-20210119162123-1bbf0a6436c3
|
||||
## explicit
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
@ -838,7 +838,7 @@ knative.dev/pkg/tracing/config
|
|||
knative.dev/pkg/tracing/propagation
|
||||
knative.dev/pkg/tracing/propagation/tracecontextb3
|
||||
knative.dev/pkg/tracker
|
||||
# knative.dev/serving v0.20.1-0.20210115004319-84421cde1553
|
||||
# knative.dev/serving v0.20.1-0.20210120133453-db82b331e658
|
||||
## explicit
|
||||
knative.dev/serving/pkg/apis/autoscaling
|
||||
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
||||
|
|
|
|||
Loading…
Reference in New Issue