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

Hotfix/10015 cloud formation lint error #10066

Conversation

binkkatal
Copy link
Contributor

@binkkatal binkkatal commented Oct 18, 2020

connects #10015
The ./hack/update-expected.sh script generates some fields which are
required to be string fields and hence results in linting errors.

This PR changes those fields to string/*string and removes lint
warnings.

  • Sort help for error
    E3031 CidrIp contains invalid characters (Pattern: x.x.x.x/y) at Resources/AWSEC2SecurityGroupIngressicmppmtuapielb20010850040/Properties/CidrIp
    tests/integration/update_cluster/complex/cloudformation.json:629:9

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 18, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @binkkatal!

It looks like this is your first PR to kubernetes/kops 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kops has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @binkkatal. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 18, 2020
@@ -55,11 +55,11 @@ type AutoscalingGroup struct {
// LaunchTemplate is the launch template for the asg
LaunchTemplate *LaunchTemplate
// MaxSize is the max number of nodes in asg
MaxSize *int64
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for doing this! I think we should keep these types as integers (or int64) and only update the cloudformation (line 865) to string. We shouldn't modify the terraform types because those should use integers (see the terraform docs here).

Only modifying the cloudformationAutoscalingGroup type also means we don't have to update anything in pkg/model which I think is preferable for this particular issue.

This same suggestion applies to the loadbalancer and healthcheck types below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rifelpet , the fields in the loadbalancer and health check also results in lint warnings,
should they be reverted back to int64 fields ?

E3012 Property Resources/AWSElasticLoadBalancingLoadBalancerapiprivateciliumadvancedexamplecom/Properties/Listeners/0/InstancePort should be of type String
E3012 Property Resources/AWSElasticLoadBalancingLoadBalancerapiprivateciliumadvancedexamplecom/Properties/Listeners/0/LoadBalancerPort should be of type String
E3012 Property Resources/AWSElasticLoadBalancingLoadBalancerapiprivateciliumadvancedexamplecom/Properties/HealthCheck/HealthyThreshold should be of type String
E3012 Property Resources/AWSElasticLoadBalancingLoadBalancerapiprivateciliumadvancedexamplecom/Properties/HealthCheck/UnhealthyThreshold should be of type String
E3012 Property Resources/AWSElasticLoadBalancingLoadBalancerapiprivateciliumadvancedexamplecom/Properties/HealthCheck/Interval should be of type String
E3012 Property Resources/AWSElasticLoadBalancingLoadBalancerapiprivateciliumadvancedexamplecom/Properties/HealthCheck/Timeout should be of type String
E3012 Property Resources/AWSElasticLoadBalancingLoadBalancerbastionprivateciliumadvancedexamplecom/Properties/Listeners/0/InstancePort should be of type String
tests/integration/update_cluster/privateciliumadvanced/cloudformation.json:1297:13

E3012 Property Resources/AWSElasticLoadBalancingLoadBalancerbastionprivateciliumadvancedexamplecom/Properties/Listeners/0/LoadBalancerPort should be of type String

Copy link
Member

@rifelpet rifelpet Oct 19, 2020

Choose a reason for hiding this comment

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

These types should be updated to fix the lint warnings:

type cloudformationLoadBalancer struct {
LoadBalancerName *string `json:"LoadBalancerName,omitempty"`
Listener []*cloudformationLoadBalancerListener `json:"Listeners,omitempty"`
SecurityGroups []*cloudformation.Literal `json:"SecurityGroups,omitempty"`
Subnets []*cloudformation.Literal `json:"Subnets,omitempty"`
Scheme *string `json:"Scheme,omitempty"`
HealthCheck *cloudformationLoadBalancerHealthCheck `json:"HealthCheck,omitempty"`
AccessLog *cloudformationLoadBalancerAccessLog `json:"AccessLoggingPolicy,omitempty"`
ConnectionDrainingPolicy *cloudformationConnectionDrainingPolicy `json:"ConnectionDrainingPolicy,omitempty"`
ConnectionSettings *cloudformationConnectionSettings `json:"ConnectionSettings,omitempty"`
CrossZoneLoadBalancing *bool `json:"CrossZone,omitempty"`
Tags []cloudformationTag `json:"Tags,omitempty"`
}
type cloudformationLoadBalancerListener struct {
InstancePort int `json:"InstancePort"`
InstanceProtocol string `json:"InstanceProtocol"`
LoadBalancerPort int64 `json:"LoadBalancerPort"`
LoadBalancerProtocol string `json:"Protocol"`
}
type cloudformationLoadBalancerHealthCheck struct {
Target *string `json:"Target"`
HealthyThreshold *int64 `json:"HealthyThreshold"`
UnhealthyThreshold *int64 `json:"UnhealthyThreshold"`
Interval *int64 `json:"Interval"`
Timeout *int64 `json:"Timeout"`
}
type cloudformationConnectionDrainingPolicy struct {
Enabled *bool `json:"Enabled,omitempty"`
Timeout *int64 `json:"Timeout,omitempty"`
}
type cloudformationConnectionSettings struct {
IdleTimeout *int64 `json:"IdleTimeout,omitempty"`
}

but the regular LoadBalancer, LoadBalancerHealthCheck types should not. This means the type conversion from int64 to string will need to happen in RenderCloudformation rather than in the pkg/model packages. The ./hack/update-expected.sh script should only be updating the cloudformation.json files, not the kubernetes.tf files.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. do-not-merge/contains-merge-commits size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 20, 2020
@hakman
Copy link
Member

hakman commented Oct 20, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 20, 2020
@binkkatal
Copy link
Contributor Author

binkkatal commented Oct 20, 2020

@rifelpet , is it okay if i rebase and squash it to remove merge commits ?

@rifelpet
Copy link
Member

@binkkatal yes, feel free to rebase and squash. The changes look good to me, so once you do we can get this merged

@rifelpet rifelpet added the hacktoberfest-accepted Accepted contribution for Hacktoberfest label Oct 20, 2020
The ./hack/update-expected.sh script generates some fields which are
required to be string fields and hence results in linting errors.

This PR changes those fields to string/*string and removes lint
warnings.
@binkkatal
Copy link
Contributor Author

@rifelpet squashed and rebased the commits, ready to merge

@rifelpet
Copy link
Member

confirmed that cfn-lint no longer reports those warnings. Thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 21, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: binkkatal, rifelpet

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 21, 2020
@k8s-ci-robot k8s-ci-robot merged commit ea96bbd into kubernetes:master Oct 21, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.19 milestone Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/aws Issues or PRs related to aws provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. hacktoberfest-accepted Accepted contribution for Hacktoberfest lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants