Skip to content

Commit

Permalink
Slight refactor of UpdateAWSNode
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbeaumont committed Jul 21, 2020
1 parent 6ab34f3 commit 22890e9
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions pkg/addons/default/aws_node.go
Expand Up @@ -45,7 +45,8 @@ func UpdateAWSNode(rawClient kubernetes.RawClientInterface, region string, plan
if err != nil {
return false, err
}
if resource.GVK.Kind == "DaemonSet" {
switch resource.GVK.Kind {
case "DaemonSet":
daemonSet, ok := resource.Info.Object.(*appsv1.DaemonSet)
if !ok {
return false, fmt.Errorf("expected type %T; got %T", &appsv1.Deployment{}, resource.Info.Object)
Expand All @@ -67,18 +68,16 @@ func UpdateAWSNode(rawClient kubernetes.RawClientInterface, region string, plan
if err != nil {
return false, err
}
}

if resource.GVK.Kind == "CustomResourceDefinition" && plan {
// eniconfigs.crd.k8s.amazonaws.com CRD is only partially defined in the
// manifest, and causes a range of issue in plan mode, we can skip it
logger.Info(resource.LogAction(plan, "replaced"))
continue
}

// Leave service account if it exists
// to avoid overwriting annotations
if resource.GVK.Kind == "ServiceAccount" {
case "CustomResourceDefinition":
if plan {
// eniconfigs.crd.k8s.amazonaws.com CRD is only partially defined in the
// manifest, and causes a range of issue in plan mode, we can skip it
logger.Info(resource.LogAction(plan, "replaced"))
continue
}
case "ServiceAccount":
// Leave service account if it exists
// to avoid overwriting annotations
_, exists, err := resource.Get()
if err != nil {
return false, err
Expand Down

0 comments on commit 22890e9

Please sign in to comment.