Skip to content

Commit

Permalink
fix scopelint issue and add priorityclass
Browse files Browse the repository at this point in the history
Signed-off-by: shubham <[email protected]>
  • Loading branch information
shubham14bajpai committed Dec 27, 2019
1 parent c5fe9a3 commit 87b9560
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/cstor/migrate/cspc_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ func getCSPCSpecForSPC(spc *apis.StoragePoolClaim, openebsNamespace string) (*ap
OverProvisioning: cspObj.Spec.PoolSpec.OverProvisioning,
Resources: getCSPResources(cspDeployList.Items[0]),
Tolerations: cspDeployList.Items[0].Spec.Template.Spec.Tolerations,
PriorityClassName: cspDeployList.Items[0].Spec.Template.Spec.PriorityClassName,
// AuxResources: getCSPAuxResources(cspDeployList.Items[0]),
// PriorityClassName: cspDeployList.Items[0].Spec.Template.Spec.PriorityClassName,
},
}
// if the csp does not have a cachefile then add cachefile
Expand Down
18 changes: 12 additions & 6 deletions pkg/cstor/migrate/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ func updateBDCLabels(cspcName, openebsNamespace string) error {
if err != nil {
return err
}
for _, bdcObj := range bdcList.Items {
for _, bdcItem := range bdcList.Items {
bdcItem := bdcItem // pin it
bdcObj := &bdcItem
klog.Infof("Updating bdc %s with cspc labels & finalizer.", bdcObj.Name)
delete(bdcObj.Labels, string(apis.StoragePoolClaimCPK))
bdcObj.Labels[string(apis.CStorPoolClusterCPK)] = cspcName
Expand All @@ -308,7 +310,7 @@ func updateBDCLabels(cspcName, openebsNamespace string) error {
// bdcObj.OwnerReferences[0].UID = cspcObj.UID
_, err := bdc.NewKubeClient().
WithNamespace(openebsNamespace).
Update(&bdcObj)
Update(bdcObj)
if err != nil {
return errors.Wrapf(err, "failed to update bdc %s with cspc label & finalizer", bdcObj.Name)
}
Expand All @@ -325,13 +327,15 @@ func updateBDCOwnerRef(cspcObj *apis.CStorPoolCluster, openebsNamespace string)
if err != nil {
return err
}
for _, bdcObj := range bdcList.Items {
for _, bdcItem := range bdcList.Items {
bdcItem := bdcItem // pin it
bdcObj := &bdcItem
klog.Infof("Updating bdc %s with cspc ownerRef.", bdcObj.Name)
bdcObj.OwnerReferences[0].Kind = "CStorPoolCluster"
bdcObj.OwnerReferences[0].UID = cspcObj.UID
_, err := bdc.NewKubeClient().
WithNamespace(openebsNamespace).
Update(&bdcObj)
Update(bdcObj)
if err != nil {
return errors.Wrapf(err, "failed to update bdc %s with cspc onwerRef", bdcObj.Name)
}
Expand All @@ -349,7 +353,9 @@ func updateCVRsLabels(cspName, openebsNamespace string, cspiObj *apis.CStorPoolI
if err != nil {
return err
}
for _, cvrObj := range cvrList.Items {
for _, cvrItem := range cvrList.Items {
cvrItem := cvrItem // pin it
cvrObj := &cvrItem
klog.Infof("Updating cvr %s with cspi %s info.", cvrObj.Name, cspiObj.Name)
delete(cvrObj.Labels, cspNameLabel)
delete(cvrObj.Labels, cspUIDLabel)
Expand All @@ -358,7 +364,7 @@ func updateCVRsLabels(cspName, openebsNamespace string, cspiObj *apis.CStorPoolI
delete(cvrObj.Annotations, cspHostnameAnnotation)
cvrObj.Annotations[cspiHostnameAnnotation] = cspiObj.Spec.HostName
_, err = cvr.NewKubeclient().WithNamespace(openebsNamespace).
Update(&cvrObj)
Update(cvrObj)
if err != nil {
return errors.Wrapf(err, "failed to update cvr %s with cspc info", cvrObj.Name)
}
Expand Down

0 comments on commit 87b9560

Please sign in to comment.