Skip to content

Commit

Permalink
Adding algorithm deployment status to Suggestion status (#784)
Browse files Browse the repository at this point in the history
* Adding deployment status to Suggestion status

* Adding running status immediately when set
  • Loading branch information
johnugeorge authored and k8s-ci-robot committed Sep 21, 2019
1 parent 18ca285 commit f26f7b3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
9 changes: 5 additions & 4 deletions pkg/apis/controller/suggestions/v1alpha3/suggestion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ type SuggestionCondition struct {
type SuggestionConditionType string

const (
SuggestionCreated SuggestionConditionType = "Created"
SuggestionRunning SuggestionConditionType = "Running"
SuggestionSucceeded SuggestionConditionType = "Succeeded"
SuggestionFailed SuggestionConditionType = "Failed"
SuggestionCreated SuggestionConditionType = "Created"
SuggestionDeploymentReady SuggestionConditionType = "DeploymentReady"
SuggestionRunning SuggestionConditionType = "Running"
SuggestionSucceeded SuggestionConditionType = "Succeeded"
SuggestionFailed SuggestionConditionType = "Failed"
)

// +genclient
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/controller/suggestions/v1alpha3/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,7 @@ func (suggestion *Suggestion) MarkSuggestionStatusFailed(reason, message string)
}
suggestion.setCondition(SuggestionFailed, v1.ConditionTrue, reason, message)
}

func (suggestion *Suggestion) MarkSuggestionStatusDeploymentReady(status v1.ConditionStatus, reason, message string) {
suggestion.setCondition(SuggestionDeploymentReady, status, reason, message)
}
7 changes: 7 additions & 0 deletions pkg/controller.v1alpha3/suggestion/suggestion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,14 @@ func (r *ReconcileSuggestion) ReconcileSuggestion(instance *suggestionsv1alpha3.
} else {
if isReady := r.checkDeploymentReady(foundDeploy); isReady != true {
// deployment is not ready yet
msg := "Deployment is not ready"
instance.MarkSuggestionStatusDeploymentReady(corev1.ConditionFalse, SuggestionDeploymentNotReady, msg)
return nil
} else {
msg := "Deployment is ready"
instance.MarkSuggestionStatusDeploymentReady(corev1.ConditionTrue, SuggestionDeploymentReady, msg)
}

}
experiment := &experimentsv1alpha3.Experiment{}
trials := &trialsv1alpha3.TrialList{}
Expand All @@ -201,6 +207,7 @@ func (r *ReconcileSuggestion) ReconcileSuggestion(instance *suggestionsv1alpha3.
}
msg := "Suggestion is running"
instance.MarkSuggestionStatusRunning(SuggestionRunningReason, msg)
return nil
}
logger.Info("Sync assignments", "suggestions", instance.Spec.Requests)
if err = r.SyncAssignments(instance, experiment, trials.Items); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import (
)

const (
SuggestionCreatedReason = "SuggestionCreated"
SuggestionRunningReason = "SuggestionRunning"
SuggestionSucceededReason = "SuggestionSucceeded"
SuggestionFailedReason = "SuggestionFailed"
SuggestionKilledReason = "SuggestionKilled"
SuggestionCreatedReason = "SuggestionCreated"
SuggestionDeploymentReady = "DeploymentReady"
SuggestionDeploymentNotReady = "DeploymentNotReady"
SuggestionRunningReason = "SuggestionRunning"
SuggestionSucceededReason = "SuggestionSucceeded"
SuggestionFailedReason = "SuggestionFailed"
SuggestionKilledReason = "SuggestionKilled"
)

func (r *ReconcileSuggestion) updateStatus(s *suggestionsv1alpha3.Suggestion, oldS *suggestionsv1alpha3.Suggestion) error {
Expand Down

0 comments on commit f26f7b3

Please sign in to comment.