/
machine_types.go
311 lines (274 loc) · 13.4 KB
/
machine_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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
package v3
import (
"github.com/rancher/norman/condition"
"github.com/rancher/norman/types"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type NodeTemplate struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
// Standard object’s metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec NodeTemplateSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status NodeTemplateStatus `json:"status"`
}
type NodeTemplateStatus struct {
Conditions []NodeTemplateCondition `json:"conditions"`
}
type NodeTemplateCondition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
}
type NodeTemplateSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
Driver string `json:"driver" norman:"nocreate,noupdate"`
CloudCredentialName string `json:"cloudCredentialName" norman:"type=reference[cloudCredential]"`
NodeCommonParams `json:",inline"`
}
type Node struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
// Standard object’s metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec NodeSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status NodeStatus `json:"status"`
}
type NodeStatus struct {
Conditions []NodeCondition `json:"conditions,omitempty"`
InternalNodeStatus v1.NodeStatus `json:"internalNodeStatus,omitempty"`
NodeName string `json:"nodeName,omitempty"`
Requested v1.ResourceList `json:"requested,omitempty"`
Limits v1.ResourceList `json:"limits,omitempty"`
NodeTemplateSpec *NodeTemplateSpec `json:"nodeTemplateSpec,omitempty"`
NodeConfig *RKEConfigNode `json:"rkeNode,omitempty"`
NodeAnnotations map[string]string `json:"nodeAnnotations,omitempty"`
NodeLabels map[string]string `json:"nodeLabels,omitempty"`
NodeTaints []v1.Taint `json:"nodeTaints,omitempty"`
DockerInfo *DockerInfo `json:"dockerInfo,omitempty"`
}
type DockerInfo struct {
ID string
Driver string
Debug bool
LoggingDriver string
CgroupDriver string
KernelVersion string
OperatingSystem string
OSType string
Architecture string
IndexServerAddress string
DockerRootDir string
HTTPProxy string
HTTPSProxy string
NoProxy string
Name string
Labels []string
ExperimentalBuild bool
ServerVersion string
}
var (
NodeConditionInitialized condition.Cond = "Initialized"
NodeConditionProvisioned condition.Cond = "Provisioned"
NodeConditionUpdated condition.Cond = "Updated"
NodeConditionRegistered condition.Cond = "Registered"
NodeConditionRemoved condition.Cond = "Removed"
NodeConditionConfigSaved condition.Cond = "Saved"
NodeConditionReady condition.Cond = "Ready"
NodeConditionDrained condition.Cond = "Drained"
)
type NodeCondition struct {
// Type of cluster condition.
Type condition.Cond `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
// Human-readable message indicating details about last transition
Message string `json:"message,omitempty"`
}
var (
NodePoolConditionUpdated condition.Cond = "Updated"
)
type NodePool struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
// Standard object’s metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec NodePoolSpec `json:"spec"`
Status NodePoolStatus `json:"status"`
}
type NodePoolSpec struct {
Etcd bool `json:"etcd"`
ControlPlane bool `json:"controlPlane"`
Worker bool `json:"worker"`
NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],required,notnullable"`
HostnamePrefix string `json:"hostnamePrefix" norman:"required,notnullable"`
Quantity int `json:"quantity" norman:"required,default=1"`
NodeLabels map[string]string `json:"nodeLabels"`
NodeAnnotations map[string]string `json:"nodeAnnotations"`
DisplayName string `json:"displayName"`
ClusterName string `json:"clusterName,omitempty" norman:"type=reference[cluster],noupdate,required"`
}
type NodePoolStatus struct {
Conditions []Condition `json:"conditions"`
}
type CustomConfig struct {
// IP or FQDN that is fully resolvable and used for SSH communication
Address string `yaml:"address" json:"address,omitempty"`
// Optional - Internal address that will be used for components communication
InternalAddress string `yaml:"internal_address" json:"internalAddress,omitempty"`
// SSH user that will be used by RKE
User string `yaml:"user" json:"user,omitempty"`
// Optional - Docker socket on the node that will be used in tunneling
DockerSocket string `yaml:"docker_socket" json:"dockerSocket,omitempty"`
// SSH Private Key
SSHKey string `yaml:"ssh_key" json:"sshKey,omitempty" norman:"type=password"`
// SSH Certificate
SSHCert string `yaml:"ssh_cert" json:"sshCert,omitempty"`
Label map[string]string `yaml:"label" json:"label,omitempty"`
}
type NodeSpec struct {
// Common fields. They aren't in a shared struct because the annotations are different
Etcd bool `json:"etcd" norman:"noupdate"`
ControlPlane bool `json:"controlPlane" norman:"noupdate"`
Worker bool `json:"worker" norman:"noupdate"`
NodeTemplateName string `json:"nodeTemplateName,omitempty" norman:"type=reference[nodeTemplate],noupdate"`
NodePoolName string `json:"nodePoolName" norman:"type=reference[nodePool],nocreate,noupdate"`
CustomConfig *CustomConfig `json:"customConfig"`
Imported bool `json:"imported"`
Description string `json:"description,omitempty"`
DisplayName string `json:"displayName"`
RequestedHostname string `json:"requestedHostname,omitempty" norman:"type=hostname,nullable,noupdate,required"`
InternalNodeSpec v1.NodeSpec `json:"internalNodeSpec"`
DesiredNodeLabels map[string]string `json:"desiredNodeLabels,omitempty"`
DesiredNodeAnnotations map[string]string `json:"desiredNodeAnnotations,omitempty"`
CurrentNodeLabels map[string]string `json:"currentNodeLabels,omitempty"`
CurrentNodeAnnotations map[string]string `json:"currentNodeAnnotations,omitempty"`
DesiredNodeUnschedulable string `json:"desiredNodeUnschedulable,omitempty"`
NodeDrainInput *NodeDrainInput `json:"nodeDrainInput,omitempty"`
}
type NodeCommonParams struct {
AuthCertificateAuthority string `json:"authCertificateAuthority,omitempty"`
AuthKey string `json:"authKey,omitempty"`
EngineInstallURL string `json:"engineInstallURL,omitempty"`
DockerVersion string `json:"dockerVersion,omitempty"`
EngineOpt map[string]string `json:"engineOpt,omitempty"`
EngineInsecureRegistry []string `json:"engineInsecureRegistry,omitempty"`
EngineRegistryMirror []string `json:"engineRegistryMirror,omitempty"`
EngineLabel map[string]string `json:"engineLabel,omitempty"`
EngineStorageDriver string `json:"engineStorageDriver,omitempty"`
EngineEnv map[string]string `json:"engineEnv,omitempty"`
UseInternalIPAddress bool `json:"useInternalIpAddress,omitempty" norman:"default=true,noupdate"`
}
type NodeDriver struct {
metav1.TypeMeta `json:",inline"`
// Standard object’s metadata. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Spec NodeDriverSpec `json:"spec"`
// Most recent observed status of the cluster. More info:
// https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#spec-and-status
Status NodeDriverStatus `json:"status"`
}
type NodeDriverStatus struct {
Conditions []Condition `json:"conditions"`
}
var (
NodeDriverConditionDownloaded condition.Cond = "Downloaded"
NodeDriverConditionInstalled condition.Cond = "Installed"
NodeDriverConditionActive condition.Cond = "Active"
NodeDriverConditionInactive condition.Cond = "Inactive"
)
type Condition struct {
// Type of cluster condition.
Type string `json:"type"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status"`
// The last time this condition was updated.
LastUpdateTime string `json:"lastUpdateTime,omitempty"`
// Last time the condition transitioned from one status to another.
LastTransitionTime string `json:"lastTransitionTime,omitempty"`
// The reason for the condition's last transition.
Reason string `json:"reason,omitempty"`
// Human-readable message indicating details about last transition
Message string `json:"message,omitempty"`
}
type NodeDriverSpec struct {
DisplayName string `json:"displayName"`
Description string `json:"description"`
URL string `json:"url" norman:"required"`
ExternalID string `json:"externalId"`
Builtin bool `json:"builtin"`
Active bool `json:"active"`
Checksum string `json:"checksum"`
UIURL string `json:"uiUrl"`
WhitelistDomains []string `json:"whitelistDomains,omitempty"`
}
type PublicEndpoint struct {
NodeName string `json:"nodeName,omitempty" norman:"type=reference[/v3/schemas/node],nocreate,noupdate"`
Addresses []string `json:"addresses,omitempty" norman:"nocreate,noupdate"`
Port int32 `json:"port,omitempty" norman:"nocreate,noupdate"`
Protocol string `json:"protocol,omitempty" norman:"nocreate,noupdate"`
// for node port service endpoint
ServiceName string `json:"serviceName,omitempty" norman:"type=reference[service],nocreate,noupdate"`
// for host port endpoint
PodName string `json:"podName,omitempty" norman:"type=reference[pod],nocreate,noupdate"`
// for ingress endpoint. ServiceName, podName, ingressName are mutually exclusive
IngressName string `json:"ingressName,omitempty" norman:"type=reference[ingress],nocreate,noupdate"`
// Hostname/path are set for Ingress endpoints
Hostname string `json:"hostname,omitempty" norman:"nocreate,noupdate"`
Path string `json:"path,omitempty" norman:"nocreate,noupdate"`
// True when endpoint is exposed on every node
AllNodes bool `json:"allNodes" norman:"nocreate,noupdate"`
}
type NodeDrainInput struct {
// Drain node even if there are pods not managed by a ReplicationController, Job, or DaemonSet
// Drain will not proceed without Force set to true if there are such pods
Force bool `json:"force,omitempty"`
// If there are DaemonSet-managed pods, drain will not proceed without IgnoreDaemonSets set to true
// (even when set to true, kubectl won't delete pods - so setting default to true)
IgnoreDaemonSets bool `json:"ignoreDaemonSets,omitempty" norman:"default=true"`
// Continue even if there are pods using emptyDir
DeleteLocalData bool `json:"deleteLocalData,omitempty"`
//Period of time in seconds given to each pod to terminate gracefully.
// If negative, the default value specified in the pod will be used
GracePeriod int `json:"gracePeriod,omitempty" norman:"default=-1"`
// Time to wait (in seconds) before giving up for one try
Timeout int `json:"timeout" norman:"min=1,max=10800,default=60"`
}
type CloudCredential struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec CloudCredentialSpec `json:"spec"`
}
type CloudCredentialSpec struct {
Description string `json:"description,omitempty"`
}