Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong type of providers.aws.bakeryDefaults.baseImages[].virtualizationSettings #175

Merged
merged 3 commits into from
May 18, 2021

Conversation

yyuu
Copy link
Contributor

@yyuu yyuu commented May 14, 2021

Rosco manages virtualizationSettings for aws as a list of settings where an item contains regional VM settings, like follows.

    aws:
      bakeryDefaults:
        baseImages:
        - baseImage:
            id: ubuntu
            shortDescription: v12.04
            detailedDescription: Ubuntu Precise Pangolin v12.04
            packageType: deb
            templateFile: aws-ebs.json
          virtualizationSettings:
          - region: us-east-1
            virtualizationType: hvm
            instanceType: t2.micro
            sourceAmi: ami-d4aed0bc
            sshUserName: ubuntu
            spotPrice: "0"
            spotPriceAutoProduct: Linux/UNIX (Amazon VPC)

https://github.com/spinnaker/rosco/blob/version-0.25.0/halconfig/images.yml#L4-L122

However, so far Kleat wasn't allowing to have list value at virtualizationSettings because the field wasn't configured for repeated. At very least this prevented me to configure Rosco to bake AMIs, and needed to patch generated clouddriver.yml and rosco.yml to make those services working.

It seems that testdata also contains wrong schema around virtualizationSettings. As long as I could confirm from Rosco implementation, it had virtualizationSettings was typed as List<AWSVirtuzliationSettings>, therefore, I do believe this is a mistake made while generating testdata for aws provider.

    static class AWSBakeryDefaults {
      String awsAccessKey
      String awsSecretKey
      String awsSubnetId
      String awsVpcId
      Boolean awsAssociatePublicIpAddress
      String templateFile
      BakeRequest.VmType defaultVirtualizationType
      List<AWSOperatingSystemVirtualizationSettings> baseImages = []
    }

    static class AWSOperatingSystemVirtualizationSettings {
      BakeOptions.BaseImage baseImage
      List<AWSVirtualizationSettings> virtualizationSettings = []
    }

https://github.com/spinnaker/rosco/blob/version-0.25.0/rosco-core/src/main/groovy/com/netflix/spinnaker/rosco/providers/aws/config/RoscoAWSConfiguration.groovy#L65

…ionSettings` as repeated value

Rosco manages `virtualizationSettings` for `aws` as a list of settings where
an item contains regional VM settings, like follows.

    aws:
      bakeryDefaults:
        baseImages:
        - baseImage:
            id: ubuntu
            shortDescription: v12.04
            detailedDescription: Ubuntu Precise Pangolin v12.04
            packageType: deb
            templateFile: aws-ebs.json
          virtualizationSettings:
          - region: us-east-1
            virtualizationType: hvm
            instanceType: t2.micro
            sourceAmi: ami-d4aed0bc
            sshUserName: ubuntu
            spotPrice: "0"
            spotPriceAutoProduct: Linux/UNIX (Amazon VPC)

I have confirmed that testdata also contains wrong schema around
`virtualizationSettings`. As long as I could confirm from Rosco
implementation, it had `virtualizationSettings` was typed as
 `List<AWSVirtuzliationSettings>`, therefore, I do believe
this is mistake while generating testdata for `aws` provider.

    static class AWSBakeryDefaults {
      String awsAccessKey
      String awsSecretKey
      String awsSubnetId
      String awsVpcId
      Boolean awsAssociatePublicIpAddress
      String templateFile
      BakeRequest.VmType defaultVirtualizationType
      List<AWSOperatingSystemVirtualizationSettings> baseImages = []
    }

    static class AWSOperatingSystemVirtualizationSettings {
      BakeOptions.BaseImage baseImage
      List<AWSVirtualizationSettings> virtualizationSettings = []
    }

https://github.com/spinnaker/rosco/blob/version-0.25.0/rosco-core/src/main/groovy/com/netflix/spinnaker/rosco/providers/aws/config/RoscoAWSConfiguration.groovy#L65
@german-muzquiz
Copy link
Contributor

Thanks for pointing that out, seems that the build is failing though

@yyuu
Copy link
Contributor Author

yyuu commented May 15, 2021

Let me figure out the cause of failure 🙇

@yyuu
Copy link
Contributor Author

yyuu commented May 15, 2021

Thank you for pointing things out 🙇 I have fixed the broken unit test, and now it's passing locally. I do think now it should work on CI too, however, it's not automatically running as I'm the first time contributor to this project. It's nice if someone can re-run CI job 🙏

@german-muzquiz
Copy link
Contributor

german-muzquiz commented May 17, 2021

The main build is passing now, but golangci is failing: Seems that the file rosco_test.go needs to be formated
image
It's too bad that workflows don't run automatically to catch these earlier, I wish I had permissions to change that config :/

The build uses golangci-lint for that check, in case you want to run it manually in your machine.

@yyuu
Copy link
Contributor Author

yyuu commented May 18, 2021

Thank you very much for guidance 🙇‍♂️ I should have checked carefully what have been done in golangci step 🤦 Now I ran golangci-lint locally and fixed the detections. It's nice if you can have another look once you get chance for it 🙏

Copy link
Contributor

@german-muzquiz german-muzquiz left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes!

@german-muzquiz german-muzquiz added the ready to merge Reviewed and ready for merge label May 18, 2021
@mergify mergify bot merged commit 72cab9b into spinnaker:master May 18, 2021
@mergify mergify bot added the auto merged label May 18, 2021
@yyuu yyuu deleted the yy-aws-virtualization-settings-type branch May 18, 2021 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged ready to merge Reviewed and ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants