Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
Signed-off-by: bitliu <[email protected]>
  • Loading branch information
Xunzhuo committed Feb 23, 2024
1 parent b9ab5a5 commit 6569c41
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/v1alpha1/kubernetes_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,12 @@ func (deployment *KubernetesDeploymentSpec) ApplyMergePatch(old *appv1.Deploymen
return nil, fmt.Errorf("error marshaling original deployment: %w", err)
}

if deployment.Patch.Type == nil || *deployment.Patch.Type == StrategicMerge {
switch {
case deployment.Patch.Type == nil || *deployment.Patch.Type == StrategicMerge:
patchedJSON, err = strategicpatch.StrategicMergePatch(originalJSON, deployment.Patch.Value.Raw, appv1.Deployment{})
} else if *deployment.Patch.Type == JSONMerge {
case *deployment.Patch.Type == JSONMerge:
patchedJSON, err = jsonpatch.MergePatch(originalJSON, deployment.Patch.Value.Raw)
} else {
default:
return nil, fmt.Errorf("unsupported merge type: %s", *deployment.Patch.Type)
}
if err != nil {
Expand Down

0 comments on commit 6569c41

Please sign in to comment.