in pkg/controller/manager.go [182:229]
func (am *actionManager) takeAction(pin *intent.Intent) error {
log := am.log.WithFields(logfields.Intent(pin))
successCheckRun := successfulUpdate(pin)
if successCheckRun {
log.Debug("handling successful update")
}
if pin.Intrusive() && !successCheckRun {
err := am.nodem.Cordon(pin.NodeName)
if err != nil {
log.WithError(err).Error("could not cordon")
return err
}
err = am.nodem.Drain(pin.NodeName)
if err != nil {
log.WithError(err).Error("could not drain")
// TODO: make workload check/ignore configurable
log.Warn("proceeding anyway")
}
}
// Handle successful node reconnection.
if successCheckRun {
// Reset the state to begin its stabilization.
pin = pin.Reset()
err := am.checkNode(pin.NodeName)
if err != nil {
log.WithError(err).Error("unable to perform success-check")
// TODO: make success checks configurable
log.Warn("proceeding anyway")
}
err = am.nodem.Uncordon(pin.NodeName)
if err != nil {
log.WithError(err).Error("could not uncordon")
// TODO: make policy consider failed success handle scenarios,
// otherwise we could make a starved cluster.
log.Warn("workload will not return")
return err
}
}
err := am.poster.Post(pin)
if err != nil {
log.WithError(err).Error("unable to post intent")
}
return err
}