When using ports: [kplus.NetworkPolicyPort.allTcp(), kplus.NetworkPolicyPort.allUdp()] when rendering a NetworkPolicy, it will generate a manifest like
However, when applying this to AWS, the following error is generated
The NetworkPolicy "mynetworkpolicy" is invalid: \n* spec.egress[0].ports[0].port: Invalid value: 0: must be between 1 and 65535, inclusive\n* spec.egress[0].ports[1].port: Invalid value: 0: must be between 1 and 65535, inclusive
The NetworkPolicy "mynetworkpolicy" is invalid: \n* spec.egress[0].ports[0].port: Invalid value: 0: must be between 1 and 65535, inclusive\n* spec.egress[0].ports[1].port: Invalid value: 0: must be between 1 and 65535, inclusive
Description of the bug:
When using
ports: [kplus.NetworkPolicyPort.allTcp(), kplus.NetworkPolicyPort.allUdp()]
when rendering aNetworkPolicy
, it will generate a manifest likeHowever, when applying this to AWS, the following error is generated
The NetworkPolicy "mynetworkpolicy" is invalid: \n* spec.egress[0].ports[0].port: Invalid value: 0: must be between 1 and 65535, inclusive\n* spec.egress[0].ports[1].port: Invalid value: 0: must be between 1 and 65535, inclusive
This seems to originate from: https://github.com/cdk8s-team/cdk8s-plus/blob/k8s-29/main/src/network-policy.ts#L60
Reproduction Steps:
Error Log:
The NetworkPolicy "mynetworkpolicy" is invalid: \n* spec.egress[0].ports[0].port: Invalid value: 0: must be between 1 and 65535, inclusive\n* spec.egress[0].ports[1].port: Invalid value: 0: must be between 1 and 65535, inclusive
Environment:
Other:
We use Kubectl layer 1.29, and cluster version 1.29.
This is :bug: Bug Report