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

Add conditions pkg to support Build CRDs to operate on Conditions #475

Merged

Conversation

qu1queee
Copy link
Contributor

This is not yet fixing #307 , but rather the base framework so that we can operate on Conditions. We would need a new PR for how do we populate the Conditions field in the BuildRun.

This includes

  • Adding a generic conditions pkg, so that any controller that needs to support Conditions can use the pkg to set/retrieve their related conditions.

  • Adding a Condition of the type Succeeded for resources that run to completion, like the BuildRun

  • Adding a generic Condition types. This can be extended in the future with new fields.

  • Adding unit tests for the new conditions pkg.

  • Adding support for the Conditions pkg in the BuildRun, although the CRD is not yet generating or updating the Status.Condition object. This is done by extending the Status struct to include a Conditions field.

  • Extend BuildRun CRD with Conditions fields . This adds support for the CRD to inline with the BuildRun types changes.

Part of this conditions framework is heavily based on https://github.com/knative/pkg/blob/master/apis/condition_set.go

@qu1queee qu1queee requested review from HeavyWombat and adambkaplan and removed request for xiujuan95 and zhangtbj November 10, 2020 11:40
@qu1queee qu1queee force-pushed the qu1queee/conditions_br branch 2 times, most recently from 5351e3d to 556e8c0 Compare November 10, 2020 13:05
@qu1queee qu1queee force-pushed the qu1queee/conditions_br branch from 556e8c0 to 3b999a5 Compare November 10, 2020 13:16
@qu1queee
Copy link
Contributor Author

/retest

@adambkaplan
Copy link
Member

Note that Conditions has official API support from Kubernetes in v1.19. In addition to an API defined in apimachinery/pkg/apis/meta/v1, there are helpers to manage conditions.

https://github.com/kubernetes/apimachinery/blob/master/pkg/apis/meta/v1/types.go#L1354-L1368

@qu1queee qu1queee force-pushed the qu1queee/conditions_br branch from 3b999a5 to edde66c Compare November 10, 2020 15:08
@qu1queee
Copy link
Contributor Author

@adambkaplan cool, more than happy to rely on that in the future. We will just need to keep our local Succeeded type.

@qu1queee qu1queee force-pushed the qu1queee/conditions_br branch 2 times, most recently from 25a38b9 to 07cfd48 Compare November 17, 2020 11:11
Copy link
Member

@SaschaSchwarze0 SaschaSchwarze0 left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 17, 2020
Copy link
Contributor

@HeavyWombat HeavyWombat left a comment

Choose a reason for hiding this comment

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

Just found a couple of minor things in the docs that should be changed.

pkg/conditions/conditions.go Outdated Show resolved Hide resolved
pkg/conditions/conditions.go Outdated Show resolved Hide resolved
pkg/conditions/conditions.go Outdated Show resolved Hide resolved
pkg/conditions/conditions.go Outdated Show resolved Hide resolved
pkg/conditions/conditions_test.go Outdated Show resolved Hide resolved
pkg/conditions/conditions_types.go Outdated Show resolved Hide resolved
pkg/conditions/conditions_types.go Outdated Show resolved Hide resolved
test/catalog.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 17, 2020
@qu1queee qu1queee force-pushed the qu1queee/conditions_br branch from 92a349f to a043915 Compare November 17, 2020 14:00
@qu1queee qu1queee requested a review from HeavyWombat November 17, 2020 14:01
@qu1queee
Copy link
Contributor Author

@HeavyWombat thanks, I added your suggestions.

@qu1queee qu1queee force-pushed the qu1queee/conditions_br branch from a043915 to adec8bf Compare November 17, 2020 15:06
- Adding a generic conditions pkg, so that any controller that needs
to support Conditions can use the pkg to set/retrieve their related
conditions.

- Adding a Condition of the type Succeeded for resources that run to
completion, like the BuildRun

- Adding a generic Condition types. This can be extended in the future
with new fields.

- Adding unit tests for the new conditions pkg.

- Adding support for the Conditions pkg in the BuildRun, although the
CRD is not yet generating or updating the Status.Condition object. This
is done by extending the Status struct to include a Conditions field.

The conditions framework is heavily based on
https://github.com/knative/pkg/blob/master/apis/condition_set.go
This adds support for the CRD to inline with the BuildRun
types changes.
@qu1queee qu1queee force-pushed the qu1queee/conditions_br branch from adec8bf to cfd5d7e Compare November 19, 2020 08:18
@SaschaSchwarze0
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SaschaSchwarze0

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

@openshift-merge-robot openshift-merge-robot merged commit b9c4903 into shipwright-io:master Nov 19, 2020
@qu1queee qu1queee deleted the qu1queee/conditions_br branch November 19, 2020 09:51
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants