-
Notifications
You must be signed in to change notification settings - Fork 289
/
address.go
32 lines (26 loc) · 897 Bytes
/
address.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright Envoy Gateway Authors
// SPDX-License-Identifier: Apache-2.0
// The full text of the Apache license is available in the LICENSE file at
// the root of the repo.
package gatewayapi
import (
v1 "sigs.k8s.io/gateway-api/apis/v1"
)
var _ AddressesTranslator = (*Translator)(nil)
type AddressesTranslator interface {
ProcessAddresses(gateways []*GatewayContext, xdsIR XdsIRMap, infraIR InfraIRMap, resources *Resources)
}
func (t *Translator) ProcessAddresses(gateways []*GatewayContext, xdsIR XdsIRMap, infraIR InfraIRMap, resources *Resources) {
for _, gateway := range gateways {
// Infra IR already exist
irKey := t.getIRKey(gateway.Gateway)
gwInfraIR := infraIR[irKey]
var ipAddr []string
for _, addr := range gateway.Spec.Addresses {
if *addr.Type == v1.IPAddressType {
ipAddr = append(ipAddr, addr.Value)
}
}
gwInfraIR.Proxy.Addresses = ipAddr
}
}