-
Notifications
You must be signed in to change notification settings - Fork 13
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 artifact URL as soon as reconciling starts #169
Conversation
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.
Agree we should set URL earlier, but I don't think we want to include a new call to update status. I would just set the field and allow the next update status call to do what you are intending here.
@@ -68,10 +68,23 @@ func (r *ModelReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl | |||
func (r *ModelReconciler) reconcileModel(ctx context.Context, model *apiv1.Model) (result, error) { | |||
log := log.FromContext(ctx) | |||
|
|||
if model.Status.Artifacts.URL != "" { | |||
if model.Status.Ready { |
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.
Keep this change to the conditional
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 mean change to model.Status.Ready == true
?
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 what I have currently is preferred over having
if model.Status.Ready == true {
Source: https://stackoverflow.com/questions/3685002/check-if-boolean-is-true
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.
Was just commenting on checking ready instead of the url
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.
not sure why I misunderstood your comment. I read it as change to the conditional format or smth like that.
return result{success: true}, nil | ||
} | ||
|
||
if model.Status.Artifacts.URL == "" { | ||
model.Status.Artifacts.URL = r.Cloud.ObjectArtifactURL(model).String() |
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.
Always set this URL.
Reason: apiv1.ReasonJobComplete, | ||
ObservedGeneration: model.Generation, | ||
}) | ||
if err := r.Status().Update(ctx, model); err != nil { |
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.
Remove this status update... This will be too fleeting, not worth the API request.
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.
This update request will be sent very soon after this and the URL will be set then.
api/v1/conditions.go
Outdated
ConditionLoaded = "Loaded" | ||
ConditionModelled = "Modelled" | ||
ConditionDeployed = "Deployed" | ||
ConditionReconciling = "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.
Conditions here should be end-states not transition states. IMO, I would remove this and go with the suggested changes below which make this unnecessary.
I verified the new approach of not using an additional update works perfectly as well. Thanks for the great suggestion |
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.
Looks good!
Fixes #144