@@ -53,13 +53,13 @@ const (
53
53
// overrideIP indicates if the hostname is overridden by IP address, such as when
54
54
// running multi-node kubernetes using docker. In this case the user should set
55
55
// overrideIP = true in cloud config file. Default value is false.
56
- var overrideIP bool = false
56
+ var overrideIP = false
57
57
58
58
var _ cloudprovider.Interface = (* PCCloud )(nil )
59
59
var _ cloudprovider.Instances = (* PCCloud )(nil )
60
60
var _ cloudprovider.Zones = (* PCCloud )(nil )
61
61
62
- // Photon is an implementation of the cloud provider interface for Photon Controller.
62
+ // PCCloud is an implementation of the cloud provider interface for Photon Controller.
63
63
type PCCloud struct {
64
64
cfg * PCConfig
65
65
// InstanceID of the server where this PCCloud object is instantiated.
@@ -213,7 +213,7 @@ func getVMIDbyIP(pc *PCCloud, IPAddress string) (string, error) {
213
213
func getPhotonClient (pc * PCCloud ) (* photon.Client , error ) {
214
214
var err error
215
215
if len (pc .cfg .Global .CloudTarget ) == 0 {
216
- return nil , fmt .Errorf ("Photon Controller endpoint was not specified. " )
216
+ return nil , fmt .Errorf ("Photon Controller endpoint was not specified" )
217
217
}
218
218
219
219
options := & photon.ClientOptions {
@@ -241,7 +241,7 @@ func getPhotonClient(pc *PCCloud) (*photon.Client, error) {
241
241
}
242
242
password := scanner .Text ()
243
243
244
- token_options , err := pc .photonClient .Auth .GetTokensByPassword (username , password )
244
+ tokenOptions , err := pc .photonClient .Auth .GetTokensByPassword (username , password )
245
245
if err != nil {
246
246
klog .Error ("Photon Cloud Provider: failed to get tokens by password" )
247
247
return nil , err
@@ -250,7 +250,7 @@ func getPhotonClient(pc *PCCloud) (*photon.Client, error) {
250
250
options = & photon.ClientOptions {
251
251
IgnoreCertificate : true ,
252
252
TokenOptions : & photon.TokenOptions {
253
- AccessToken : token_options .AccessToken ,
253
+ AccessToken : tokenOptions .AccessToken ,
254
254
},
255
255
}
256
256
pc .photonClient = photon .NewClient (pc .cfg .Global .CloudTarget , options , pc .logger )
@@ -474,16 +474,14 @@ func (pc *PCCloud) InstanceID(ctx context.Context, nodeName k8stypes.NodeName) (
474
474
name := string (nodeName )
475
475
if name == pc .localK8sHostname {
476
476
return pc .localInstanceID , nil
477
- } else {
478
- // We assume only master need to get InstanceID of a node other than itself
479
- ID , err := getInstanceID (pc , name )
480
- if err != nil {
481
- klog .Errorf ("Photon Cloud Provider: getInstanceID failed for InstanceID. Error[%v]" , err )
482
- return ID , err
483
- } else {
484
- return ID , nil
485
- }
486
477
}
478
+ // We assume only master need to get InstanceID of a node other than itself
479
+ id , err := getInstanceID (pc , name )
480
+ if err != nil {
481
+ klog .Errorf ("Photon Cloud Provider: getInstanceID failed for InstanceID. Error[%v]" , err )
482
+ }
483
+ return id , err
484
+
487
485
}
488
486
489
487
// InstanceTypeByProviderID returns the cloudprovider instance type of the node with the specified unique providerID
@@ -544,7 +542,7 @@ func (pc *PCCloud) HasClusterID() bool {
544
542
return true
545
543
}
546
544
547
- // Attaches given virtual disk volume to the compute running kubelet.
545
+ // AttachDisk attaches given virtual disk volume to the compute running kubelet.
548
546
func (pc * PCCloud ) AttachDisk (ctx context.Context , pdID string , nodeName k8stypes.NodeName ) error {
549
547
photonClient , err := getPhotonClient (pc )
550
548
if err != nil {
@@ -712,7 +710,7 @@ func (pc *PCCloud) CreateDisk(volumeOptions *VolumeOptions) (pdID string, err er
712
710
return waitTask .Entity .ID , nil
713
711
}
714
712
715
- // Deletes a volume given volume name.
713
+ // DeleteDisk deletes a volume given volume name.
716
714
func (pc * PCCloud ) DeleteDisk (pdID string ) error {
717
715
photonClient , err := getPhotonClient (pc )
718
716
if err != nil {
0 commit comments