Skip to content

Commit

Permalink
Merge pull request #9162 from johngmyers/revert-9152
Browse files Browse the repository at this point in the history
Revert "Add EC2 instance lifecycle label to nodes"
  • Loading branch information
k8s-ci-robot authored May 22, 2020
2 parents ab79a41 + ca3b13d commit 1c9ca79
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
20 changes: 0 additions & 20 deletions cmd/kops-controller/controllers/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,6 @@ func (r *NodeReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return ctrl.Result{}, fmt.Errorf("unable to build config for node %s: %v", node.Name, err)
}

lifecycle, err := r.getInstanceLifecycle(ctx, node)
if err != nil {
return ctrl.Result{}, fmt.Errorf("unable to get instance lifecycle %s: %v", node.Name, err)
}

if len(lifecycle) > 0 {
labels[fmt.Sprintf("node-role.kubernetes.io/%s-worker", lifecycle)] = "true"
}

updateLabels := make(map[string]string)
for k, v := range labels {
actual, found := node.Labels[k]
Expand Down Expand Up @@ -196,17 +187,6 @@ func (r *NodeReconciler) getClusterForNode(node *corev1.Node) (*kops.Cluster, er
return cluster, nil
}

// getInstanceLifecycle returns InstanceLifecycle string object
func (r *NodeReconciler) getInstanceLifecycle(ctx context.Context, node *corev1.Node) (string, error) {

identity, err := r.identifier.IdentifyNode(ctx, node)
if err != nil {
return "", fmt.Errorf("error identifying node %q: %v", node.Name, err)
}

return identity.InstanceLifecycle, nil
}

// getInstanceGroupForNode returns the kops.InstanceGroup object for the node
func (r *NodeReconciler) getInstanceGroupForNode(ctx context.Context, node *corev1.Node) (*kops.InstanceGroup, error) {
// We assume that if the instancegroup label is set, that it is correct
Expand Down
6 changes: 0 additions & 6 deletions pkg/nodeidentity/aws/identify.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ func (i *nodeIdentifier) IdentifyNode(ctx context.Context, node *corev1.Node) (*
return nil, fmt.Errorf("found instance %q, but state is %q", instanceID, instanceState)
}

lifecycle := ""
if instance.InstanceLifecycle != nil {
lifecycle = *instance.InstanceLifecycle
}

// TODO: Should we traverse to the ASG to confirm the tags there?
igName := getTag(instance.Tags, CloudTagInstanceGroupName)
if igName == "" {
Expand All @@ -115,7 +110,6 @@ func (i *nodeIdentifier) IdentifyNode(ctx context.Context, node *corev1.Node) (*

info := &nodeidentity.Info{}
info.InstanceGroup = igName
info.InstanceLifecycle = lifecycle

return info, nil
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/nodeidentity/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ type Identifier interface {
}

type Info struct {
InstanceGroup string
InstanceLifecycle string
InstanceGroup string
}

0 comments on commit 1c9ca79

Please sign in to comment.