Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
Signed-off-by: stgrace <[email protected]>
  • Loading branch information
stgrace committed Sep 29, 2023
1 parent 697923a commit 4dfd0e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions internal/pkg/callbacks/rolling_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func GetDeploymentItems(clients kube.Clients, namespace string) []runtime.Object
return items
}

// GetCronJobs returns the jobs in given namespace
func GetCronJobs(clients kube.Clients, namespace string) []runtime.Object {
// GetCronJobItems returns the jobs in given namespace
func GetCronJobItems(clients kube.Clients, namespace string) []runtime.Object {
cronjobs, err := clients.KubernetesClient.BatchV1().CronJobs(namespace).List(context.TODO(), meta_v1.ListOptions{})
if err != nil {
logrus.Errorf("Failed to list cronjobs %v", err)
Expand Down Expand Up @@ -199,7 +199,7 @@ func GetDeploymentPodAnnotations(item runtime.Object) map[string]string {
return item.(*appsv1.Deployment).Spec.Template.ObjectMeta.Annotations
}

// GetCronJobPodAnnotations returns the pod's annotations of given deployment
// GetCronJobPodAnnotations returns the pod's annotations of given cronjob
func GetCronJobPodAnnotations(item runtime.Object) map[string]string {
return item.(*batchv1.CronJob).Spec.JobTemplate.Spec.Template.ObjectMeta.Annotations
}
Expand Down Expand Up @@ -229,7 +229,7 @@ func GetDeploymentContainers(item runtime.Object) []v1.Container {
return item.(*appsv1.Deployment).Spec.Template.Spec.Containers
}

// GetCronJobContainers returns the containers of given deployment
// GetCronJobContainers returns the containers of given cronjob
func GetCronJobContainers(item runtime.Object) []v1.Container {
return item.(*batchv1.CronJob).Spec.JobTemplate.Spec.Template.Spec.Containers
}
Expand Down Expand Up @@ -259,7 +259,7 @@ func GetDeploymentInitContainers(item runtime.Object) []v1.Container {
return item.(*appsv1.Deployment).Spec.Template.Spec.InitContainers
}

// GetCronJobInitContainers returns the containers of given deployment
// GetCronJobInitContainers returns the containers of given cronjob
func GetCronJobInitContainers(item runtime.Object) []v1.Container {
return item.(*batchv1.CronJob).Spec.JobTemplate.Spec.Template.Spec.InitContainers
}
Expand Down Expand Up @@ -291,7 +291,7 @@ func UpdateDeployment(clients kube.Clients, namespace string, resource runtime.O
return err
}

// CreateJobFromCronjob performs rolling upgrade on deployment
// CreateJobFromCronjob performs rolling upgrade on cronjob
func CreateJobFromCronjob(clients kube.Clients, namespace string, resource runtime.Object) error {
cronJob := resource.(*batchv1.CronJob)
job := &batchv1.Job{
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/handler/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ func GetDeploymentRollingUpgradeFuncs() callbacks.RollingUpgradeFuncs {
}
}

// GetDeploymentRollingUpgradeFuncs returns all callback funcs for a deployment
// GetDeploymentRollingUpgradeFuncs returns all callback funcs for a cronjob
func GetCronJobCreateJobFuncs() callbacks.RollingUpgradeFuncs {
return callbacks.RollingUpgradeFuncs{
ItemsFunc: callbacks.GetCronJobs,
ItemsFunc: callbacks.GetCronJobItems,
AnnotationsFunc: callbacks.GetCronJobAnnotations,
PodAnnotationsFunc: callbacks.GetCronJobPodAnnotations,
ContainersFunc: callbacks.GetCronJobContainers,
Expand Down

0 comments on commit 4dfd0e5

Please sign in to comment.