Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: AiRanthem <zhongtianyun.zty@alibaba-inc.com>
  • Loading branch information
AiRanthem committed Nov 28, 2024
1 parent 78e1dda commit 89dee79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pkg/controller/workloadspread/workloadspread_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ func (r *ReconcileWorkloadSpread) getReplicasPathList(ws *appsv1alpha1.WorkloadS
return nil, err
}
gv, err := schema.ParseGroupVersion(ws.Spec.TargetReference.APIVersion)
if err != nil {
return nil, err
}
for _, wl := range whiteList.Workloads {
if wl.GroupVersion() != gv || wl.GroupVersionKind.Kind != ws.Spec.TargetReference.Kind {
continue
Expand All @@ -313,6 +316,9 @@ func (r *ReconcileWorkloadSpread) getPodsForWorkloadSpread(ws *appsv1alpha1.Work
pods, workloadReplicas, err = r.getPodJob(targetRef, ws.Namespace)
default:
pods, workloadReplicas, err = r.controllerFinder.GetPodsForRef(targetRef.APIVersion, targetRef.Kind, ws.Namespace, targetRef.Name, false)
if err != nil {
break
}
workloadReplicas, pods, err = r.filterWorkload(ws, pods, workloadReplicas)
}

Expand Down
1 change: 0 additions & 1 deletion pkg/util/workloadspread/workloadspread.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,6 @@ func GenerateEmptyWorkloadObject(gvk schema.GroupVersionKind, key types.Namespac
return
}

// GetReplicasFromObject tries to get replicas from object by given path (default path is "spec.replcias")
func GetReplicasFromObject(object *unstructured.Unstructured, replicasPath string) (int32, error) {
if replicasPath == "" {
return 0, nil
Expand Down

0 comments on commit 89dee79

Please sign in to comment.