-
Notifications
You must be signed in to change notification settings - Fork 188
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
Separate positive polarity conditions for ArtifactInStorage #646
Conversation
f78a225
to
aff9030
Compare
aff9030
to
c10f4c0
Compare
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.
@darkowlzz nice work! I added a nit and a question, apart from that it LGTM.
Introduce separate positive polarity conditions which are used to set Ready condition. Move the "artifact stored" ready condition into ArtifactInStorage positive polarity condition. If ArtifactInStorage is True and there's no negative polarity condition present, the Ready condition is summarized with ArtifactInStorage condition value. Also, update the priorities of the conditions. ArtifactInStorage has higher priority than SourceVerfied condition. If both are present, the Ready condition will have ArtifactInStorage. The negative polarity conditions are reordered to have the most likely actual cause of failure condition the highest priority, for example StorageOperationFailed, followed by the conditions that are reconciled first in the whole reconciliation so as to prioritize the first failure which may be the cause of subsequent failures. Signed-off-by: Sunny <darkowlzz@protonmail.com>
Update alll the other reconcilers similar to the GitRepository reconcilers to introduce positive condition ArtifactInStorage and reorder the status conditions. Signed-off-by: Sunny <darkowlzz@protonmail.com>
Signed-off-by: Sunny <darkowlzz@protonmail.com>
Signed-off-by: Sunny <darkowlzz@protonmail.com>
c10f4c0
to
b869716
Compare
For reference, with this change, the status conditions of GitRepository object after a successful reconciliation with source verification enabled would look like: conditions:
- lastTransitionTime: "2022-03-29T20:42:13Z"
message: stored artifact for revision 'no-source-ignore/60c7ae324d2edbb692ebd82d744c2e3cecc141f4'
observedGeneration: 1
reason: Succeeded
status: "True"
type: Ready
- lastTransitionTime: "2022-03-29T20:42:13Z"
message: stored artifact for revision 'no-source-ignore/60c7ae324d2edbb692ebd82d744c2e3cecc141f4'
observedGeneration: 1
reason: Succeeded
status: "True"
type: ArtifactInStorage
- lastTransitionTime: "2022-03-29T20:42:13Z"
message: verified signature of commit '60c7ae324d2edbb692ebd82d744c2e3cecc141f4'
observedGeneration: 1
reason: Succeeded
status: "True"
type: SourceVerified
observedGeneration: 1 And when there's a failure due to misconfiguration in the new generation, the conditions would look like: conditions:
- lastTransitionTime: "2022-03-30T11:34:05Z"
message: reconciling new object generation (2)
observedGeneration: 2
reason: NewGeneration
status: "True"
type: Reconciling
- lastTransitionTime: "2022-03-30T11:34:10Z"
message: 'failed to checkout and determine revision: unable to clone ''https://github.com/darkowlzz/flux2-kustomize-helm-example2'':
too many redirects or authentication replays'
observedGeneration: 2
reason: GitOperationFailed
status: "False"
type: Ready
- lastTransitionTime: "2022-03-30T11:34:10Z"
message: 'failed to checkout and determine revision: unable to clone ''https://github.com/darkowlzz/flux2-kustomize-helm-example2'':
too many redirects or authentication replays'
observedGeneration: 2
reason: GitOperationFailed
status: "True"
type: FetchFailed
- lastTransitionTime: "2022-03-29T20:42:13Z"
message: stored artifact for revision 'no-source-ignore/60c7ae324d2edbb692ebd82d744c2e3cecc141f4'
observedGeneration: 1
reason: Succeeded
status: "True"
type: ArtifactInStorage
- lastTransitionTime: "2022-03-29T20:42:13Z"
message: verified signature of commit '60c7ae324d2edbb692ebd82d744c2e3cecc141f4'
observedGeneration: 1
reason: Succeeded
status: "True"
type: SourceVerified
observedGeneration: 1 After the resolution of the above failure: conditions:
- lastTransitionTime: "2022-03-30T11:34:28Z"
message: stored artifact for revision 'no-source-ignore/60c7ae324d2edbb692ebd82d744c2e3cecc141f4'
observedGeneration: 3
reason: Succeeded
status: "True"
type: Ready
- lastTransitionTime: "2022-03-29T20:42:13Z"
message: stored artifact for revision 'no-source-ignore/60c7ae324d2edbb692ebd82d744c2e3cecc141f4'
observedGeneration: 3
reason: Succeeded
status: "True"
type: ArtifactInStorage
- lastTransitionTime: "2022-03-29T20:42:13Z"
message: verified signature of commit '60c7ae324d2edbb692ebd82d744c2e3cecc141f4'
observedGeneration: 3
reason: Succeeded
status: "True"
type: SourceVerified
observedGeneration: 3 Similar changes in all the other Source kinds. |
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.
LGTM, thank you @darkowlzz 🙇
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.
LGTM - really great stuff @darkowlzz
Introduce separate positive polarity conditions which are used to set
Ready condition. Move the "artifact stored" ready condition into
ArtifactInStorage positive polarity condition. If ArtifactInStorage is
True and there's no negative polarity condition present, the Ready
condition is summarized with ArtifactInStorage condition value.
Also, update the priorities of the conditions. ArtifactInStorage has
higher priority than SourceVerfied condition. If both are present, the
Ready condition will have ArtifactInStorage.
The negative polarity conditions are reordered to have the most likely
actual cause of failure condition the highest priority, for example
StorageOperationFailed, followed by the conditions that are reconciled
first in the whole reconciliation so as to prioritize the first failure
which may be the cause of subsequent failures.
In addition, the "artifact up-to-date" log is now also emitted as an event.
Fixes #617