Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aks-px committed Feb 4, 2024
1 parent 6b88497 commit 5a37c8f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 54 deletions.
35 changes: 0 additions & 35 deletions pkg/controllers/dataexport/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,41 +607,6 @@ func parseExcludeFileListKey(pvcStorageClass string, excludeFileListValue string
return excludeFileList, nil
}

func appendPodLogToStork(jobName string, namespace string) {
// Get job and check whether it has live pod attaced to it
job, err := batch.Instance().GetJob(jobName, namespace)
if err != nil && !k8sErrors.IsNotFound(err) {
logrus.Infof("failed in getting job %v/%v with err: %v", namespace, jobName, err)
}
pods, err := core.Instance().GetPods(
job.Namespace,
map[string]string{
"job-name": job.Name,
},
)
if err != nil {
logrus.Infof("failed in fetching job pods %s/%s: %v", namespace, jobName, err)
}
for _, pod := range pods.Items {
numLogLines := int64(50)
podDescribe, err := core.Instance().GetPodByName(pod.Name, pod.Namespace)
if err != nil {
logrus.Infof("Error fetching description of job-pod[%s] :%v", pod.Name, err)
}
logrus.Infof("start of job-pod [%s]'s description", pod.Name)
logrus.Infof("Describe %v", podDescribe)
logrus.Infof("end of job-pod [%s]'s description", pod.Name)
podLog, err := core.Instance().GetPodLog(pod.Name, pod.Namespace, &corev1.PodLogOptions{TailLines: &numLogLines})
if err != nil {
logrus.Infof("error fetching log of job-pod %s: %v", pod.Name, err)
} else {
logrus.Infof("start of job-pod [%s]'s log...", pod.Name)
logrus.Infof(podLog)
logrus.Infof("end of job-pod [%s]'s log...", pod.Name)
}
}
}

func (c *Controller) createJobCredCertSecrets(
dataExport *kdmpapi.DataExport,
vb *kdmpapi.VolumeBackup,
Expand Down
5 changes: 0 additions & 5 deletions pkg/drivers/kopiadelete/kopiadelete.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ func (d Driver) JobStatus(id string) (*drivers.JobStatus, error) {
jobStatus = job.Status.Conditions[0].Type

}
if err != nil {
errMsg := fmt.Sprintf("failed to get restart count for job %s/%s job: %v", namespace, name, err)
logrus.Errorf("%s: %v", fn, errMsg)
return nil, fmt.Errorf(errMsg)
}

if utils.IsJobFailed(job) {
utils.DisplayJobpodLogandEvents(job.Name, job.Namespace)
Expand Down
5 changes: 0 additions & 5 deletions pkg/drivers/kopiamaintenance/kopiamaintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,6 @@ func (d Driver) JobStatus(id string) (*drivers.JobStatus, error) {
jobStatus = job.Status.Conditions[0].Type

}
if err != nil {
errMsg := fmt.Sprintf("failed to get restart count for job %s/%s job: %v", namespace, name, err)
logrus.Errorf("%s: %v", fn, errMsg)
return nil, fmt.Errorf(errMsg)
}

if utils.IsJobFailed(job) {
utils.DisplayJobpodLogandEvents(job.Name, job.Namespace)
Expand Down
5 changes: 0 additions & 5 deletions pkg/drivers/kopiarestore/kopiarestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ func (d Driver) JobStatus(id string) (*drivers.JobStatus, error) {
jobStatus = job.Status.Conditions[0].Type

}
if err != nil {
errMsg := fmt.Sprintf("failed to get restart count for job %s/%s job: %v", namespace, name, err)
logrus.Errorf("%s: %v", fn, errMsg)
return nil, fmt.Errorf(errMsg)
}

if utils.IsJobFailed(job) {
utils.DisplayJobpodLogandEvents(job.Name, job.Namespace)
Expand Down
4 changes: 0 additions & 4 deletions pkg/drivers/nfscsirestore/nfscsirestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ func (d Driver) JobStatus(id string) (*drivers.JobStatus, error) {
return utils.ToJobStatus(0, errMsg, jobStatus), nil
}

if utils.IsJobFailed(job) {
errMsg := fmt.Sprintf("check %s/%s job for details: %s", namespace, name, drivers.ErrJobFailed)
return utils.ToJobStatus(0, errMsg, jobStatus), nil
}
if utils.IsJobPending(job) {
logrus.Warnf("restore job %s is in pending state", job.Name)
return utils.ToJobStatus(0, "", jobStatus), nil
Expand Down

0 comments on commit 5a37c8f

Please sign in to comment.