@@ -49,8 +49,11 @@ type Interface interface {
49
49
LoadBalancer () (LoadBalancer , bool )
50
50
// Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.
51
51
Instances () (Instances , bool )
52
- // InstancesV2 is an implementation for instances only used by cloud node-controller now.
52
+ // InstancesV2 is an implementation for instances and should only be implemented by external cloud providers.
53
+ // Implementing InstancesV2 is behaviorally identical to Instances but is optimized to significantly reduce
54
+ // API calls to the cloud provider when registering and syncing nodes.
53
55
// Also returns true if the interface is supported, false otherwise.
56
+ // WARNING: InstancesV2 is an experimental interface and is subject to change in v1.20.
54
57
InstancesV2 () (InstancesV2 , bool )
55
58
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
56
59
Zones () (Zones , bool )
@@ -189,15 +192,20 @@ type Instances interface {
189
192
InstanceShutdownByProviderID (ctx context.Context , providerID string ) (bool , error )
190
193
}
191
194
192
- // InstancesV2 is an abstract, pluggable interface for sets of instances.
193
- // Unlike Instances, it is only used by cloud node-controller now.
195
+ // InstancesV2 is an abstract, pluggable interface for cloud provider instances.
196
+ // Unlike the Instances interface, it is designed for external cloud providers and should only be used by them.
197
+ // WARNING: InstancesV2 is an experimental interface and is subject to change in v1.20.
194
198
type InstancesV2 interface {
195
- // InstanceExistsByProviderID returns true if the instance for the given provider exists.
196
- InstanceExistsByProviderID (ctx context.Context , providerID string ) (bool , error )
197
- // InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider.
198
- InstanceShutdownByProviderID (ctx context.Context , providerID string ) (bool , error )
199
- // InstanceMetadataByProviderID returns the instance's metadata.
200
- InstanceMetadataByProviderID (ctx context.Context , providerID string ) (* InstanceMetadata , error )
199
+ // InstanceExists returns true if the instance for the given node exists according to the cloud provider.
200
+ // Use the node.name or node.spec.providerID field to find the node in the cloud provider.
201
+ InstanceExists (ctx context.Context , node * v1.Node ) (bool , error )
202
+ // InstanceShutdown returns true if the instance is shutdown according to the cloud provider.
203
+ // Use the node.name or node.spec.providerID field to find the node in the cloud provider.
204
+ InstanceShutdown (ctx context.Context , node * v1.Node ) (bool , error )
205
+ // InstanceMetadata returns the instance's metadata. The values returned in InstanceMetadata are
206
+ // translated into specific fields in the Node object on registration.
207
+ // Use the node.name or node.spec.providerID field to find the node in the cloud provider.
208
+ InstanceMetadata (ctx context.Context , node * v1.Node ) (* InstanceMetadata , error )
201
209
}
202
210
203
211
// Route is a representation of an advanced routing rule.
@@ -265,12 +273,25 @@ type PVLabeler interface {
265
273
GetLabelsForVolume (ctx context.Context , pv * v1.PersistentVolume ) (map [string ]string , error )
266
274
}
267
275
268
- // InstanceMetadata contains metadata about the specific instance.
276
+ // InstanceMetadata contains metadata about a specific instance.
277
+ // Values returned in InstanceMetadata are translated into specific fields in Node.
269
278
type InstanceMetadata struct {
270
- // ProviderID is provider's id that instance belongs to.
279
+ // ProviderID is a unique ID used to idenfitify an instance on the cloud provider.
280
+ // The ProviderID set here will be set on the node's spec.providerID field.
281
+ // The provider ID format can be set by the cloud provider but providers should
282
+ // ensure the format does not change in any incompatible way.
283
+ //
284
+ // The provider ID format used by existing cloud provider has been:
285
+ // <provider-name>://<instance-id>
286
+ // Existing providers setting this field should preserve the existing format
287
+ // currently being set in node.spec.providerID.
271
288
ProviderID string
272
- // Type is instance's type.
273
- Type string
289
+ // InstanceType is the instance's type.
290
+ // The InstanceType set here will be set using the following labels on the node object:
291
+ // * node.kubernetes.io/instance-type=<instance-type>
292
+ // * beta.kubernetes.io/instance-type=<instance-type> (DEPRECATED)
293
+ InstanceType string
274
294
// NodeAddress contains information for the instance's address.
295
+ // The node addresses returned here will be set on the node's status.addresses field.
275
296
NodeAddresses []v1.NodeAddress
276
297
}
0 commit comments