Skip to content

Commit

Permalink
fix(spotinst): rolling-update workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
liranp committed Jul 15, 2019
1 parent dd6b031 commit bc003f5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/resources/spotinst/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,25 @@ func buildCloudInstanceGroupFromLaunchSpec(cloud Cloud, ig *kops.InstanceGroup,
func registerCloudInstanceGroupMembers(instanceGroup *cloudinstances.CloudInstanceGroup, nodeMap map[string]*v1.Node,
instances []Instance, currentInstanceGroupName string, instanceGroupUpdatedAt time.Time) error {

// The instance registration below registers all active instances with
// their instance group. In addition, it looks for outdated instances by
// comparing each instance creation timestamp against its instance group
// modification timestamp.
//
// In a rolling-update operation, one or more detach operations are
// performed to replace existing instances. This is done by updating the
// instance group and results in updating the modification timestamp to the
// current time.
//
// The update of the modification timestamp occurs only after the detach
// operation is completed, meaning that new instances have already been
// created, so our comparison may be incorrect.
//
// In order to work around this issue, we assume that the detach operation
// will take up to two minutes, and therefore we subtract this duration from
// the modification timestamp of the instance group.
instanceGroupUpdatedAt = instanceGroupUpdatedAt.Add(-2 * time.Minute)

for _, instance := range instances {
if instance.Id() == "" {
klog.Warningf("Ignoring instance with no ID: %v", instance)
Expand Down

0 comments on commit bc003f5

Please sign in to comment.