-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to removing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you will want to update to the style of #434
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get #434 in first, reviewing now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is in now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use duck Conditions.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subscription -> Channel
eventingv1alpha1.SchemeGroupVersion.WithKind("ClusterProvisioner"): &eventingv1alpha1.ClusterProvisioner{}, | ||
eventingv1alpha1.SchemeGroupVersion.WithKind("Subscription"): &eventingv1alpha1.Subscription{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
|
||
//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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does nothing yet :D
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
malformed TODO. See above
// +optional | ||
// +patchMergeKey=type | ||
// +patchStrategy=merge | ||
Conditions []ChannelCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is in now!
const ( | ||
// ChannelConditionReady has status True when the Channel is ready to accept | ||
// traffic. | ||
ChannelConditionReady ChannelConditionType = "Ready" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will turn into ChannelConditionReady = duck.ConditionReady
|
||
// ChannelConditionProvisioned has status True when the Channel's backing | ||
// resources have been provisioned. | ||
ChannelConditionProvisioned ChannelConditionType = "Provisioned" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duck.ConditionType
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
Needs 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.