Skip to content

Commit b0470dd

Browse files
committed
Remove if clause to simplify code, since we check within the webhook anyway
1 parent 021b2e9 commit b0470dd

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

main.go

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -569,23 +569,21 @@ func main() {
569569
}
570570
// +kubebuilder:scaffold:builder
571571

572-
if enableFsGroupChangePolicyWebhook || enablePodTopologySpreadConstraintWebhook {
573-
svcClusterMgr.GetWebhookServer().Register(
574-
"/mutate-v1-pod",
575-
&webhook.Admission{
576-
Handler: &webhooks.SpiloPodMutator{
577-
SvcClient: svcClusterMgr.GetClient(),
578-
Decoder: admission.NewDecoder(svcClusterMgr.GetScheme()),
579-
Log: ctrl.Log.WithName("webhooks").WithName("SpiloPodMutator"),
580-
EnableFsGroupChangePolicyWebhook: enableFsGroupChangePolicyWebhook,
581-
EnablePodTopologySpreadConstraintWebhook: enablePodTopologySpreadConstraintWebhook,
582-
PodTopologySpreadConstraintTopologyKey: podTopologySpreadConstraintTopologyKey,
583-
PodTopologySpreadConstraintMaxSkew: podTopologySpreadConstraintMaxSkew,
584-
PodTopologySpreadConstraintMinDomains: podTopologySpreadConstraintMinDomains,
585-
},
572+
svcClusterMgr.GetWebhookServer().Register(
573+
"/mutate-v1-pod",
574+
&webhook.Admission{
575+
Handler: &webhooks.SpiloPodMutator{
576+
SvcClient: svcClusterMgr.GetClient(),
577+
Decoder: admission.NewDecoder(svcClusterMgr.GetScheme()),
578+
Log: ctrl.Log.WithName("webhooks").WithName("SpiloPodMutator"),
579+
EnableFsGroupChangePolicyWebhook: enableFsGroupChangePolicyWebhook,
580+
EnablePodTopologySpreadConstraintWebhook: enablePodTopologySpreadConstraintWebhook,
581+
PodTopologySpreadConstraintTopologyKey: podTopologySpreadConstraintTopologyKey,
582+
PodTopologySpreadConstraintMaxSkew: podTopologySpreadConstraintMaxSkew,
583+
PodTopologySpreadConstraintMinDomains: podTopologySpreadConstraintMinDomains,
586584
},
587-
)
588-
}
585+
},
586+
)
589587

590588
ctx := context.Background()
591589

0 commit comments

Comments
 (0)