diff --git a/go.mod b/go.mod index 5027b29e1..2526c811b 100644 --- a/go.mod +++ b/go.mod @@ -22,11 +22,11 @@ require ( k8s.io/cli-runtime v0.18.8 k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible k8s.io/code-generator v0.18.12 - knative.dev/eventing v0.19.1-0.20201216183558-f3468d1c9954 + knative.dev/eventing v0.19.1-0.20201217221202-9643baffd747 knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24 - knative.dev/networking v0.0.0-20201217015204-ceef42482365 - knative.dev/pkg v0.0.0-20201217014702-b0c121fb667f - knative.dev/serving v0.19.1-0.20201217014702-58258e8d6f8e + knative.dev/networking v0.0.0-20201218015602-5b9803233324 + knative.dev/pkg v0.0.0-20201217152402-7226f4f447a8 + knative.dev/serving v0.19.1-0.20201217202302-f35443fe7801 sigs.k8s.io/yaml v1.2.0 ) diff --git a/go.sum b/go.sum index 946dfb909..eb63aee6c 100644 --- a/go.sum +++ b/go.sum @@ -1263,8 +1263,8 @@ k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl 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-20201215015243-9bd909a64850/go.mod h1:/+gGbjPMtb5Jo5PNmmwGNF/WMwTC8cuPG38GPqUqBS8= -knative.dev/eventing v0.19.1-0.20201216183558-f3468d1c9954 h1:6aNIdsIusWwC2esDUuvzSqyf7hUPohwsX2avcR/q0Kc= -knative.dev/eventing v0.19.1-0.20201216183558-f3468d1c9954/go.mod h1:Zs0qfFfbKDhEM5JHjQtmCXBu9k+GERSfeDwitMtgjQM= +knative.dev/eventing v0.19.1-0.20201217221202-9643baffd747 h1:Z+Jz8663U4kpTTm9i6xbc8mGVFaGqpKGCIu30ew129I= +knative.dev/eventing v0.19.1-0.20201217221202-9643baffd747/go.mod h1:i/xQcbto7Ix7K5H8IILeeJdwxatJyMd1CHRlOYNcm9Y= knative.dev/hack v0.0.0-20201112185459-01a34c573bd8 h1:RNbZsAjhswBPtl4C5C5gEFX5/GfWIOZQxfYD9DhkHdY= knative.dev/hack v0.0.0-20201112185459-01a34c573bd8/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack v0.0.0-20201118155651-b31d3bb6bff9/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= @@ -1273,20 +1273,21 @@ knative.dev/hack v0.0.0-20201201234937-fddbf732e450/go.mod h1:PHt8x8yX5Z9pPquBEf 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/networking v0.0.0-20201215172457-b175a8d66f91/go.mod h1:CEC2okV/9UCg2PdXZWZRtEG81/jdbKZ28tfAcc2hAis= -knative.dev/networking v0.0.0-20201217015204-ceef42482365 h1:/afRCNB+tOirJ+hWWI4LCU58PZQd0WbaZhMLFp2qe9g= -knative.dev/networking v0.0.0-20201217015204-ceef42482365/go.mod h1:eFbYgJ+mBmsauvUB+Kxn9tXCCdyo/TL1mkZLgJaBJ2c= +knative.dev/networking v0.0.0-20201218015602-5b9803233324 h1:olOarveq/XKNDjYk3G6dlicz6arzUcC/YRrjfy49ybk= +knative.dev/networking v0.0.0-20201218015602-5b9803233324/go.mod h1:iWk1TS8+tKxghbJ1PlTHLkaC1ivr/6NYugeJlnGdlOg= knative.dev/pkg v0.0.0-20201117221452-0fccc54273ed h1:4LNEFhvD2Ya4WgCD3SC1WGXz81bjEvQgbcpe5XACI3I= knative.dev/pkg v0.0.0-20201117221452-0fccc54273ed/go.mod h1:nxlh3CUvx6WBPr1WKD96AHxFZPD2UKRDo9RUp8ILTyQ= knative.dev/pkg v0.0.0-20201214144644-909c15242675 h1:LoJ/axeH7J8ovl3+uELzmGUZ/hnjHeX7m6tZTrfk/P0= knative.dev/pkg v0.0.0-20201214144644-909c15242675/go.mod h1:9Z5HV80glvuMCv9oJqkWQcYoZrPAw8oA2C5JdFrNk0A= knative.dev/pkg v0.0.0-20201215101243-af53027cbd91/go.mod h1:VjrwVhfEZUnn6FruncHcBm854FldnRpekpyBbYtBvZM= knative.dev/pkg v0.0.0-20201215202458-ef8048c0ba77/go.mod h1:VjrwVhfEZUnn6FruncHcBm854FldnRpekpyBbYtBvZM= -knative.dev/pkg v0.0.0-20201216162758-261c9b4624df/go.mod h1:VjrwVhfEZUnn6FruncHcBm854FldnRpekpyBbYtBvZM= knative.dev/pkg v0.0.0-20201217014702-b0c121fb667f h1:c4fPgRAIlW0uTC2Ec3+AfkA3adPXwfjfA0NhiA/ybgs= knative.dev/pkg v0.0.0-20201217014702-b0c121fb667f/go.mod h1:VjrwVhfEZUnn6FruncHcBm854FldnRpekpyBbYtBvZM= +knative.dev/pkg v0.0.0-20201217152402-7226f4f447a8 h1:Ti4QhRNR6WSKiobT9gWuJZT3odRQC4v8LcO5tVfsNNI= +knative.dev/pkg v0.0.0-20201217152402-7226f4f447a8/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0= knative.dev/reconciler-test v0.0.0-20201124190335-83a44efcdfef/go.mod h1:YSs1y1rgnjs8w39/drLIOQbWvZUQwqApvd+EizO8UsA= -knative.dev/serving v0.19.1-0.20201217014702-58258e8d6f8e h1:JvGdFs4V7yOrPGFYYScXJP9gkXkgLPV1sfgPmZQ47VY= -knative.dev/serving v0.19.1-0.20201217014702-58258e8d6f8e/go.mod h1:7uNUzgy9rq77x1F+raxTG3dYTeumb+gHFbCd40SXxdY= +knative.dev/serving v0.19.1-0.20201217202302-f35443fe7801 h1:ospVtXbvDmYeEIKbvpR6ZyJ8q5/2EPUSTfZ/HHTy3DM= +knative.dev/serving v0.19.1-0.20201217202302-f35443fe7801/go.mod h1:+/NJ2TQkqkgYCCqYUtQtU5J5rGlzrvEav2t/L+QOV00= 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= diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_template_types.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_template_types.go index 35f42de7f..6ef23d809 100644 --- a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_template_types.go +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/channel_template_types.go @@ -17,8 +17,13 @@ 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 @@ -40,8 +45,67 @@ type ChannelTemplateSpecInternal struct { // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - // Spec defines the Spec to use for each channel created. Passed + // 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 - Spec *runtime.RawExtension `json:"spec,omitempty"` + 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) } diff --git a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go index f5158622a..90d160a32 100644 --- a/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/eventing/pkg/apis/messaging/v1/zz_generated.deepcopy.go @@ -169,7 +169,7 @@ func (in *ChannelTemplateSpecInternal) DeepCopyInto(out *ChannelTemplateSpecInte in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) if in.Spec != nil { in, out := &in.Spec, &out.Spec - *out = new(runtime.RawExtension) + *out = new(ChannelTemplateSpecInternalSpec) (*in).DeepCopyInto(*out) } return @@ -193,6 +193,28 @@ func (in *ChannelTemplateSpecInternal) DeepCopyObject() runtime.Object { 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 diff --git a/vendor/knative.dev/serving/pkg/reconciler/route/config/domain.go b/vendor/knative.dev/serving/pkg/reconciler/route/config/domain.go index 1ffb0298d..68004c52d 100644 --- a/vendor/knative.dev/serving/pkg/reconciler/route/config/domain.go +++ b/vendor/knative.dev/serving/pkg/reconciler/route/config/domain.go @@ -19,8 +19,8 @@ package config import ( "strings" - "github.com/ghodss/yaml" corev1 "k8s.io/api/core/v1" + "sigs.k8s.io/yaml" netpkg "knative.dev/networking/pkg" "knative.dev/pkg/configmap" diff --git a/vendor/modules.txt b/vendor/modules.txt index 4e64df97f..3ded702d4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -849,7 +849,7 @@ k8s.io/kube-openapi/pkg/util/sets k8s.io/utils/buffer k8s.io/utils/integer k8s.io/utils/trace -# knative.dev/eventing v0.19.1-0.20201216183558-f3468d1c9954 +# knative.dev/eventing v0.19.1-0.20201217221202-9643baffd747 ## explicit knative.dev/eventing/pkg/apis/config knative.dev/eventing/pkg/apis/configs @@ -882,12 +882,12 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2/fake # knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24 ## explicit knative.dev/hack -# knative.dev/networking v0.0.0-20201217015204-ceef42482365 +# knative.dev/networking v0.0.0-20201218015602-5b9803233324 ## explicit knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking knative.dev/networking/pkg/apis/networking/v1alpha1 -# knative.dev/pkg v0.0.0-20201217014702-b0c121fb667f +# knative.dev/pkg v0.0.0-20201217152402-7226f4f447a8 ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -931,7 +931,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.19.1-0.20201217014702-58258e8d6f8e +# knative.dev/serving v0.19.1-0.20201217202302-f35443fe7801 ## explicit knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1