Class PodConnections

  • All Implemented Interfaces:
    software.amazon.jsii.JsiiSerializable

    @Generated(value="jsii-pacmak/1.74.0 (build 6d08790)",
               date="2023-02-04T02:31:04.960Z")
    @Stability(Stable)
    public class PodConnections
    extends software.amazon.jsii.JsiiObject
    Controls network isolation rules for inter-pod communication.
    • Constructor Detail

      • PodConnections

        protected PodConnections​(software.amazon.jsii.JsiiObjectRef objRef)
      • PodConnections

        protected PodConnections​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      • PodConnections

        @Stability(Stable)
        public PodConnections​(@NotNull
                              AbstractPod instance)
        Parameters:
        instance - This parameter is required.
    • Method Detail

      • allowFrom

        @Stability(Stable)
        public void allowFrom​(@NotNull
                              INetworkPolicyPeer peer,
                              @Nullable
                              PodConnectionsAllowFromOptions options)
        Allow network traffic from the peer to this pod.

        By default, this will create an ingress network policy for this pod, and an egress network policy for the peer. This is required if both sides are already isolated. Use options.isolation to control this behavior.

        Example:

         // create only an egress policy that selects the 'web' pod to allow outgoing traffic
         // to the 'redis' pod. this requires the 'redis' pod to not be isolated for ingress.
         redis.connections.allowFrom(web, { isolation: Isolation.PEER })
         // create only an ingress policy that selects the 'redis' peer to allow incoming traffic
         // from the 'web' pod. this requires the 'web' pod to not be isolated for egress.
         redis.connections.allowFrom(web, { isolation: Isolation.POD })
         

        Parameters:
        peer - This parameter is required.
        options -
      • allowFrom

        @Stability(Stable)
        public void allowFrom​(@NotNull
                              INetworkPolicyPeer peer)
        Allow network traffic from the peer to this pod.

        By default, this will create an ingress network policy for this pod, and an egress network policy for the peer. This is required if both sides are already isolated. Use options.isolation to control this behavior.

        Example:

         // create only an egress policy that selects the 'web' pod to allow outgoing traffic
         // to the 'redis' pod. this requires the 'redis' pod to not be isolated for ingress.
         redis.connections.allowFrom(web, { isolation: Isolation.PEER })
         // create only an ingress policy that selects the 'redis' peer to allow incoming traffic
         // from the 'web' pod. this requires the 'web' pod to not be isolated for egress.
         redis.connections.allowFrom(web, { isolation: Isolation.POD })
         

        Parameters:
        peer - This parameter is required.
      • allowTo

        @Stability(Stable)
        public void allowTo​(@NotNull
                            INetworkPolicyPeer peer,
                            @Nullable
                            PodConnectionsAllowToOptions options)
        Allow network traffic from this pod to the peer.

        By default, this will create an egress network policy for this pod, and an ingress network policy for the peer. This is required if both sides are already isolated. Use options.isolation to control this behavior.

        Example:

         // create only an egress policy that selects the 'web' pod to allow outgoing traffic
         // to the 'redis' pod. this requires the 'redis' pod to not be isolated for ingress.
         web.connections.allowTo(redis, { isolation: Isolation.POD })
         // create only an ingress policy that selects the 'redis' peer to allow incoming traffic
         // from the 'web' pod. this requires the 'web' pod to not be isolated for egress.
         web.connections.allowTo(redis, { isolation: Isolation.PEER })
         

        Parameters:
        peer - This parameter is required.
        options -
      • allowTo

        @Stability(Stable)
        public void allowTo​(@NotNull
                            INetworkPolicyPeer peer)
        Allow network traffic from this pod to the peer.

        By default, this will create an egress network policy for this pod, and an ingress network policy for the peer. This is required if both sides are already isolated. Use options.isolation to control this behavior.

        Example:

         // create only an egress policy that selects the 'web' pod to allow outgoing traffic
         // to the 'redis' pod. this requires the 'redis' pod to not be isolated for ingress.
         web.connections.allowTo(redis, { isolation: Isolation.POD })
         // create only an ingress policy that selects the 'redis' peer to allow incoming traffic
         // from the 'web' pod. this requires the 'web' pod to not be isolated for egress.
         web.connections.allowTo(redis, { isolation: Isolation.PEER })
         

        Parameters:
        peer - This parameter is required.
      • isolate

        @Stability(Stable)
        public void isolate()
        Sets the default network policy for Pod/Workload to have all egress and ingress connections as disabled.
      • getInstance

        @Stability(Stable)
        @NotNull
        protected AbstractPod getInstance()