forked from Azure/azure-container-networking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NetworkContainerContract.go
178 lines (152 loc) · 5.61 KB
/
NetworkContainerContract.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package cns
import "encoding/json"
// Container Network Service DNC Contract
const (
SetOrchestratorType = "/network/setorchestratortype"
CreateOrUpdateNetworkContainer = "/network/createorupdatenetworkcontainer"
DeleteNetworkContainer = "/network/deletenetworkcontainer"
GetNetworkContainerStatus = "/network/getnetworkcontainerstatus"
GetInterfaceForContainer = "/network/getinterfaceforcontainer"
GetNetworkContainerByOrchestratorContext = "/network/getnetworkcontainerbyorchestratorcontext"
AttachContainerToNetwork = "/network/attachcontainertonetwork"
DetachContainerFromNetwork = "/network/detachcontainerfromnetwork"
)
// NetworkContainer Prefixes
const (
SwiftPrefix = "Swift_"
)
// NetworkContainer Types
const (
AzureContainerInstance = "AzureContainerInstance"
WebApps = "WebApps"
ClearContainer = "ClearContainer"
Docker = "Docker"
Basic = "Basic"
)
// Orchestrator Types
const (
Kubernetes = "Kubernetes"
ServiceFabric = "ServiceFabric"
Batch = "Batch"
DBforPostgreSQL = "DBforPostgreSQL"
AzureFirstParty = "AzureFirstParty"
)
// Encap Types
const (
Vlan = "Vlan"
Vxlan = "Vxlan"
)
// CreateNetworkContainerRequest specifies request to create a network container or network isolation boundary.
type CreateNetworkContainerRequest struct {
Version string
NetworkContainerType string
NetworkContainerid string // Mandatory input.
PrimaryInterfaceIdentifier string // Primary CA.
AuthorizationToken string
LocalIPConfiguration IPConfiguration
OrchestratorContext json.RawMessage
IPConfiguration IPConfiguration
MultiTenancyInfo MultiTenancyInfo
CnetAddressSpace []IPSubnet // To setup SNAT (should include service endpoint vips).
Routes []Route
}
// ConfigureContainerNetworkingRequest - specifies request to attach/detach container to network.
type ConfigureContainerNetworkingRequest struct {
Containerid string
NetworkContainerid string
}
// KubernetesPodInfo is an OrchestratorContext that holds PodName and PodNamespace.
type KubernetesPodInfo struct {
PodName string
PodNamespace string
}
// MultiTenancyInfo contains encap type and id.
type MultiTenancyInfo struct {
EncapType string
ID int // This can be vlanid, vxlanid, gre-key etc. (depends on EnacapType).
}
// IPConfiguration contains details about ip config to provision in the VM.
type IPConfiguration struct {
IPSubnet IPSubnet
DNSServers []string
GatewayIPAddress string
}
// IPSubnet contains ip subnet.
type IPSubnet struct {
IPAddress string
PrefixLength uint8
}
// Route describes an entry in routing table.
type Route struct {
IPAddress string
GatewayIPAddress string
InterfaceToUse string
}
// SetOrchestratorTypeRequest specifies the orchestrator type for the node.
type SetOrchestratorTypeRequest struct {
OrchestratorType string
DncPartitionKey string
}
// CreateNetworkContainerResponse specifies response of creating a network container.
type CreateNetworkContainerResponse struct {
Response Response
}
// GetNetworkContainerStatusRequest specifies the details about the request to retrieve status of a specifc network container.
type GetNetworkContainerStatusRequest struct {
NetworkContainerid string
}
// GetNetworkContainerStatusResponse specifies response of retriving a network container status.
type GetNetworkContainerStatusResponse struct {
NetworkContainerid string
Version string
AzureHostVersion string
Response Response
}
// GetNetworkContainerRequest specifies the details about the request to retrieve a specifc network container.
type GetNetworkContainerRequest struct {
NetworkContainerid string
OrchestratorContext json.RawMessage
}
// GetNetworkContainerResponse describes the response to retrieve a specifc network container.
type GetNetworkContainerResponse struct {
IPConfiguration IPConfiguration
Routes []Route
CnetAddressSpace []IPSubnet
MultiTenancyInfo MultiTenancyInfo
PrimaryInterfaceIdentifier string
LocalIPConfiguration IPConfiguration
Response Response
}
// DeleteNetworkContainerRequest specifies the details about the request to delete a specifc network container.
type DeleteNetworkContainerRequest struct {
NetworkContainerid string
}
// DeleteNetworkContainerResponse describes the response to delete a specifc network container.
type DeleteNetworkContainerResponse struct {
Response Response
}
// GetInterfaceForContainerRequest specifies the container ID for which interface needs to be identified.
type GetInterfaceForContainerRequest struct {
NetworkContainerID string
}
// GetInterfaceForContainerResponse specifies the interface for a given container ID.
type GetInterfaceForContainerResponse struct {
NetworkContainerVersion string
NetworkInterface NetworkInterface
CnetAddressSpace []IPSubnet
DNSServers []string
Response Response
}
// AttachContainerToNetworkResponse specifies response of attaching network container to network.
type AttachContainerToNetworkResponse struct {
Response Response
}
// DetachNetworkContainerToNetworkResponse specifies response of detaching network container from network.
type DetachContainerFromNetworkResponse struct {
Response Response
}
// NetworkInterface specifies the information that can be used to unquely identify an interface.
type NetworkInterface struct {
Name string
IPAddress string
}