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

Implement helpers from pkg/runtime #347

Closed
wants to merge 6 commits into from

Conversation

somtochiama
Copy link
Member

Signed-off-by: Somtochi Onyekwere somtochionyekwere@gmail.com

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
@somtochiama somtochiama marked this pull request as draft May 20, 2021 09:32
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
go.mod Outdated Show resolved Hide resolved
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Comment on lines 312 to 317
// 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
}
Copy link
Member

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.

Comment on lines 326 to 332
// 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
}
Copy link
Member

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.

Copy link
Member

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", "")
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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?

Copy link
Member

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,
Copy link
Member

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?

Copy link
Member Author

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>
@stefanprodan
Copy link
Member

Superseded by #575

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants