Skip to content

Commit

Permalink
fix up linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 committed Mar 2, 2022
1 parent 08698f0 commit 49bcc72
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 8 deletions.
15 changes: 15 additions & 0 deletions pkg/cloudprovider/aws/amifamily/al2.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package amifamily

import (
Expand All @@ -8,6 +22,7 @@ import (
"strings"

"github.com/aws/aws-sdk-go/aws"

"github.com/aws/karpenter/pkg/apis/provisioning/v1alpha5"
"github.com/aws/karpenter/pkg/cloudprovider"
"github.com/aws/karpenter/pkg/cloudprovider/aws/apis/v1alpha1"
Expand Down
19 changes: 17 additions & 2 deletions pkg/cloudprovider/aws/amifamily/amifamily.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package amifamily

import (
Expand All @@ -9,11 +23,12 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"

"github.com/aws/karpenter/pkg/apis/provisioning/v1alpha5"
"github.com/aws/karpenter/pkg/cloudprovider"
"github.com/aws/karpenter/pkg/cloudprovider/aws/apis/v1alpha1"
core "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
)

var amiFamilies = map[string]AMIFamily{}
Expand Down
17 changes: 16 additions & 1 deletion pkg/cloudprovider/aws/amifamily/bottlerocket.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package amifamily

import (
Expand All @@ -6,12 +20,13 @@ import (
"fmt"

"github.com/aws/aws-sdk-go/aws"
"k8s.io/apimachinery/pkg/api/resource"

"github.com/aws/karpenter/pkg/apis/provisioning/v1alpha5"
"github.com/aws/karpenter/pkg/cloudprovider"
"github.com/aws/karpenter/pkg/cloudprovider/aws/apis/v1alpha1"
"github.com/aws/karpenter/pkg/utils/functional"
"github.com/aws/karpenter/pkg/utils/injection"
"k8s.io/apimachinery/pkg/api/resource"
)

func init() {
Expand Down
15 changes: 15 additions & 0 deletions pkg/cloudprovider/aws/amifamily/ubuntu.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package amifamily

import (
Expand All @@ -8,6 +22,7 @@ import (
"strings"

"github.com/aws/aws-sdk-go/aws"

"github.com/aws/karpenter/pkg/cloudprovider"
"github.com/aws/karpenter/pkg/cloudprovider/aws/apis/v1alpha1"
"github.com/aws/karpenter/pkg/utils/functional"
Expand Down
8 changes: 4 additions & 4 deletions pkg/cloudprovider/aws/providers/launchtemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (p *LaunchTemplateProvider) Get(ctx context.Context, constraints *v1alpha1.
for amiID, instanceTypes := range amis {
amiFamily, _ := amifamily.Get(*constraints.AMIFamily)
// Ensure the launch template exists, or create it
launchTemplate, err := p.ensureLaunchTemplate(ctx, constraints, &launchTemplateOptions{
launchTemplate, err := p.ensureLaunchTemplate(ctx, &launchTemplateOptions{
UserData: amiFamily.UserData(ctx, constraints, instanceTypes, additionalLabels, caBundle),
ClusterName: injection.GetOptions(ctx).ClusterName,
InstanceProfile: instanceProfile,
Expand All @@ -135,7 +135,7 @@ func (p *LaunchTemplateProvider) Get(ctx context.Context, constraints *v1alpha1.
return launchTemplates, nil
}

func (p *LaunchTemplateProvider) ensureLaunchTemplate(ctx context.Context, constraints *v1alpha1.Constraints, options *launchTemplateOptions) (*ec2.LaunchTemplate, error) {
func (p *LaunchTemplateProvider) ensureLaunchTemplate(ctx context.Context, options *launchTemplateOptions) (*ec2.LaunchTemplate, error) {
// Ensure that multiple threads don't attempt to create the same launch template
p.Lock()
defer p.Unlock()
Expand All @@ -153,7 +153,7 @@ func (p *LaunchTemplateProvider) ensureLaunchTemplate(ctx context.Context, const
})
// Create LT if one doesn't exist
if isNotFound(err) {
launchTemplate, err = p.createLaunchTemplate(ctx, constraints, options)
launchTemplate, err = p.createLaunchTemplate(ctx, options)
if err != nil {
return nil, fmt.Errorf("creating launch template, %w", err)
}
Expand All @@ -170,7 +170,7 @@ func (p *LaunchTemplateProvider) ensureLaunchTemplate(ctx context.Context, const
return launchTemplate, nil
}

func (p *LaunchTemplateProvider) createLaunchTemplate(ctx context.Context, constraints *v1alpha1.Constraints, options *launchTemplateOptions) (*ec2.LaunchTemplate, error) {
func (p *LaunchTemplateProvider) createLaunchTemplate(ctx context.Context, options *launchTemplateOptions) (*ec2.LaunchTemplate, error) {
output, err := p.EC2API.CreateLaunchTemplateWithContext(ctx, &ec2.CreateLaunchTemplateInput{
LaunchTemplateName: aws.String(launchTemplateName(options)),
LaunchTemplateData: &ec2.RequestLaunchTemplateData{
Expand Down
17 changes: 16 additions & 1 deletion pkg/cloudprovider/aws/providers/providers.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package providers

import (
Expand All @@ -13,9 +27,10 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ssm"
"github.com/aws/karpenter/pkg/utils/project"
"k8s.io/client-go/kubernetes"
"knative.dev/pkg/logging"

"github.com/aws/karpenter/pkg/utils/project"
)

const (
Expand Down

0 comments on commit 49bcc72

Please sign in to comment.