-
Notifications
You must be signed in to change notification settings - Fork 150
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 common ACK pkg/condition #24
add common ACK pkg/condition #24
Conversation
4db22b4
to
90242d8
Compare
/approve |
pkg/types/manages_conditions.go
Outdated
|
||
// ManagesConditions describes a thing that can set and retrieve Condition | ||
// objects. | ||
type ManagesConditions interface { |
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.
nit: s/ManagesConditions
/ConditionsManager
/
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.
nit: s/
ManagesConditions
/ConditionsManager
/
@a-hilaly @RedbackThomson fine, changed the name :)
/approve |
Adds common resource condition functions to a new `pkg/condition`: - `Synced()` returns the resource's Condition of type ConditionTypeResourceSynced, or nil if the condition isn't found. - `Terminal()` returns the resource's Condition of type ConditionTypeTerminal, or nil if the condition isn't found. - `FirstOfType()` returns the first Condition of the specified type, or nil if a condition of the type isn't found on the resource. - `AllOfType()` returns a slice of `Condition` having the specified condition type. - `SetSynced()` ensures that a Condition of type ConditionTypeResourceSynced is present in the resource's Conditions collection and has a specified status, message and reason - `SetTerminal()` ensures that a Condition of type ConditionTypeResourceTerminal is present in the resource's Conditions collection and has a specified status, message and reason IMPORTANT COMPATIBILITY NOTE: Note that the `pkg/types.AWSResource` interface has been modified to be a composition of a new `pkg/types.ConditionManager` interface which adds a new `ReplaceConditions()` method that overwrites a resource's Conditions collection. This is a backwards-incompatible change since the `pkg/types.AWSResource` implementations generated by `aws-controllers-k8s/code-generator` (the `pkg/{RESOURCE/resource.go` files...}) will not include this new `ReplaceConditions` implementation and thus won't compile if you attempt to regenerate a controller using the ACK runtime after this patch is merged. A corresponding patch to the code-generator is coming that adds the `ReplaceCondiions` implementation.
90242d8
to
b3e167d
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: A-Hilaly, jaypipes, vijtrip2 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 |
Description of changes: Add the missing `ReplaceConditions` method introduced in aws-controllers-k8s/runtime#24 . Fix a import path error introduced in #102 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description of changes: Add the missing `ReplaceConditions` method introduced in aws-controllers-k8s/runtime#24 . Fix a import path error introduced in aws-controllers-k8s#102 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Adds common resource condition functions to a new
pkg/condition
:Synced()
returns the resource's Condition of typeConditionTypeResourceSynced, or nil if the condition isn't found.
Terminal()
returns the resource's Condition of typeConditionTypeTerminal, or nil if the condition isn't found.
FirstOfType()
returns the first Condition of the specified type, ornil if a condition of the type isn't found on the resource.
AllOfType()
returns a slice ofCondition
having the specifiedcondition type.
SetSynced()
ensures that a Condition of typeConditionTypeResourceSynced is present in the resource's Conditions
collection and has a specified status, message and reason
SetTerminal()
ensures that a Condition of typeConditionTypeResourceTerminal is present in the resource's Conditions
collection and has a specified status, message and reason
IMPORTANT COMPATIBILITY NOTE:
Note that the
pkg/types.AWSResource
interface has been modified to bea composition of a new
pkg/types.ConditionManager
interface whichadds a new
ReplaceConditions()
method that overwrites a resource'sConditions collection. This is a backwards-incompatible change since the
pkg/types.AWSResource
implementations generated byaws-controllers-k8s/code-generator
(thepkg/{RESOURCE/resource.go
files...}) will not include this new
ReplaceConditions
implementationand thus won't compile if you attempt to regenerate a controller using
the ACK runtime after this patch is merged. A corresponding patch to the
code-generator is coming that adds the
ReplaceCondiions
implementation.
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.