Class: CDK8sPlus25::K8S::EndpointSubset

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
k8_s/endpoint_subset.rb

Overview

EndpointSubset is a group of addresses with a common set of ports.

The expanded set of endpoints is the Cartesian product of Addresses x Ports. For example, given:

{ Addresses: ["10.10.1.1", "10.10.2.2"], Ports: ["a", "port": 8675, "b", "port": 309] }

The resulting set of endpoints can be viewed as:

a: [ 10.10.1.1:8675, 10.10.2.2:8675 ], b: [ 10.10.1.1:309, 10.10.2.2:309 ]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(addresses: nil, not_ready_addresses: nil, ports: nil) ⇒ EndpointSubset

Returns a new instance of EndpointSubset.

Parameters:

  • addresses (Array<CDK8sPlus25::K8S::EndpointAddress>, nil) (defaults to: nil)

    IP addresses which offer the related ports that are marked as ready.

  • not_ready_addresses (Array<CDK8sPlus25::K8S::EndpointAddress>, nil) (defaults to: nil)

    IP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check.

  • ports (Array<CDK8sPlus25::K8S::EndpointPort>, nil) (defaults to: nil)

    Port numbers available on the related IP addresses.



22
23
24
25
26
27
28
29
# File 'k8_s/endpoint_subset.rb', line 22

def initialize(addresses: nil, not_ready_addresses: nil, ports: nil)
  @addresses = addresses.is_a?(Array) ? addresses.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::CDK8sPlus25::K8S::EndpointAddress.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : addresses
  Jsii::Type.check_type(@addresses, "eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImNkazhzLXBsdXMtMjUuazhzLkVuZHBvaW50QWRkcmVzcyJ9LCJraW5kIjoiYXJyYXkifX0=", "addresses") unless @addresses.nil?
  @not_ready_addresses = not_ready_addresses.is_a?(Array) ? not_ready_addresses.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::CDK8sPlus25::K8S::EndpointAddress.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : not_ready_addresses
  Jsii::Type.check_type(@not_ready_addresses, "eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImNkazhzLXBsdXMtMjUuazhzLkVuZHBvaW50QWRkcmVzcyJ9LCJraW5kIjoiYXJyYXkifX0=", "notReadyAddresses") unless @not_ready_addresses.nil?
  @ports = ports.is_a?(Array) ? ports.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::CDK8sPlus25::K8S::EndpointPort.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : ports
  Jsii::Type.check_type(@ports, "eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImNkazhzLXBsdXMtMjUuazhzLkVuZHBvaW50UG9ydCJ9LCJraW5kIjoiYXJyYXkifX0=", "ports") unless @ports.nil?
end

Instance Attribute Details

#addressesArray<CDK8sPlus25::K8S::EndpointAddress>? (readonly)

IP addresses which offer the related ports that are marked as ready.

These endpoints should be considered safe for load balancers and clients to utilize.

Returns:



36
37
38
# File 'k8_s/endpoint_subset.rb', line 36

def addresses
  @addresses
end

#not_ready_addressesArray<CDK8sPlus25::K8S::EndpointAddress>? (readonly)

IP addresses which offer the related ports but are not currently marked as ready because they have not yet finished starting, have recently failed a readiness check, or have recently failed a liveness check.

Returns:



40
41
42
# File 'k8_s/endpoint_subset.rb', line 40

def not_ready_addresses
  @not_ready_addresses
end

#portsArray<CDK8sPlus25::K8S::EndpointPort>? (readonly)

Port numbers available on the related IP addresses.

Returns:



44
45
46
# File 'k8_s/endpoint_subset.rb', line 44

def ports
  @ports
end

Class Method Details

.jsii_propertiesObject



46
47
48
49
50
51
52
# File 'k8_s/endpoint_subset.rb', line 46

def self.jsii_properties
  {
    :addresses => "addresses",
    :not_ready_addresses => "notReadyAddresses",
    :ports => "ports",
  }
end

Instance Method Details

#to_jsiiObject



54
55
56
57
58
59
60
61
62
# File 'k8_s/endpoint_subset.rb', line 54

def to_jsii
  result = {}
  result.merge!({
    "addresses" => @addresses,
    "notReadyAddresses" => @not_ready_addresses,
    "ports" => @ports,
  })
  result.compact
end