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

[core] Do not emit duplicate messages (warnings/errors/...) #9565

Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud @aws-cdk/core Related to core CDK functionality bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@eladb
Copy link
Contributor

eladb commented Aug 10, 2020

When synthesizing the EKS integration test I am getting the following output:

[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/KubectlProviderSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/Nodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/Nodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/Nodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/Nodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/Nodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/BottlerocketNodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/BottlerocketNodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/BottlerocketNodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/BottlerocketNodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/BottlerocketNodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/spot/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/spot/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/spot/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/spot/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/spot/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/InferenceInstances/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/InferenceInstances/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/InferenceInstances/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/InferenceInstances/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/InferenceInstances/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup

Reproduction Steps

In the CDK repo:

$ cd packages/@aws-cdk/aws-eks
$ cdk synth -a test/integ.eks-cluster.ts

What did you expect to happen?

Don't display the same warning twice:

[Warning at /aws-cdk-eks-cluster-test/Cluster/ControlPlaneSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/KubectlProviderSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/Nodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/BottlerocketNodes/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/spot/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup
[Warning at /aws-cdk-eks-cluster-test/Cluster/InferenceInstances/InstanceSecurityGroup] Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup

What actually happened?

Environment

  • CLI Version : 1.57.0
  • Framework Version: 1.57.0
  • Node.js Version: 14.5.0
  • OS : Mac OSX
  • Language (Version): all

This is 🐛 Bug Report

@eladb eladb added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 10, 2020
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Aug 10, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 10, 2020

The same annotation should probably just not be emitted twice.

@rix0rrr rix0rrr changed the title [ec2] Duplicate "Ignoring Egress rule" warnings [core] Do not emit duplicate messages (warnings/errors/...) Aug 10, 2020
@rix0rrr rix0rrr added @aws-cdk/core Related to core CDK functionality effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md and removed @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud labels Aug 10, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 10, 2020

Also that warning should probably not be emitted at all.

@rix0rrr rix0rrr added the p2 label Aug 10, 2020
@eladb
Copy link
Contributor Author

eladb commented Aug 10, 2020

The same annotation should probably just not be emitted twice.

That's probably a good idea - we can do that based on scope path and message text.

@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Aug 10, 2020
@NetaNir
Copy link
Contributor

NetaNir commented Aug 15, 2020

The reason I added the warning was due to multiple issues reported by users when trying to add an egress rule to allow all IPv6 traffic, and the rule being ignored since by default allowAllOutBound is set to true.
The default condition today creates a weird situation in which not all traffic is allowed by default (only IPv4) and in order to add all IPv6 one needs to set "allowAllOutBound" to false and then add two rules which allows all traffic, to IPv4 and IPv6.

See more discussion in #7827 (comment)

@rix0rrr

@eladb eladb removed their assignment Aug 17, 2020
@joerx
Copy link

joerx commented Sep 19, 2020

Assuming I'm creating an SG for an ECS service, like this:

    const serviceSg = new ec2.SecurityGroup(this, "MySg", {
      vpc: props.vpc,
    });

    const service = new ecs.FargateService(this, "Service", {
      securityGroups: [serviceSg],
    });

Then allow ingress from, let's say a database:

db.connections.allowFrom(serviceSg, ec2.Port.tcp(1234));

At this point I'll get the warning, in a (to my knowledge) perfectly valid setup. Trying to "fix" it by setting allowAllOutbound=false will break the ECS service since it now can't pull docker images anymore.

IMHO a warning shouldn't be shown here. It can be irritating and in this case counterproductive.

@NetaNir
Copy link
Contributor

NetaNir commented Sep 22, 2020

Yeah, the allowFrom is trying to add an ingress rule to the connection and an egress rule to security group. Since the security group already allows all outbound traffic the warning will be added. I agree that in this case it is not helpful. We will remove the warning once we add Ipv6 to the allowAllOutBound implementation.

@itajaja
Copy link

itajaja commented Jan 8, 2021

so is it safe if in EKS' addAutoScalingGroupCapacity i set allowAllOutbound to false? seems like the default security group does allow outbounds.

@heiba
Copy link

heiba commented Apr 11, 2021

@NetaNir Please see the picture below. This is a horrible amount of needless warnings that are emitted every time I build a project In CDK all related to the exact same ALB security group, albeit from different ALB listeners.

Please apply a fix to not emit this warning, or at least only emit it once.

This issue has been raised since 10th August 2020, i.e. 10 months ago.

Appreciate your kind action.

image

@ThomasSteinbach
Copy link
Contributor

@NetaNir "We will remove the warning once we add Ipv6 to the allowAllOutBound implementation."

Is there an issue we can track the status from? We have commented out --strict in our CDK deployment with a "TODO - WORKAROUND issue..." comment above. It would be nice having a reference to the progress of the solution, as we regularly try to solve all workarounds.

@heiba
Copy link

heiba commented May 29, 2021

@NetaNir any news on this please ?

@rix0rrr rix0rrr removed their assignment Jun 3, 2021
@metametadata
Copy link

It would be great to have some way to get rid of Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup warnings. Setting allowAllOutbound=false is not applicable in my cases.

@heiba
Copy link

heiba commented Nov 26, 2021

@NetaNir any news on this please ?

@automartin5000
Copy link

Assuming I'm creating an SG for an ECS service, like this:

    const serviceSg = new ec2.SecurityGroup(this, "MySg", {
      vpc: props.vpc,
    });

    const service = new ecs.FargateService(this, "Service", {
      securityGroups: [serviceSg],
    });

Then allow ingress from, let's say a database:

db.connections.allowFrom(serviceSg, ec2.Port.tcp(1234));

At this point I'll get the warning, in a (to my knowledge) perfectly valid setup. Trying to "fix" it by setting allowAllOutbound=false will break the ECS service since it now can't pull docker images anymore.

IMHO a warning shouldn't be shown here. It can be irritating and in this case counterproductive.

@rix0rrr @eladb @NetaNir Could we get a comment on fixing this? As previously mentioned, this is a bug when using the CDK as designed.

@manoj0700
Copy link

Any update or fix on this? Observing multiple warnings.

image

@rtrap-rsi
Copy link

Still no updates on this?

@bora-7
Copy link
Contributor

bora-7 commented Oct 12, 2022

working on it

bora-7 added a commit to bora-7/aws-cdk that referenced this issue Oct 12, 2022
bora-7 added a commit to bora-7/aws-cdk that referenced this issue Oct 12, 2022
@bora-7
Copy link
Contributor

bora-7 commented Oct 18, 2022

working on a permanent fix

@comcalvi comcalvi added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Jan 25, 2023
@mergify mergify bot closed this as completed in #24019 Feb 9, 2023
mergify bot pushed a commit that referenced this issue Feb 9, 2023
Annotations added many times clog terminal space and make debugging difficult. Deduplicate annotations based on the message.

Closes #9565.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Feb 9, 2023

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@metametadata
Copy link

metametadata commented Feb 10, 2023

@NetaNir @Styerp @TheRealAmazonKendra

The fix will try to deduplicate the messages. But another important question was not addressed. Users expect no warnings at all as was explained in, say, #9565 (comment). Is there an issue to track that problem?

@Styerp
Copy link
Contributor

Styerp commented Feb 10, 2023

In my opinion, using of this issue to track unwanted messages from the ec2 module subverts the original bug report: duplicate messages in the core module.

In the interest of not losing the "bad warnings" report, I opened #24109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment