Add a new Channel CRD to the eventing group#430
Conversation
This is intended to replace the existing Channel in the channels group. It doesn't include the array of subscription details yet.
|
|
||
| //TODO replace this with openapi defaults when | ||
| // https://github.com/kubernetes/features/issues/575 lands (scheduled for 1.13) | ||
| func (c *Channel) SetDefaults() { |
There was a problem hiding this comment.
Is there any reason to keep this empty defaults file and others like it? It pulls down our coverage numbers unless we write no-op tests.
There was a problem hiding this comment.
you need to keep func (c *Channel) SetDefaults() { but you can delete func (fs *ChannelSpec) SetDefaults() {
The webhook validation code requires you implement Defaultable.
There was a problem hiding this comment.
If you would like to change this, you will have to update GenericCRD interface and https://github.com/knative/pkg/blob/a3bc2db77a14d9ca6195172e81b4bf33e6190f85/webhook/webhook.go#L227
|
|
||
| // A reference to the k8s Service backing this channel. | ||
| // +optional | ||
| Service *corev1.LocalObjectReference `json:"service,omitempty"` |
There was a problem hiding this comment.
There was a notion of capturing all provisioned resources in a generic way. Perhaps Provisioned []corev1.ObjectReference. Likely, this is overkill if those resources have OwnerReferences back to this Channel.
Service and VirtualService are too implementation specific and should be removed
There was a problem hiding this comment.
Removed these fields. We can add Provisioned later if owner references prove insufficient.
| // ChannelConditionServiceable has status True when the service addressing the | ||
| // Channel exists. | ||
| // TODO should this be Sinkable? | ||
| ChannelConditionServiceable ChannelConditionType = "Serviceable" |
There was a problem hiding this comment.
Since a channel may not be fronted by a Service, "Serviceable" is no longer a good name. "Sinkable" (or whatever we end up calling that interface) is good. I'd also consider "Targetable" since that aligns with the .status.domainInternal value being set.
There was a problem hiding this comment.
I removed this condition since I can't think of a reason for it to be different from Ready.
These fields are too specific to the implementation of the Channel.
The Serviceable/Sinkable condition is effectively the same as Ready.
Allows ignoring timestamps when comparing Statuses for equality.
Shared by Channel and Source so it shouldn't be buried in the types for either one.
Includes the Call and Result fields from Subscription.Spec so the Subscription controller can copy those values directly.
Each Subscriber must have at least one of Call or Result. Currently the validation returns immediately upon encountering an empty Subscriber object due to a limitation in the knative/pkg validation helpers. This is probably fine for now since this field is not expected to be mutated by users.
|
|
ProvisionerReference was considered a top-level type at one point, apparently.
The SetDefaults method is required to exist by the webhook implementation, but we don't want it to negatively impact coverage stats.
| // +optional | ||
| // +patchMergeKey=type | ||
| // +patchStrategy=merge | ||
| Conditions []ChannelCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` |
Encapsulates the happy/dependent condition behavior.
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
|
||
| // Channel represents a named endpoint on which a Bus accepts event delivery and | ||
| // corresponds to the channels.channels.knative.dev CRD. The Bus handles |
There was a problem hiding this comment.
channels.channels.knative.dev -> channels.eventing.knative.dev?
| // Check that ConfigurationStatus may have its conditions managed. | ||
| var _ duckv1alpha1.ConditionsAccessor = (*ChannelStatus)(nil) | ||
|
|
||
| // Check that Subscription implements the Conditions duck type. |
There was a problem hiding this comment.
Subscription -> Channel
| // For group eventing.knative.dev, | ||
| eventingv1alpha1.SchemeGroupVersion.WithKind("Channel"): &eventingv1alpha1.Channel{}, | ||
| eventingv1alpha1.SchemeGroupVersion.WithKind("ClusterProvisioner"): &eventingv1alpha1.ClusterProvisioner{}, | ||
| eventingv1alpha1.SchemeGroupVersion.WithKind("Subscription"): &eventingv1alpha1.Subscription{}, |
|
|
||
| //TODO replace this with openapi defaults when | ||
| // https://github.com/kubernetes/features/issues/575 lands (scheduled for 1.13) | ||
| func (c *Channel) SetDefaults() { |
There was a problem hiding this comment.
If you would like to change this, you will have to update GenericCRD interface and https://github.com/knative/pkg/blob/a3bc2db77a14d9ca6195172e81b4bf33e6190f85/webhook/webhook.go#L227
|
|
||
| import "testing" | ||
|
|
||
| // No-op test because method does nothing. |
| // ObservedGeneration is the most recent generation observed for this Channel. | ||
| // It corresponds to the Channel's generation, which is updated on mutation by | ||
| // the API Server. | ||
| //TODO The above comment is only true once |
There was a problem hiding this comment.
malformed TODO. Should be:
// TODO: The above comment is only true once
| // DomainInternal holds the top-level domain that will distribute traffic | ||
| // over the provided targets from inside the cluster. It generally has the | ||
| // form {channel}.{namespace}.svc.cluster.local | ||
| //TODO move this to a struct that can be embedded similar to ObjectMeta and |
There was a problem hiding this comment.
malformed TODO. See above
| // +optional | ||
| // +patchMergeKey=type | ||
| // +patchStrategy=merge | ||
| Conditions []ChannelCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` |
| const ( | ||
| // ChannelConditionReady has status True when the Channel is ready to accept | ||
| // traffic. | ||
| ChannelConditionReady ChannelConditionType = "Ready" |
There was a problem hiding this comment.
This will turn into ChannelConditionReady = duck.ConditionReady
|
|
||
| // ChannelConditionProvisioned has status True when the Channel's backing | ||
| // resources have been provisioned. | ||
| ChannelConditionProvisioned ChannelConditionType = "Provisioned" |
|
The following is the coverage report on pkg/.
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: grantr, vaikas-google The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is intended to replace the existing Channel in the channels group.
It doesn't include the array of subscription details yet.