-
Notifications
You must be signed in to change notification settings - Fork 182
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
Implement helpers from pkg/runtime #347
Conversation
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
// apply | ||
changeSet, err := r.applyWithRetry(ctx, kustomization, impersonation, source.GetArtifact().Revision, dirPath, 5*time.Second) | ||
changeSet, err := r.applyWithRetry(ctx, *kustomization, impersonation, artifact.Revision, dirPath, 5*time.Second) | ||
if err != nil { | ||
return kustomizev1.KustomizationNotReady( | ||
kustomization, | ||
source.GetArtifact().Revision, | ||
meta.ReconciliationFailedReason, | ||
err.Error(), | ||
), err | ||
conditions.MarkFalse(kustomization, meta.ReadyCondition, meta.ReconciliationFailedReason, err.Error()) | ||
return ctrl.Result{RequeueAfter: kustomization.GetRetryInterval()}, err | ||
} |
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.
We should patch the object before running the apply as this can take some time.
// health assessment | ||
err = r.checkHealth(ctx, statusPoller, kustomization, source.GetArtifact().Revision, changeSet != "") | ||
err = r.checkHealth(ctx, statusPoller, kustomization, artifact.Revision, changeSet != "") | ||
if err != nil { | ||
return kustomizev1.KustomizationNotReadySnapshot( | ||
kustomization, | ||
snapshot, | ||
source.GetArtifact().Revision, | ||
kustomizev1.HealthCheckFailedReason, | ||
err.Error(), | ||
), err | ||
} | ||
|
||
return kustomizev1.KustomizationReady( | ||
kustomization, | ||
snapshot, | ||
source.GetArtifact().Revision, | ||
meta.ReconciliationSucceededReason, | ||
"Applied revision: "+source.GetArtifact().Revision, | ||
), nil | ||
conditions.MarkFalse(kustomization, meta.ReadyCondition, kustomizev1.HealthCheckFailedReason, err.Error()) | ||
conditions.MarkFalse(kustomization, kustomizev1.HealthyCondition, kustomizev1.HealthCheckFailedReason, err.Error()) | ||
return ctrl.Result{RequeueAfter: kustomization.GetRetryInterval()}, err | ||
} |
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.
We should patch the object before we assess health as this can take some time.
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.
To preserve the current behaviour, the ReadyCondition
should stay Unknown
until the check finishes. The HealthyCondition
could be set to Unknown
with the message Health check in progress
before the check starts.
} | ||
|
||
// Mark the resource as under reconciliation | ||
conditions.MarkTrue(kustomization, meta.ReconcilingCondition, "Reconciling", "") |
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 already do this at the top.
} | ||
|
||
// Mark the resource as under reconciliation | ||
conditions.MarkTrue(kustomization, meta.ReconcilingCondition, "Reconciling", "") | ||
kustomization.Status.LastAttemptedRevision = artifact.Revision |
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 would record this as soon as we have seen the revision (when we have an artifact).
} | ||
|
||
kustomization.Status.LastAppliedRevision = artifact.Revision | ||
kustomization.Status.Snapshot = snapshot |
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 would set this as soon as it can be set, and I think that might be a bit earlier.
@stefanprodan: at what time becomes the previous snapshot irrelevant?
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.
We have to set the snapshot right after prune.
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
meta.ReadyCondition, | ||
meta.ReconcilingCondition, | ||
meta.StalledCondition, | ||
meta.ProgressingReason, |
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.
Why is here ProgressingReason
? Do we need HealtyCondition
also?
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 think we need to set HealthyCondition
too
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Superseded by #575 |
Signed-off-by: Somtochi Onyekwere somtochionyekwere@gmail.com