Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add missing changes from #556 back after they got lost in #651 #868

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pkg/admission/mutator/shoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ type shoot struct {
}

const (
overlayKey = "overlay"
enabledKey = "enabled"
overlayKey = "overlay"
snatToUpstreamDNSKey = "snatToUpstreamDNS"
enabledKey = "enabled"
)

// Mutate mutates the given shoot object.
Expand Down Expand Up @@ -95,6 +96,10 @@ func (s *shoot) Mutate(_ context.Context, new, old client.Object) error {
}
}

if networkConfig[overlayKey] != nil && !networkConfig[overlayKey].(map[string]interface{})[enabledKey].(bool) {
networkConfig[snatToUpstreamDNSKey] = map[string]interface{}{enabledKey: false}
}

modifiedJSON, err := json.Marshal(networkConfig)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions pkg/admission/mutator/shoot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ var _ = Describe("Shoot mutator", func() {
err := shootMutator.Mutate(ctx, shoot, nil)
Expect(err).NotTo(HaveOccurred())
Expect(shoot.Spec.Networking.ProviderConfig).To(Equal(&runtime.RawExtension{
Raw: []byte(`{"overlay":{"enabled":false}}`),
Raw: []byte(`{"overlay":{"enabled":false},"snatToUpstreamDNS":{"enabled":false}}`),
}))
})

Expand All @@ -172,7 +172,7 @@ var _ = Describe("Shoot mutator", func() {
err := shootMutator.Mutate(ctx, shoot, nil)
Expect(err).NotTo(HaveOccurred())
Expect(shoot.Spec.Networking.ProviderConfig).To(Equal(&runtime.RawExtension{
Raw: []byte(`{"foo":{"enabled":true},"overlay":{"enabled":false}}`),
Raw: []byte(`{"foo":{"enabled":true},"overlay":{"enabled":false},"snatToUpstreamDNS":{"enabled":false}}`),
}))
})

Expand Down
Loading