Skip to content

Commit

Permalink
Fix for MutatingWebhook: Snapshots not being added (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
abalaven authored Jul 12, 2023
1 parent 97a2b07 commit 337f676
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/hook/config/config_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ func (cv1 *HookConfigV1) ConvertAndCheck(c *HookConfig) (err error) {
}
c.KubernetesValidating = newValidating

newMutating := make([]MutatingConfig, 0)
for _, cfg := range c.KubernetesMutating {
if snapshots, ok := groupSnapshots[cfg.Group]; ok {
cfg.IncludeSnapshotsFrom = MergeArrays(cfg.IncludeSnapshotsFrom, snapshots)
}
newMutating = append(newMutating, cfg)
}
c.KubernetesMutating = newMutating

newConversion := make([]ConversionConfig, 0)
for _, cfg := range c.KubernetesConversion {
if snapshots, ok := groupSnapshots[cfg.Group]; ok {
Expand Down
7 changes: 7 additions & 0 deletions pkg/hook/controller/hook_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ func (hc *hookController) getIncludeSnapshotsFrom(bindingType BindingType, bindi
break
}
}
case KubernetesMutating:
for _, binding := range hc.mutatingBindings {
if bindingName == binding.BindingName {
includeSnapshotsFrom = binding.IncludeSnapshotsFrom
break
}
}
case KubernetesConversion:
for _, binding := range hc.conversionBindings {
if bindingName == binding.BindingName {
Expand Down

0 comments on commit 337f676

Please sign in to comment.