Skip to content
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

Upgrading knative.eventing resources to use knative.pkg.Conditions #434

Merged
merged 2 commits into from
Sep 17, 2018

Conversation

n3wscott
Copy link
Contributor

@n3wscott n3wscott commented Sep 17, 2018

Proposed Changes

  • Migrate our existing eventing resources to use the common pkg Conditions definition.
  • Update pkg dep hash to Sep 17, 2018.
None

@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 17, 2018
@n3wscott
Copy link
Contributor Author

/assign @grantr

@n3wscott n3wscott force-pushed the use_pkg_conditionals branch from 1a1a711 to 17b4384 Compare September 17, 2018 22:38
}

// Populate implements duck.Populatable
func (t *KResource) Populate() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it makes sure that the object can be converted to JSON and back. note it is vendor code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also my birthday

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, hence the LGTM/Approve :) But, just curious why this is not say in test code or somewhere else.

@vaikas
Copy link
Contributor

vaikas commented Sep 17, 2018

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 17, 2018
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: n3wscott, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 17, 2018
@knative-prow-robot knative-prow-robot merged commit 18c8f13 into knative:master Sep 17, 2018
Copy link
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excited to never have to write conditions methods again!

// +optional
Message string `json:"message,omitempty"`
}
var cProvCondSet = duck.NewLivingConditionSet()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't immediately clear to me what makes this ConditionSet Living, or that this method automatically adds a Ready condition. Can you add a comment here explaining that?

An alternate solution is to eliminate the Living and Batch methods and expect the first argument to always be the happy condition:

var subCondSet = duck.NewConditionSet(duck.ConditionReady)

IMO this is more self-documenting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @mattmoor who I'm told is responsible for the Living/Batch naming 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @evankanderson @mattmoor on this comment.

}
}
return nil
func (ss *SubscriptionStatus) GetCondition(t duck.ConditionType) *duck.Condition {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this method defined for ClusterProvisionerStatus?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@n3wscott tells me this method or something like it will arrive in a future PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it.

// +optional
Message string `json:"message,omitempty"`
}
var cProvCondSet = duck.NewLivingConditionSet()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cProvCondSet ever used? I can't find any references to it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@n3wscott tells me uses of this variable will arrive in a future PR.


// ClusterProvisionerStatus is the status for a ClusterProvisioner resource
type ClusterProvisionerStatus struct {
// Conditions holds the state of a cluster provisioner at a point in time.
Conditions []ClusterProvisionerConditionStatus `json:"conditions,omitempty"`
Conditions duck.Conditions `json:"conditions,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't this field have the patch tags that SubscriptionStatus.Conditions has?


// SubscriptionStatus (computed) for a subscription
type SubscriptionStatus struct {
// Represents the latest available observations of a subscription's current state.
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []SubscriptionCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
Conditions duck.Conditions `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the patchStrategy tag work for this type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it does! Because Conditions is a slice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants