Skip to content

Commit

Permalink
fix(): check if VPNConfig is nil for old slice (#175)
Browse files Browse the repository at this point in the history
Signed-off-by: rahulsawra98 <[email protected]>
  • Loading branch information
rahulsawra98 authored Jul 26, 2023
1 parent f610cfa commit 8614d72
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions service/slice_config_webhook_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,13 @@ func preventUpdate(ctx context.Context, sc *controllerv1alpha1.SliceConfig, old
if sliceConfig.Spec.SliceIpamType != sc.Spec.SliceIpamType {
return field.Invalid(field.NewPath("Spec").Child("SliceIpamType"), sc.Spec.SliceIpamType, "cannot be updated")
}
if sliceConfig.Spec.VPNConfig.Cipher != sc.Spec.VPNConfig.Cipher {
return field.Invalid(field.NewPath("Spec").Child("VPNConfig").Child("Cipher"), sc.Spec.VPNConfig.Cipher, "cannot be updated")
// required if slice from previous releases is upgraded
if sliceConfig.Spec.VPNConfig != nil {
if sliceConfig.Spec.VPNConfig.Cipher != sc.Spec.VPNConfig.Cipher {
return field.Invalid(field.NewPath("Spec").Child("VPNConfig").Child("Cipher"), sc.Spec.VPNConfig.Cipher, "cannot be updated")
}
}

return nil
}

Expand Down

0 comments on commit 8614d72

Please sign in to comment.