/
kubernetesNodePools.go
412 lines (354 loc) · 16.6 KB
/
kubernetesNodePools.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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package vultr
import (
"context"
"reflect"
"errors"
"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Deploy additional node pools to an existing Vultr Kubernetes Engine (VKE) cluster.
//
// ## Example Usage
//
// Create a new VKE cluster:
//
// ```go
// package main
//
// import (
//
// "github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := vultr.NewKubernetesNodePools(ctx, "np-1", &vultr.KubernetesNodePoolsArgs{
// ClusterId: pulumi.Any(vultr_kubernetes.K8.Id),
// NodeQuantity: pulumi.Int(1),
// Plan: pulumi.String("vc2-2c-4gb"),
// Label: pulumi.String("my-label"),
// Tag: pulumi.String("my-tag"),
// AutoScaler: pulumi.Bool(true),
// MinNodes: pulumi.Int(1),
// MaxNodes: pulumi.Int(2),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type KubernetesNodePools struct {
pulumi.CustomResourceState
// Enable the auto scaler for the default node pool.
AutoScaler pulumi.BoolPtrOutput `pulumi:"autoScaler"`
// The VKE cluster ID you want to attach this nodepool to.
ClusterId pulumi.StringOutput `pulumi:"clusterId"`
// Date node was created.
DateCreated pulumi.StringOutput `pulumi:"dateCreated"`
// Date of node pool updates.
DateUpdated pulumi.StringOutput `pulumi:"dateUpdated"`
// The label to be used as a prefix for nodes in this node pool.
Label pulumi.StringOutput `pulumi:"label"`
// The maximum number of nodes to use with the auto scaler.
MaxNodes pulumi.IntPtrOutput `pulumi:"maxNodes"`
// The minimum number of nodes to use with the auto scaler.
MinNodes pulumi.IntPtrOutput `pulumi:"minNodes"`
// The number of nodes in this node pool.
NodeQuantity pulumi.IntOutput `pulumi:"nodeQuantity"`
// Array that contains information about nodes within this node pool.
Nodes KubernetesNodePoolsNodeArrayOutput `pulumi:"nodes"`
// The plan to be used in this node pool. [See Plans List](https://www.vultr.com/api/#operation/list-plans) Note the minimum plan requirements must have at least 1 core and 2 gbs of memory.
Plan pulumi.StringOutput `pulumi:"plan"`
// Status of node.
Status pulumi.StringOutput `pulumi:"status"`
// A tag that is assigned to this node pool.
Tag pulumi.StringPtrOutput `pulumi:"tag"`
}
// NewKubernetesNodePools registers a new resource with the given unique name, arguments, and options.
func NewKubernetesNodePools(ctx *pulumi.Context,
name string, args *KubernetesNodePoolsArgs, opts ...pulumi.ResourceOption) (*KubernetesNodePools, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ClusterId == nil {
return nil, errors.New("invalid value for required argument 'ClusterId'")
}
if args.Label == nil {
return nil, errors.New("invalid value for required argument 'Label'")
}
if args.NodeQuantity == nil {
return nil, errors.New("invalid value for required argument 'NodeQuantity'")
}
if args.Plan == nil {
return nil, errors.New("invalid value for required argument 'Plan'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource KubernetesNodePools
err := ctx.RegisterResource("vultr:index/kubernetesNodePools:KubernetesNodePools", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetKubernetesNodePools gets an existing KubernetesNodePools resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetKubernetesNodePools(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *KubernetesNodePoolsState, opts ...pulumi.ResourceOption) (*KubernetesNodePools, error) {
var resource KubernetesNodePools
err := ctx.ReadResource("vultr:index/kubernetesNodePools:KubernetesNodePools", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering KubernetesNodePools resources.
type kubernetesNodePoolsState struct {
// Enable the auto scaler for the default node pool.
AutoScaler *bool `pulumi:"autoScaler"`
// The VKE cluster ID you want to attach this nodepool to.
ClusterId *string `pulumi:"clusterId"`
// Date node was created.
DateCreated *string `pulumi:"dateCreated"`
// Date of node pool updates.
DateUpdated *string `pulumi:"dateUpdated"`
// The label to be used as a prefix for nodes in this node pool.
Label *string `pulumi:"label"`
// The maximum number of nodes to use with the auto scaler.
MaxNodes *int `pulumi:"maxNodes"`
// The minimum number of nodes to use with the auto scaler.
MinNodes *int `pulumi:"minNodes"`
// The number of nodes in this node pool.
NodeQuantity *int `pulumi:"nodeQuantity"`
// Array that contains information about nodes within this node pool.
Nodes []KubernetesNodePoolsNode `pulumi:"nodes"`
// The plan to be used in this node pool. [See Plans List](https://www.vultr.com/api/#operation/list-plans) Note the minimum plan requirements must have at least 1 core and 2 gbs of memory.
Plan *string `pulumi:"plan"`
// Status of node.
Status *string `pulumi:"status"`
// A tag that is assigned to this node pool.
Tag *string `pulumi:"tag"`
}
type KubernetesNodePoolsState struct {
// Enable the auto scaler for the default node pool.
AutoScaler pulumi.BoolPtrInput
// The VKE cluster ID you want to attach this nodepool to.
ClusterId pulumi.StringPtrInput
// Date node was created.
DateCreated pulumi.StringPtrInput
// Date of node pool updates.
DateUpdated pulumi.StringPtrInput
// The label to be used as a prefix for nodes in this node pool.
Label pulumi.StringPtrInput
// The maximum number of nodes to use with the auto scaler.
MaxNodes pulumi.IntPtrInput
// The minimum number of nodes to use with the auto scaler.
MinNodes pulumi.IntPtrInput
// The number of nodes in this node pool.
NodeQuantity pulumi.IntPtrInput
// Array that contains information about nodes within this node pool.
Nodes KubernetesNodePoolsNodeArrayInput
// The plan to be used in this node pool. [See Plans List](https://www.vultr.com/api/#operation/list-plans) Note the minimum plan requirements must have at least 1 core and 2 gbs of memory.
Plan pulumi.StringPtrInput
// Status of node.
Status pulumi.StringPtrInput
// A tag that is assigned to this node pool.
Tag pulumi.StringPtrInput
}
func (KubernetesNodePoolsState) ElementType() reflect.Type {
return reflect.TypeOf((*kubernetesNodePoolsState)(nil)).Elem()
}
type kubernetesNodePoolsArgs struct {
// Enable the auto scaler for the default node pool.
AutoScaler *bool `pulumi:"autoScaler"`
// The VKE cluster ID you want to attach this nodepool to.
ClusterId string `pulumi:"clusterId"`
// The label to be used as a prefix for nodes in this node pool.
Label string `pulumi:"label"`
// The maximum number of nodes to use with the auto scaler.
MaxNodes *int `pulumi:"maxNodes"`
// The minimum number of nodes to use with the auto scaler.
MinNodes *int `pulumi:"minNodes"`
// The number of nodes in this node pool.
NodeQuantity int `pulumi:"nodeQuantity"`
// The plan to be used in this node pool. [See Plans List](https://www.vultr.com/api/#operation/list-plans) Note the minimum plan requirements must have at least 1 core and 2 gbs of memory.
Plan string `pulumi:"plan"`
// A tag that is assigned to this node pool.
Tag *string `pulumi:"tag"`
}
// The set of arguments for constructing a KubernetesNodePools resource.
type KubernetesNodePoolsArgs struct {
// Enable the auto scaler for the default node pool.
AutoScaler pulumi.BoolPtrInput
// The VKE cluster ID you want to attach this nodepool to.
ClusterId pulumi.StringInput
// The label to be used as a prefix for nodes in this node pool.
Label pulumi.StringInput
// The maximum number of nodes to use with the auto scaler.
MaxNodes pulumi.IntPtrInput
// The minimum number of nodes to use with the auto scaler.
MinNodes pulumi.IntPtrInput
// The number of nodes in this node pool.
NodeQuantity pulumi.IntInput
// The plan to be used in this node pool. [See Plans List](https://www.vultr.com/api/#operation/list-plans) Note the minimum plan requirements must have at least 1 core and 2 gbs of memory.
Plan pulumi.StringInput
// A tag that is assigned to this node pool.
Tag pulumi.StringPtrInput
}
func (KubernetesNodePoolsArgs) ElementType() reflect.Type {
return reflect.TypeOf((*kubernetesNodePoolsArgs)(nil)).Elem()
}
type KubernetesNodePoolsInput interface {
pulumi.Input
ToKubernetesNodePoolsOutput() KubernetesNodePoolsOutput
ToKubernetesNodePoolsOutputWithContext(ctx context.Context) KubernetesNodePoolsOutput
}
func (*KubernetesNodePools) ElementType() reflect.Type {
return reflect.TypeOf((**KubernetesNodePools)(nil)).Elem()
}
func (i *KubernetesNodePools) ToKubernetesNodePoolsOutput() KubernetesNodePoolsOutput {
return i.ToKubernetesNodePoolsOutputWithContext(context.Background())
}
func (i *KubernetesNodePools) ToKubernetesNodePoolsOutputWithContext(ctx context.Context) KubernetesNodePoolsOutput {
return pulumi.ToOutputWithContext(ctx, i).(KubernetesNodePoolsOutput)
}
// KubernetesNodePoolsArrayInput is an input type that accepts KubernetesNodePoolsArray and KubernetesNodePoolsArrayOutput values.
// You can construct a concrete instance of `KubernetesNodePoolsArrayInput` via:
//
// KubernetesNodePoolsArray{ KubernetesNodePoolsArgs{...} }
type KubernetesNodePoolsArrayInput interface {
pulumi.Input
ToKubernetesNodePoolsArrayOutput() KubernetesNodePoolsArrayOutput
ToKubernetesNodePoolsArrayOutputWithContext(context.Context) KubernetesNodePoolsArrayOutput
}
type KubernetesNodePoolsArray []KubernetesNodePoolsInput
func (KubernetesNodePoolsArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*KubernetesNodePools)(nil)).Elem()
}
func (i KubernetesNodePoolsArray) ToKubernetesNodePoolsArrayOutput() KubernetesNodePoolsArrayOutput {
return i.ToKubernetesNodePoolsArrayOutputWithContext(context.Background())
}
func (i KubernetesNodePoolsArray) ToKubernetesNodePoolsArrayOutputWithContext(ctx context.Context) KubernetesNodePoolsArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(KubernetesNodePoolsArrayOutput)
}
// KubernetesNodePoolsMapInput is an input type that accepts KubernetesNodePoolsMap and KubernetesNodePoolsMapOutput values.
// You can construct a concrete instance of `KubernetesNodePoolsMapInput` via:
//
// KubernetesNodePoolsMap{ "key": KubernetesNodePoolsArgs{...} }
type KubernetesNodePoolsMapInput interface {
pulumi.Input
ToKubernetesNodePoolsMapOutput() KubernetesNodePoolsMapOutput
ToKubernetesNodePoolsMapOutputWithContext(context.Context) KubernetesNodePoolsMapOutput
}
type KubernetesNodePoolsMap map[string]KubernetesNodePoolsInput
func (KubernetesNodePoolsMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*KubernetesNodePools)(nil)).Elem()
}
func (i KubernetesNodePoolsMap) ToKubernetesNodePoolsMapOutput() KubernetesNodePoolsMapOutput {
return i.ToKubernetesNodePoolsMapOutputWithContext(context.Background())
}
func (i KubernetesNodePoolsMap) ToKubernetesNodePoolsMapOutputWithContext(ctx context.Context) KubernetesNodePoolsMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(KubernetesNodePoolsMapOutput)
}
type KubernetesNodePoolsOutput struct{ *pulumi.OutputState }
func (KubernetesNodePoolsOutput) ElementType() reflect.Type {
return reflect.TypeOf((**KubernetesNodePools)(nil)).Elem()
}
func (o KubernetesNodePoolsOutput) ToKubernetesNodePoolsOutput() KubernetesNodePoolsOutput {
return o
}
func (o KubernetesNodePoolsOutput) ToKubernetesNodePoolsOutputWithContext(ctx context.Context) KubernetesNodePoolsOutput {
return o
}
// Enable the auto scaler for the default node pool.
func (o KubernetesNodePoolsOutput) AutoScaler() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.BoolPtrOutput { return v.AutoScaler }).(pulumi.BoolPtrOutput)
}
// The VKE cluster ID you want to attach this nodepool to.
func (o KubernetesNodePoolsOutput) ClusterId() pulumi.StringOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.StringOutput { return v.ClusterId }).(pulumi.StringOutput)
}
// Date node was created.
func (o KubernetesNodePoolsOutput) DateCreated() pulumi.StringOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.StringOutput { return v.DateCreated }).(pulumi.StringOutput)
}
// Date of node pool updates.
func (o KubernetesNodePoolsOutput) DateUpdated() pulumi.StringOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.StringOutput { return v.DateUpdated }).(pulumi.StringOutput)
}
// The label to be used as a prefix for nodes in this node pool.
func (o KubernetesNodePoolsOutput) Label() pulumi.StringOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.StringOutput { return v.Label }).(pulumi.StringOutput)
}
// The maximum number of nodes to use with the auto scaler.
func (o KubernetesNodePoolsOutput) MaxNodes() pulumi.IntPtrOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.IntPtrOutput { return v.MaxNodes }).(pulumi.IntPtrOutput)
}
// The minimum number of nodes to use with the auto scaler.
func (o KubernetesNodePoolsOutput) MinNodes() pulumi.IntPtrOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.IntPtrOutput { return v.MinNodes }).(pulumi.IntPtrOutput)
}
// The number of nodes in this node pool.
func (o KubernetesNodePoolsOutput) NodeQuantity() pulumi.IntOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.IntOutput { return v.NodeQuantity }).(pulumi.IntOutput)
}
// Array that contains information about nodes within this node pool.
func (o KubernetesNodePoolsOutput) Nodes() KubernetesNodePoolsNodeArrayOutput {
return o.ApplyT(func(v *KubernetesNodePools) KubernetesNodePoolsNodeArrayOutput { return v.Nodes }).(KubernetesNodePoolsNodeArrayOutput)
}
// The plan to be used in this node pool. [See Plans List](https://www.vultr.com/api/#operation/list-plans) Note the minimum plan requirements must have at least 1 core and 2 gbs of memory.
func (o KubernetesNodePoolsOutput) Plan() pulumi.StringOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.StringOutput { return v.Plan }).(pulumi.StringOutput)
}
// Status of node.
func (o KubernetesNodePoolsOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// A tag that is assigned to this node pool.
func (o KubernetesNodePoolsOutput) Tag() pulumi.StringPtrOutput {
return o.ApplyT(func(v *KubernetesNodePools) pulumi.StringPtrOutput { return v.Tag }).(pulumi.StringPtrOutput)
}
type KubernetesNodePoolsArrayOutput struct{ *pulumi.OutputState }
func (KubernetesNodePoolsArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*KubernetesNodePools)(nil)).Elem()
}
func (o KubernetesNodePoolsArrayOutput) ToKubernetesNodePoolsArrayOutput() KubernetesNodePoolsArrayOutput {
return o
}
func (o KubernetesNodePoolsArrayOutput) ToKubernetesNodePoolsArrayOutputWithContext(ctx context.Context) KubernetesNodePoolsArrayOutput {
return o
}
func (o KubernetesNodePoolsArrayOutput) Index(i pulumi.IntInput) KubernetesNodePoolsOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *KubernetesNodePools {
return vs[0].([]*KubernetesNodePools)[vs[1].(int)]
}).(KubernetesNodePoolsOutput)
}
type KubernetesNodePoolsMapOutput struct{ *pulumi.OutputState }
func (KubernetesNodePoolsMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*KubernetesNodePools)(nil)).Elem()
}
func (o KubernetesNodePoolsMapOutput) ToKubernetesNodePoolsMapOutput() KubernetesNodePoolsMapOutput {
return o
}
func (o KubernetesNodePoolsMapOutput) ToKubernetesNodePoolsMapOutputWithContext(ctx context.Context) KubernetesNodePoolsMapOutput {
return o
}
func (o KubernetesNodePoolsMapOutput) MapIndex(k pulumi.StringInput) KubernetesNodePoolsOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *KubernetesNodePools {
return vs[0].(map[string]*KubernetesNodePools)[vs[1].(string)]
}).(KubernetesNodePoolsOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*KubernetesNodePoolsInput)(nil)).Elem(), &KubernetesNodePools{})
pulumi.RegisterInputType(reflect.TypeOf((*KubernetesNodePoolsArrayInput)(nil)).Elem(), KubernetesNodePoolsArray{})
pulumi.RegisterInputType(reflect.TypeOf((*KubernetesNodePoolsMapInput)(nil)).Elem(), KubernetesNodePoolsMap{})
pulumi.RegisterOutputType(KubernetesNodePoolsOutput{})
pulumi.RegisterOutputType(KubernetesNodePoolsArrayOutput{})
pulumi.RegisterOutputType(KubernetesNodePoolsMapOutput{})
}