Skip to content

Commit

Permalink
Refactored webhook validation logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
hime authored and songjiaxun committed Nov 9, 2023
1 parent bfad002 commit 3624972
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/webhook/mutatingwebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ func (si *SidecarInjector) Handle(_ context.Context, req admission.Request) admi
return admission.Allowed(fmt.Sprintf("No injection required for operation %v.", req.Operation))
}

if v, ok := pod.Annotations[AnnotationGcsfuseVolumeEnableKey]; !ok || strings.ToLower(v) != "true" {
enableGcsfuseVolumes, ok := pod.Annotations[AnnotationGcsfuseVolumeEnableKey]
if !ok {
return admission.Allowed(fmt.Sprintf("The annotation key %q is not found, no injection required.", AnnotationGcsfuseVolumeEnableKey))
}

enableGcsfuseVolumes, ok := pod.Annotations[AnnotationGcsfuseVolumeEnableKey]
if !ok || strings.ToLower(enableGcsfuseVolumes) == "false" {
if strings.ToLower(enableGcsfuseVolumes) == "false" {
return admission.Allowed("No injection required.")
}

Expand Down

0 comments on commit 3624972

Please sign in to comment.