I'm trying to update the status of a custom resource and I'm unable to figure out why its not working..
Here is the _types.go
:
// ScoringServerStatus defines the observed state of ScoringServer
type ScoringServerStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Reason string `json:"reason"`
Message string `json:"message"`
Conditions []metav1.Condition `json:"conditions"`
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// ScoringServer is the Schema for the scoringservers API
type ScoringServer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ScoringServerSpec `json:"spec,omitempty"`
Status ScoringServerStatus `json:"status,omitempty"`
}
I'm trying to set the value of Reason and Message in this status:
if !isProjectAvailable {
infoMessage = "Unable to find requested project, can't deploy scoring server"
log.Log.Info(infoMessage)
statusUpdate := scoringv1.ScoringServerStatus{Reason: "Unable to verify project in Machinify", Message: infoMessage}
log.Log.Info(statusUpdate.Reason)
scoringServer.Status = statusUpdate
if err := r.Status().Update(ctx, scoringServer); err != nil {
log.Log.Info(err.Error())
}
return ctrl.Result{Requeue: false, RequeueAfter: 0}, nil
}
But nothing changes when I run this. I'm not receiving any errors and if I describe the resource I don't see an updated status...