diff --git a/pkg/apis/app/v1/kieapp_types.go b/pkg/apis/app/v1/kieapp_types.go index 8d4c91d1b..14d2f51bb 100644 --- a/pkg/apis/app/v1/kieapp_types.go +++ b/pkg/apis/app/v1/kieapp_types.go @@ -428,7 +428,18 @@ type Condition struct { type KieAppStatus struct { Conditions []Condition `json:"conditions"` ConsoleHost string `json:"consoleHost,omitempty"` - Deployments []string `json:"deployments"` + Deployments Deployments `json:"deployments"` +} + +type Deployments struct { + // Deployments are ready to serve requests + Ready []string `json:"ready,omitempty"` + // Deployments are starting, may or may not succeed + Starting []string `json:"starting,omitempty"` + // Deployments are not starting, unclear what next step will be + Stopped []string `json:"stopped,omitempty"` + // Deployments failed + Failed []string `json:"failed,omitempty"` } type PlatformService interface { diff --git a/pkg/controller/kieapp/kieapp_controller.go b/pkg/controller/kieapp/kieapp_controller.go index 9b1321ba4..debb26166 100644 --- a/pkg/controller/kieapp/kieapp_controller.go +++ b/pkg/controller/kieapp/kieapp_controller.go @@ -8,7 +8,7 @@ import ( "strings" "time" - v1 "github.com/kiegroup/kie-cloud-operator/pkg/apis/app/v1" + "github.com/kiegroup/kie-cloud-operator/pkg/apis/app/v1" "github.com/kiegroup/kie-cloud-operator/pkg/controller/kieapp/constants" "github.com/kiegroup/kie-cloud-operator/pkg/controller/kieapp/defaults" "github.com/kiegroup/kie-cloud-operator/pkg/controller/kieapp/logs" @@ -139,8 +139,7 @@ func (reconciler *Reconciler) updateDeploymentConfigs(instance *v1.KieApp, env v reconciler.setFailedStatus(instance, v1.UnknownReason, err) return false, err } - dcNames := getDcNames(dcList.Items, instance) - instance.Status.Deployments = dcNames + instance.Status.Deployments = getDeploymentsStatuses(dcList.Items, instance) var dcUpdates []oappsv1.DeploymentConfig for _, dc := range dcList.Items { @@ -664,16 +663,28 @@ func checkTLS(tls *routev1.TLSConfig) bool { return false } -func getDcNames(dcs []oappsv1.DeploymentConfig, cr *v1.KieApp) []string { - var dcNames []string +func getDeploymentsStatuses(dcs []oappsv1.DeploymentConfig, cr *v1.KieApp) v1.Deployments { + var ready, starting, stopped []string for _, dc := range dcs { for _, ownerRef := range dc.GetOwnerReferences() { if ownerRef.UID == cr.UID { - dcNames = append(dcNames, dc.Name) + if dc.Spec.Replicas == 0 { + stopped = append(stopped, dc.Name) + } else if dc.Status.Replicas == 0 { + stopped = append(stopped, dc.Name) + } else if dc.Status.ReadyReplicas < dc.Status.Replicas { + starting = append(starting, dc.Name) + } else { + ready = append(ready, dc.Name) + } } } } - return dcNames + return v1.Deployments{ + Stopped: stopped, + Starting: starting, + Ready: ready, + } } // GetRouteHost returns the Hostname of the route provided