From 745e88f7d688f3560c618a325736618d8768aef9 Mon Sep 17 00:00:00 2001 From: denis-tingaikin Date: Thu, 18 Nov 2021 21:53:22 +0300 Subject: [PATCH] add fixes Signed-off-by: denis-tingaikin --- .cloudtest.yaml | 2 +- .github/workflows/automerge.yaml | 18 ++--- .golangci.yml | 2 +- .yamllint.yml | 4 +- packet/packet.yaml | 2 +- scripts/aws/amazon-eks-nodegroup.yaml | 21 +++--- scripts/aws/amazon-eks-role-policy.json | 2 +- scripts/aws/amazon-eks-vpc.yaml | 90 ++++++++++++------------- 8 files changed, 68 insertions(+), 73 deletions(-) diff --git a/.cloudtest.yaml b/.cloudtest.yaml index 7577370..6c9b3a0 100644 --- a/.cloudtest.yaml +++ b/.cloudtest.yaml @@ -7,7 +7,7 @@ statistics: enabled: true interval: 60 import: - - aks/.* + - gke/.* - aks/.* - aws/.* - packet/.* diff --git a/.github/workflows/automerge.yaml b/.github/workflows/automerge.yaml index de838d1..466134e 100644 --- a/.github/workflows/automerge.yaml +++ b/.github/workflows/automerge.yaml @@ -5,7 +5,7 @@ on: types: - completed workflows: - - 'ci' + - "ci" jobs: automerge-on-success: name: Automerge @@ -28,11 +28,11 @@ jobs: ENABLED_FOR_MANUAL_CHANGES: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} automerge-otherwise: - name: Automerge - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion != 'success' && github.actor == 'nsmbot' }} - steps: - - name: Set status 'failure' - run: | - echo Set status 'failure' for 'automerge' workflow to prevent run "update dependent repositories" or any other dependent workflows' - exit -1 + name: Automerge + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion != 'success' && github.actor == 'nsmbot' }} + steps: + - name: Set status 'failure' + run: | + echo Set status 'failure' for 'automerge' workflow to prevent run "update dependent repositories" or any other dependent workflows' + exit -1 diff --git a/.golangci.yml b/.golangci.yml index 6776d89..5925cda 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -47,7 +47,7 @@ linters-settings: - errors packages-with-error-message: # specify an error message to output when a blacklisted package is used - - errors: "Please use \"github.com/pkg/errors\" instead of \"errors\" in go imports" + - errors: 'Please use "github.com/pkg/errors" instead of "errors" in go imports' misspell: locale: US unparam: diff --git a/.yamllint.yml b/.yamllint.yml index 4914fed..881eaf1 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -2,8 +2,8 @@ extends: default yaml-files: - - '*.yaml' - - '*.yml' + - "*.yaml" + - "*.yml" rules: truthy: disable diff --git a/packet/packet.yaml b/packet/packet.yaml index 0566f7c..cb9e9d0 100644 --- a/packet/packet.yaml +++ b/packet/packet.yaml @@ -4,7 +4,7 @@ providers: - name: "packet" kind: "packet" instances: 1 - retry: 5 + retry: 10 node-count: 2 enabled: true timeout: 2400 # 40 minutes to start cluster diff --git a/scripts/aws/amazon-eks-nodegroup.yaml b/scripts/aws/amazon-eks-nodegroup.yaml index 635e426..876e8e5 100644 --- a/scripts/aws/amazon-eks-nodegroup.yaml +++ b/scripts/aws/amazon-eks-nodegroup.yaml @@ -3,7 +3,6 @@ AWSTemplateFormatVersion: 2010-09-09 Description: Amazon EKS - Node Group Parameters: - KeyName: Description: The EC2 Key Pair to allow SSH access to the instances Type: AWS::EC2::KeyPair::KeyName @@ -146,7 +145,6 @@ Parameters: Type: List Metadata: - AWS::CloudFormation::Interface: ParameterGroups: - Label: @@ -173,7 +171,6 @@ Metadata: - Subnets Resources: - NodeInstanceProfile: Type: AWS::IAM::InstanceProfile Properties: @@ -310,18 +307,16 @@ Resources: VolumeType: gp2 DeleteOnTermination: true UserData: - Fn::Base64: - !Sub | - #!/bin/bash - set -o xtrace - /etc/eks/bootstrap.sh ${ClusterName} ${BootstrapArguments} - /opt/aws/bin/cfn-signal --exit-code $? \ - --stack ${AWS::StackName} \ - --resource NodeGroup \ - --region ${AWS::Region} + Fn::Base64: !Sub | + #!/bin/bash + set -o xtrace + /etc/eks/bootstrap.sh ${ClusterName} ${BootstrapArguments} + /opt/aws/bin/cfn-signal --exit-code $? \ + --stack ${AWS::StackName} \ + --resource NodeGroup \ + --region ${AWS::Region} Outputs: - NodeInstanceRole: Description: The node instance role Value: !GetAtt NodeInstanceRole.Arn diff --git a/scripts/aws/amazon-eks-role-policy.json b/scripts/aws/amazon-eks-role-policy.json index 3193c31..7180e5d 100644 --- a/scripts/aws/amazon-eks-role-policy.json +++ b/scripts/aws/amazon-eks-role-policy.json @@ -9,4 +9,4 @@ "Action": "sts:AssumeRole" } ] -} +} \ No newline at end of file diff --git a/scripts/aws/amazon-eks-vpc.yaml b/scripts/aws/amazon-eks-vpc.yaml index ec5c023..bb8f149 100644 --- a/scripts/aws/amazon-eks-vpc.yaml +++ b/scripts/aws/amazon-eks-vpc.yaml @@ -1,10 +1,9 @@ # yamllint disable --- -AWSTemplateFormatVersion: '2010-09-09' -Description: 'Amazon EKS Sample VPC' +AWSTemplateFormatVersion: "2010-09-09" +Description: "Amazon EKS Sample VPC" Parameters: - VpcBlock: Type: String Default: 192.168.0.0/16 @@ -28,8 +27,7 @@ Parameters: Metadata: AWS::CloudFormation::Interface: ParameterGroups: - - - Label: + - Label: default: "Worker Network Configuration" Parameters: - VpcBlock @@ -41,17 +39,17 @@ Conditions: Has2Azs: Fn::Or: - Fn::Equals: - - {Ref: 'AWS::Region'} - - ap-south-1 + - { Ref: "AWS::Region" } + - ap-south-1 - Fn::Equals: - - {Ref: 'AWS::Region'} - - ap-northeast-2 + - { Ref: "AWS::Region" } + - ap-northeast-2 - Fn::Equals: - - {Ref: 'AWS::Region'} - - ca-central-1 + - { Ref: "AWS::Region" } + - ca-central-1 - Fn::Equals: - - {Ref: 'AWS::Region'} - - cn-north-1 + - { Ref: "AWS::Region" } + - cn-north-1 HasMoreThan2Azs: Fn::Not: @@ -61,18 +59,18 @@ Resources: VPC: Type: AWS::EC2::VPC Properties: - CidrBlock: !Ref VpcBlock + CidrBlock: !Ref VpcBlock EnableDnsSupport: true EnableDnsHostnames: true Tags: - - Key: Name - Value: !Sub '${AWS::StackName}-VPC' + - Key: Name + Value: !Sub "${AWS::StackName}-VPC" Ipv6VPCCidrBlock: Type: AWS::EC2::VPCCidrBlock Properties: - AmazonProvidedIpv6CidrBlock: true - VpcId: !Ref VPC + AmazonProvidedIpv6CidrBlock: true + VpcId: !Ref VPC InternetGateway: Type: "AWS::EC2::InternetGateway" @@ -88,10 +86,10 @@ Resources: Properties: VpcId: !Ref VPC Tags: - - Key: Name - Value: Public Subnets - - Key: Network - Value: Public + - Key: Name + Value: Public Subnets + - Key: Network + Value: Public Route: DependsOn: VPCGatewayAttachment @@ -108,18 +106,19 @@ Resources: Properties: AvailabilityZone: Fn::Select: - - '0' - - Fn::GetAZs: - Ref: AWS::Region + - "0" + - Fn::GetAZs: + Ref: AWS::Region AssignIpv6AddressOnCreation: true CidrBlock: Ref: Subnet01Block - Ipv6CidrBlock: !Select [0, !Cidr [!Select [0, !GetAtt VPC.Ipv6CidrBlocks], 256, 64]] + Ipv6CidrBlock: + !Select [0, !Cidr [!Select [0, !GetAtt VPC.Ipv6CidrBlocks], 256, 64]] VpcId: Ref: VPC Tags: - - Key: Name - Value: !Sub "${AWS::StackName}-Subnet01" + - Key: Name + Value: !Sub "${AWS::StackName}-Subnet01" DependsOn: Ipv6VPCCidrBlock Subnet02: @@ -129,17 +128,18 @@ Resources: Properties: AvailabilityZone: Fn::Select: - - '1' - - Fn::GetAZs: - Ref: AWS::Region + - "1" + - Fn::GetAZs: + Ref: AWS::Region CidrBlock: Ref: Subnet02Block - Ipv6CidrBlock: !Select [1, !Cidr [!Select [0, !GetAtt VPC.Ipv6CidrBlocks], 256, 64]] + Ipv6CidrBlock: + !Select [1, !Cidr [!Select [0, !GetAtt VPC.Ipv6CidrBlocks], 256, 64]] VpcId: Ref: VPC Tags: - - Key: Name - Value: !Sub "${AWS::StackName}-Subnet02" + - Key: Name + Value: !Sub "${AWS::StackName}-Subnet02" DependsOn: Ipv6VPCCidrBlock Subnet03: @@ -150,17 +150,18 @@ Resources: Properties: AvailabilityZone: Fn::Select: - - '2' - - Fn::GetAZs: - Ref: AWS::Region + - "2" + - Fn::GetAZs: + Ref: AWS::Region CidrBlock: Ref: Subnet03Block - Ipv6CidrBlock: !Select [2, !Cidr [!Select [0, !GetAtt VPC.Ipv6CidrBlocks], 256, 64]] + Ipv6CidrBlock: + !Select [2, !Cidr [!Select [0, !GetAtt VPC.Ipv6CidrBlocks], 256, 64]] VpcId: Ref: VPC Tags: - - Key: Name - Value: !Sub "${AWS::StackName}-Subnet03" + - Key: Name + Value: !Sub "${AWS::StackName}-Subnet03" DependsOn: Ipv6VPCCidrBlock Subnet01RouteTableAssociation: @@ -189,18 +190,17 @@ Resources: VpcId: !Ref VPC Outputs: - SubnetIds: Description: All subnets in the VPC Value: Fn::If: - - HasMoreThan2Azs - - !Join [ ",", [ !Ref Subnet01, !Ref Subnet02, !Ref Subnet03 ] ] - - !Join [ ",", [ !Ref Subnet01, !Ref Subnet02 ] ] + - HasMoreThan2Azs + - !Join [",", [!Ref Subnet01, !Ref Subnet02, !Ref Subnet03]] + - !Join [",", [!Ref Subnet01, !Ref Subnet02]] SecurityGroups: Description: Security group for the cluster control plane communication with worker nodes - Value: !Join [ ",", [ !Ref ControlPlaneSecurityGroup ] ] + Value: !Join [",", [!Ref ControlPlaneSecurityGroup]] VpcId: Description: The VPC Id