Skip to content

Commit

Permalink
fix: set absent fields as nil (#29)
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinav Sinha <[email protected]>
  • Loading branch information
zeborg authored Dec 1, 2022
1 parent b347e3f commit 44245af
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions controllers/awsadapterconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (r *AWSAdapterConfigReconciler) Reconcile(ctx context.Context, req ctrl.Req
for _, v := range x.Nodegroups {
if y, err := svc.DescribeNodegroup(context.TODO(), &eks.DescribeNodegroupInput{ClusterName: objOld.Spec.Name, NodegroupName: &v}); err == nil {
objNew.Status.EKSCluster.Compute.NodeGroups = []*securityv1alpha1.EKSNodeGroup{}
launchTemplate := &securityv1alpha1.EC2LaunchTemplate{}
var launchTemplate *securityv1alpha1.EC2LaunchTemplate
if y.Nodegroup.LaunchTemplate != nil {
launchTemplate = &securityv1alpha1.EC2LaunchTemplate{
ID: y.Nodegroup.LaunchTemplate.Id,
Expand Down Expand Up @@ -219,11 +219,14 @@ func (r *AWSAdapterConfigReconciler) Reconcile(ctx context.Context, req ctrl.Req
})
}

remoteAccessConfig := &securityv1alpha1.EKSNodeGroupRemoteAccessConfig{}
var remoteAccessConfig *securityv1alpha1.EKSNodeGroupRemoteAccessConfig
if y.Nodegroup.RemoteAccess != nil {
remoteAccessConfig.Ec2SshKey = y.Nodegroup.RemoteAccess.Ec2SshKey
remoteAccessConfig.SourceSecurityGroups = y.Nodegroup.RemoteAccess.SourceSecurityGroups
remoteAccessConfig = &securityv1alpha1.EKSNodeGroupRemoteAccessConfig{
Ec2SshKey: y.Nodegroup.RemoteAccess.Ec2SshKey,
SourceSecurityGroups: y.Nodegroup.RemoteAccess.SourceSecurityGroups,
}
}

objNew.Status.EKSCluster.Compute.NodeGroups = append(objNew.Status.EKSCluster.Compute.NodeGroups, &securityv1alpha1.EKSNodeGroup{
Name: v,
ScalingConfig: &securityv1alpha1.EKSNodeGroupScalingConfig{
Expand Down

0 comments on commit 44245af

Please sign in to comment.