Skip to content

Commit

Permalink
Merge pull request #16 from pubg/bug/fix-cronjob-patch
Browse files Browse the repository at this point in the history
fix: GetImageStrategicPatchJson bug
  • Loading branch information
bitofsky authored Jan 20, 2022
2 parents e298d42 + d44cfcb commit 354bd55
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions util/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,20 @@ func GetImageStrategicPatchJson(obj interface{}, containers, initContainers []Co

switch obj.(type) {
case *batchV1Beta1.CronJob:
imageStrategicPatch := ImageStrategicPatchCronJob{}
imageStrategicPatch.Spec.JobTemplate.Spec.Template.Spec.Containers = containers
imageStrategicPatch.Spec.JobTemplate.Spec.Template.Spec.InitContainers = initContainers
p := ImageStrategicPatchCronJob{}
p.Spec.JobTemplate.Spec.Template.Spec.Containers = containers
p.Spec.JobTemplate.Spec.Template.Spec.InitContainers = initContainers
imageStrategicPatch = p
case *batchV1.CronJob:
imageStrategicPatch := ImageStrategicPatchCronJob{}
imageStrategicPatch.Spec.JobTemplate.Spec.Template.Spec.Containers = containers
imageStrategicPatch.Spec.JobTemplate.Spec.Template.Spec.InitContainers = initContainers
p := ImageStrategicPatchCronJob{}
p.Spec.JobTemplate.Spec.Template.Spec.Containers = containers
p.Spec.JobTemplate.Spec.Template.Spec.InitContainers = initContainers
imageStrategicPatch = p
default:
imageStrategicPatch := ImageStrategicPatch{}
imageStrategicPatch.Spec.Template.Spec.Containers = containers
imageStrategicPatch.Spec.Template.Spec.InitContainers = initContainers
p := ImageStrategicPatch{}
p.Spec.Template.Spec.Containers = containers
p.Spec.Template.Spec.InitContainers = initContainers
imageStrategicPatch = p
}
patchJson, err := json.Marshal(imageStrategicPatch)
return patchJson, err
Expand Down

0 comments on commit 354bd55

Please sign in to comment.