Skip to content

Commit 7042f72

Browse files
chore(code formatting): format the code with 1.19 version
Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>
1 parent d1f9d76 commit 7042f72

File tree

13 files changed

+189
-160
lines changed

13 files changed

+189
-160
lines changed

.github/workflows/release-charts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
git config user.name "$GITHUB_ACTOR"
2222
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2323
24-
- name: Install Helm
24+
- name: Install Helm
2525
uses: azure/setup-helm@v3
2626
with:
2727
version: v3.12.1

pkg/kubernetes/api/apps/v1/deployment/deployment.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func (b *Builder) WithReplicas(replicas *int32) *Builder {
307307
return b
308308
}
309309

310-
//WithStrategyType sets the strategy field of the deployment
310+
// WithStrategyType sets the strategy field of the deployment
311311
func (b *Builder) WithStrategyType(
312312
strategytype appsv1.DeploymentStrategyType,
313313
) *Builder {
@@ -323,7 +323,7 @@ func (b *Builder) WithStrategyType(
323323
return b
324324
}
325325

326-
//WithStrategyTypeRecreate sets the strategy field of the deployment as Recreate
326+
// WithStrategyTypeRecreate sets the strategy field of the deployment as Recreate
327327
func (b *Builder) WithStrategyTypeRecreate() *Builder {
328328
return b.WithStrategyType(appsv1.RecreateDeploymentStrategyType)
329329
}
@@ -519,7 +519,7 @@ func (d *Deploy) IsTerminationInProgress() bool {
519519

520520
// IsUpdateInProgress Checks if all the replicas are updated or not.
521521
// If Status.AvailableReplicas < Status.UpdatedReplicas then all the
522-
//older replicas are not there but there are less number of availableReplicas
522+
// older replicas are not there but there are less number of availableReplicas
523523
func IsUpdateInProgress() Predicate {
524524
return func(d *Deploy) bool {
525525
return d.IsUpdateInProgress()

pkg/kubernetes/api/core/v1/persistentvolume/persistentvolume.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ func (p *PV) GetPath() string {
9191
// This method expects only a single hostname to be set.
9292
//
9393
// The PV object will have the node's hostname specified as follows:
94-
// nodeAffinity:
95-
// required:
96-
// nodeSelectorTerms:
97-
// - matchExpressions:
98-
// - key: kubernetes.io/hostname
99-
// operator: In
100-
// values:
101-
// - hostname
10294
//
95+
// nodeAffinity:
96+
// required:
97+
// nodeSelectorTerms:
98+
// - matchExpressions:
99+
// - key: kubernetes.io/hostname
100+
// operator: In
101+
// values:
102+
// - hostname
103103
func (p *PV) GetAffinitedNodeHostname() string {
104104
nodeAffinity := p.object.Spec.NodeAffinity
105105
if nodeAffinity == nil {

pkg/kubernetes/api/core/v1/podtemplatespec/podtemplatespec.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func (b *Builder) WithNodeSelectorNew(nodeselectors map[string]string) *Builder
225225
return b
226226
}
227227

228-
//WithNodeSelectorByValue overrides the NodeSelector with new values
228+
// WithNodeSelectorByValue overrides the NodeSelector with new values
229229
func (b *Builder) WithNodeSelectorByValue(nodeselectors map[string]string) *Builder {
230230
// copy of original map
231231
newnodeselectors := map[string]string{}
@@ -290,9 +290,12 @@ func (b *Builder) WithAffinity(affinity *corev1.Affinity) *Builder {
290290
// WithNodeAffinityMatchExpressions sets matchexpressions under
291291
// nodeAffinity
292292
// NOTE: If nil is passed then match expressions will not be
293-
// propogated to node affinity.
293+
//
294+
// propogated to node affinity.
295+
//
294296
// CAUTION: Don't invoke WithAffinity func after calling this function
295-
// It will overwrite MatchExpression
297+
//
298+
// It will overwrite MatchExpression
296299
func (b *Builder) WithNodeAffinityMatchExpressions(
297300
mExpressions []corev1.NodeSelectorRequirement) *Builder {
298301
if len(mExpressions) == 0 {

pkg/kubernetes/api/core/v1/volume/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (b *Builder) WithHostDirectory(path string) *Builder {
6565
return b
6666
}
6767

68-
//WithSecret sets the VolumeSource field of Volume with provided Secret
68+
// WithSecret sets the VolumeSource field of Volume with provided Secret
6969
func (b *Builder) WithSecret(secret *corev1.Secret, defaultMode int32) *Builder {
7070
dM := defaultMode
7171
if secret == nil {
@@ -92,7 +92,7 @@ func (b *Builder) WithSecret(secret *corev1.Secret, defaultMode int32) *Builder
9292
return b
9393
}
9494

95-
//WithConfigMap sets the VolumeSource field of Volume with provided ConfigMap
95+
// WithConfigMap sets the VolumeSource field of Volume with provided ConfigMap
9696
func (b *Builder) WithConfigMap(configMap *corev1.ConfigMap, defaultMode int32) *Builder {
9797
dM := defaultMode
9898
if configMap == nil {

pkg/kubernetes/client/client.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,45 +42,51 @@ const (
4242
// to abstract getting kubernetes incluster config
4343
//
4444
// NOTE:
45-
// typed function makes it simple to mock
45+
//
46+
// typed function makes it simple to mock
4647
type getInClusterConfigFn func() (*rest.Config, error)
4748

4849
// buildConfigFromFlagsFn is a typed function
4950
// to abstract getting a kubernetes config from
5051
// provided flags
5152
//
5253
// NOTE:
53-
// typed function makes it simple to mock
54+
//
55+
// typed function makes it simple to mock
5456
type buildConfigFromFlagsFn func(string, string) (*rest.Config, error)
5557

5658
// getKubeMasterIPFromENVFn is a typed function
5759
// to abstract getting kubernetes master IP
5860
// address from environment variable
5961
//
6062
// NOTE:
61-
// typed function makes it simple to mock
63+
//
64+
// typed function makes it simple to mock
6265
type getKubeMasterIPFromENVFn func(env.ENVKey) string
6366

6467
// getKubeConfigPathFromENVFn is a typed function to
6568
// abstract getting kubernetes config path from
6669
// environment variable
6770
//
6871
// NOTE:
69-
// typed function makes it simple to mock
72+
//
73+
// typed function makes it simple to mock
7074
type getKubeConfigPathFromENVFn func(env.ENVKey) string
7175

7276
// getKubeDynamicClientFn is a typed function to
7377
// abstract getting dynamic kubernetes clientset
7478
//
7579
// NOTE:
76-
// typed function makes it simple to mock
80+
//
81+
// typed function makes it simple to mock
7782
type getKubeDynamicClientFn func(*rest.Config) (dynamic.Interface, error)
7883

7984
// getKubeClientsetFn is a typed function
8085
// to abstract getting kubernetes clientset
8186
//
8287
// NOTE:
83-
// typed function makes it simple to mock
88+
//
89+
// typed function makes it simple to mock
8490
type getKubeClientsetFn func(*rest.Config) (*kubernetes.Clientset, error)
8591

8692
// Client provides Kubernetes client operations
@@ -119,7 +125,9 @@ type Client struct {
119125
// instance
120126
//
121127
// NOTE:
122-
// This is the basic building block to create
128+
//
129+
// This is the basic building block to create
130+
//
123131
// functional operations against the client
124132
// instance
125133
type OptionFn func(*Client)

provisioner/config.go

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const (
107107
betaStorageClassAnnotation = "volume.beta.kubernetes.io/storage-class"
108108
)
109109

110-
//GetVolumeConfig creates a new VolumeConfig struct by
110+
// GetVolumeConfig creates a new VolumeConfig struct by
111111
// parsing and merging the configuration provided in the PVC
112112
// annotation - cas.openebs.io/config with the
113113
// default configuration of the provisioner.
@@ -177,7 +177,7 @@ func (p *Provisioner) GetVolumeConfig(pvName string, pvc *v1.PersistentVolumeCla
177177
return c, nil
178178
}
179179

180-
//GetNFSServerTypeFromConfig returns the NFSServerType value configured
180+
// GetNFSServerTypeFromConfig returns the NFSServerType value configured
181181
// in StorageClass. Default is kernel
182182
func (c *VolumeConfig) GetNFSServerTypeFromConfig() string {
183183
serverType := c.getValue(KeyPVNFSServerType)
@@ -187,7 +187,7 @@ func (c *VolumeConfig) GetNFSServerTypeFromConfig() string {
187187
return serverType
188188
}
189189

190-
//GetBackendStorageClassFromConfig returns the Storage Class
190+
// GetBackendStorageClassFromConfig returns the Storage Class
191191
// value configured in StorageClass. Default is ""
192192
func (c *VolumeConfig) GetBackendStorageClassFromConfig() string {
193193
backingSC := c.getValue(KeyPVBackendStorageClass)
@@ -241,14 +241,16 @@ func (c *VolumeConfig) GetNFServerGraceTime() (int, error) {
241241
// StorageClass if specified
242242
// -----------------------------------------------------
243243
// NOTE: This feature has been deprecated
244-
// Alternative: Use FilePermission 'cas.openebs.io/config' annotation
245-
// key on the backend volume PVC. Sample FilePermissions
246-
// for FSGID-like configuration --
247244
//
248-
// name: FilePermissions
249-
// data:
250-
// GID: <group-ID>
251-
// mode: "g+s"
245+
// Alternative: Use FilePermission 'cas.openebs.io/config' annotation
246+
// key on the backend volume PVC. Sample FilePermissions
247+
// for FSGID-like configuration --
248+
//
249+
// name: FilePermissions
250+
// data:
251+
// GID: <group-ID>
252+
// mode: "g+s"
253+
//
252254
// -----------------------------------------------------
253255
func (c *VolumeConfig) GetFSGroupID() (*int64, error) {
254256
fsGroupIDStr := c.getValue(FSGroupID)
@@ -371,18 +373,21 @@ func (c *VolumeConfig) getResourceList(key string) (v1.ResourceList, error) {
371373
return resourceList, nil
372374
}
373375

374-
//getValue is a utility function to extract the value
376+
// getValue is a utility function to extract the value
375377
// of the `key` from the ConfigMap object - which is
376378
// map[string]interface{map[string][string]}
377379
// Example:
378-
// {
379-
// key1: {
380-
// value: value1
381-
// enabled: true
382-
// }
383-
// }
380+
//
381+
// {
382+
// key1: {
383+
// value: value1
384+
// enabled: true
385+
// }
386+
// }
387+
//
384388
// In the above example, if `key1` is passed as input,
385-
// `value1` will be returned.
389+
//
390+
// `value1` will be returned.
386391
func (c *VolumeConfig) getValue(key string) string {
387392
if configObj, ok := util.GetNestedField(c.options, key).(map[string]string); ok {
388393
if val, p := configObj[string(mconfig.ValuePTP)]; p {
@@ -392,20 +397,23 @@ func (c *VolumeConfig) getValue(key string) string {
392397
return ""
393398
}
394399

395-
//getData is a utility function to extract the value
400+
// getData is a utility function to extract the value
396401
// of the `key` from the ConfigMap object - which is
397402
// map[string]interface{map[string]interface{map[string]string}}
398403
// Example:
399-
// {
400-
// key1: {
401-
// value: value1
402-
// data: {
403-
// dataKey1: dataValue1
404-
// }
405-
// }
406-
// }
404+
//
405+
// {
406+
// key1: {
407+
// value: value1
408+
// data: {
409+
// dataKey1: dataValue1
410+
// }
411+
// }
412+
// }
413+
//
407414
// In the above example, if `key1` and `dataKey1` are passed as input,
408-
// `dataValue1` will be returned.
415+
//
416+
// `dataValue1` will be returned.
409417
func (c *VolumeConfig) getData(key string, dataKey string) string {
410418
if configData, ok := util.GetNestedField(c.configData, key).(map[string]string); ok {
411419
if val, p := configData[dataKey]; p {
@@ -449,11 +457,11 @@ func hookConfigFileExist() (bool, error) {
449457

450458
// initializeHook read the hook config file and update the given hook variable
451459
// return value:
452-
// - nil
453-
// - If hook config file doesn't exists
454-
// - If hook config file is parsed and given hook variable is updated
455-
// - error
456-
// - If hook config is invalid
460+
// - nil
461+
// - If hook config file doesn't exists
462+
// - If hook config file is parsed and given hook variable is updated
463+
// - error
464+
// - If hook config is invalid
457465
func initializeHook(hook **nfshook.Hook) error {
458466
hookFileExists, err := hookConfigFileExist()
459467
if err != nil {

provisioner/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,

0 commit comments

Comments
 (0)