-
Notifications
You must be signed in to change notification settings - Fork 4.7k
deploy: add conditions when creating replication controllers #11412
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,8 +70,13 @@ func GetDeploymentCondition(status deployapi.DeploymentConfigStatus, condType de | |
return nil | ||
} | ||
|
||
// SetDeploymentCondition updates the deployment to include the provided condition. | ||
// SetDeploymentCondition updates the deployment to include the provided condition. If the condition that | ||
// we are about to add already exists and has the same status and reason then we are not going to update. | ||
func SetDeploymentCondition(status *deployapi.DeploymentConfigStatus, condition deployapi.DeploymentCondition) { | ||
currentCond := GetDeploymentCondition(*status, condition.Type) | ||
if currentCond != nil && currentCond.Status == condition.Status && currentCond.Reason == condition.Reason { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this mean we are updating all deployments frequently? How many extra writes does this add per deployment? How frequently will we write now (since all condition changes now result in writes to etcd)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For Progressing conditions that's fine because once we transition to a terminal state we don't update them anymore. I've tested locally by adding some sleeps around to simulate load in the queue and as I expected it seems that we hotloop between updates for the Available condition because we always update its probe time. Now I think lastProbeTime for deployment conditions is a bad idea. For Available is obvious. Progressing is more tricky because 1) this condition should originally be added in the rolling updater, but having it in the controller is a nice abstraction (DC will be reconciled because of a RC update, condition as part of the status is updated in the controller) 2) Since we have it updated in the controller, we are going to hotloop as long as the deployment is progressing and I can imagine long-running deployments saturating the queue. That being said, I am removing lastProbeTime from the equation. |
||
return | ||
} | ||
newConditions := filterOutCondition(status.Conditions, condition.Type) | ||
status.Conditions = append(newConditions, condition) | ||
} | ||
|
@@ -474,6 +479,15 @@ func IsRollingConfig(config *deployapi.DeploymentConfig) bool { | |
return config.Spec.Strategy.Type == deployapi.DeploymentStrategyTypeRolling | ||
} | ||
|
||
// IsProgressing expects a state deployment config and its updated status in order to | ||
// determine if there is any progress. | ||
func IsProgressing(config deployapi.DeploymentConfig, newStatus deployapi.DeploymentConfigStatus) bool { | ||
oldStatusOldReplicas := config.Status.Replicas - config.Status.UpdatedReplicas | ||
newStatusOldReplicas := newStatus.Replicas - newStatus.UpdatedReplicas | ||
|
||
return (newStatus.UpdatedReplicas > config.Status.UpdatedReplicas) || (newStatusOldReplicas < oldStatusOldReplicas) | ||
} | ||
|
||
// MaxUnavailable returns the maximum unavailable pods a rolling deployment config can take. | ||
func MaxUnavailable(config deployapi.DeploymentConfig) int32 { | ||
if !IsRollingConfig(&config) { | ||
|
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.
open an issue for this
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.
#11462