Status aggregation is complicated, but I guess we have to start with built-in policies.
I'm not sure what "alive" means to an Service
tho, when there's "ready"... Does the policy apply to both?
type StatusPolicy string
const (
// Alive/Ready if all targets are Alive/Ready
StatusPolicyAll StatusPolicy = "All"
// Alive/Ready if half + 1 of the targets are Alive/Ready
StatusPolicyMajority StatusPolicy = "Majority"
// Alive/Ready if at least 1 target is Alive/Ready
StatusPolicyOne StatusPolicy = "One"
// Alive/Ready if at least N targets are Alive/Ready, where N is PolicyQualifier as an int
StatusPolicyAtLeast StatusPolicy = "AtLeast"
)
type ServiceSpec struct {
...
Policy StatusPolicy `json:"policy,omitempty"`
PolicyQualifier interface{} `json:"policyQualifier,omitempty"`
}
type ServiceStatus struct {
...
Conditions []ServiceCondition `json:"conditions,omitempty"`
LastUpdateTime util.Time `json:"lastUpdateTime,omitempty"`
LastTransitionTime util.Time `json:"lastTransitionTime,omitempty"`
}
type ServiceConditionType string
const (
ServiceAlive ServiceConditionType = "Alive"
ServiceReady ServiceConditionType = "Ready"
)
type ServiceCondition struct {
Type ServiceTargetConditionType `json:"type"`
Status ConditionStatus `json:"status"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
I guess a load balencer could then just watch Service or ServiceStatus to know what server target addresses should be routable.