Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

EKS Node Group Support #179

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

christopherhein
Copy link
Contributor

@christopherhein christopherhein commented Apr 12, 2019

Issue #, if available: #109

Description of changes:
Adds the ability to describe an EKSNodeGroup using a CRD and will automatically deploy the ASG. You currently will still need to add the IAM role into configmaps/aws-auth to allow it to join but you can get this by using:

kubectl get eksnodegroup <ng-name> -o  jsonpath="{.output.nodeInstanceRole}"

Definition

apiVersion: service-operator.aws/v1alpha1
kind: EKSNodeGroup
metadata:
  name: example-eks-nodegroup
spec:
  clusterName: "<cluster-name>"
  node:
    imageID: ami-XXXXX
    instanceType: m5.large
    volumeSize: 20
    # bootstrapArguments: ""
    keyName: ""
  autoScalingGroup:
    minSize: 2
    maxSize: 4
    desiredCapacity: 3
  networking:
    controlPlaneSecurityGroup: sg-XXXXX
    vpcID: vpc-XXXXX
    subnets: subnet-XXXXX,subnet-XXXXX,subnet-XXXXX

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

AWSTemplateFormatVersion: 2010-09-09
Description: 'AWS Service Operator - Amazon EKS Node Group (aso-1otq2cgd9)'
Parameters:
Namespace:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my first review of code in this repo so some of my understanding may be inaccurate.
Don't you have to Tag the operator created resource with Namespace, ResourceVersion, ResourceName i the CFN template?


func (c *Operator) onAdd(obj interface{}) {
s := obj.(*awsV1alpha1.EKSNodeGroup).DeepCopy()
if s.Status.ResourceStatus == "" || s.Status.ResourceStatus == "DELETE_COMPLETE" {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When can a NodeGroup resource that was marked as DELETE_COMPLETE come back in the queue to invoke onAdd?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks related to line 139-141?

- key: nodeGroupName
type: resourceName
description: |
NodeGroupName is the name of the EKS Node Group to be created.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't have multiple node groups in a cluster with the same name, right?

return nil, err
}

resourceCopy := resource.DeepCopy()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to create a deep copy instead updating fields inline?

}
}

if name != "" && namespace != "" {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do the messages sent for CloudFormation resources get filtered out? I'm guessing this code needs to be invoked only for the Stack event i.e. ResourceType == AWS::CloudFormation::Stack


// EKSNodeGroupStatus holds the status of the Cloudformation template
type EKSNodeGroupStatus struct {
ResourceStatus string `json:"resourceStatus"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this include current size of the ASG as well? Say I have CA deployed to the cluster and it's scaling up/down the instances. It would be nice for the describe to return current capacity of the node grop

}
if helpers.IsStackComplete(oo.Status.ResourceStatus, false) && !reflect.DeepEqual(oo.Spec, no.Spec) {
cft := New(c.config, oo, c.topicARN)
output, err := cft.UpdateStack(no)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CA has changed the current size of the ASG out of band of CFN stack, can calling update undo that change?

return err
}
config.Recorder.AnnotatedEventf(obj, annotations, corev1.EventTypeWarning, strcase.ToCamel(strings.ToLower(msg.ParsedMessage["ResourceStatus"])), msg.ParsedMessage["ResourceStatusReason"])
err = incrementRollbackCount(config, name, namespace)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we incrementing rollback count on DELETE_COMPLETE event?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants