-
Notifications
You must be signed in to change notification settings - Fork 413
/
types.go
46 lines (37 loc) · 1.71 KB
/
types.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// -------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// --------------------------------------------------------------------------------------------
package appgw
import (
n "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-03-01/network"
"github.com/knative/pkg/apis/istio/v1alpha3"
v1 "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1"
"github.com/Azure/application-gateway-kubernetes-ingress/pkg/environment"
ptv1 "github.com/Azure/application-gateway-kubernetes-ingress/pkg/apis/azureingressprohibitedtarget/v1"
)
// ConfigBuilderContext holds the structs we have fetches from Kubernetes + environment, based on which
// we will construct App Gateway config.
type ConfigBuilderContext struct {
IngressList []*networking.Ingress
ServiceList []*v1.Service
ProhibitedTargets []*ptv1.AzureIngressProhibitedTarget
EnvVariables environment.EnvVariables
IstioGateways []*v1alpha3.Gateway
IstioVirtualServices []*v1alpha3.VirtualService
DefaultAddressPoolID *string
DefaultHTTPSettingsID *string
ExistingPortsByNumber map[Port]n.ApplicationGatewayFrontendPort
}
// InIngressList returns true if an ingress is in the ingress list
func (cbCtx *ConfigBuilderContext) InIngressList(ingress *networking.Ingress) bool {
for _, prunedIngress := range cbCtx.IngressList {
if ingress.Name == prunedIngress.Name && ingress.Namespace == prunedIngress.Namespace {
return true
}
}
return false
}
// Port is a type alias for int32, representing a port number.
type Port int32