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

Force send Enable field for LogConfig #1119

Merged
merged 2 commits into from
May 26, 2020
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
2 changes: 1 addition & 1 deletion pkg/backends/features/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func EnsureLogging(sp utils.ServicePort, be *composite.BackendService) bool {
if be.LogConfig == nil || expectedLogConfig.Enable != be.LogConfig.Enable ||
expectedLogConfig.SampleRate != be.LogConfig.SampleRate {
be.LogConfig = expectedLogConfig
klog.V(2).Infof("Updated Logging settings for service %s(Enable: %t, SampleRate: %f)", svcKey, be.LogConfig.Enable, be.LogConfig.SampleRate)
klog.V(2).Infof("Updated Logging settings for service %s and port %d (Enable: %t, SampleRate: %f)", svcKey, sp.Port, be.LogConfig.Enable, be.LogConfig.SampleRate)
return true
}
return false
Expand Down
9 changes: 9 additions & 0 deletions pkg/composite/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3182,6 +3182,9 @@ func (backendService *BackendService) ToAlpha() (*computealpha.BackendService, e
if alpha.Iap != nil {
alpha.Iap.ForceSendFields = []string{"Enabled", "Oauth2ClientId", "Oauth2ClientSecret"}
}
if alpha.LogConfig != nil {
alpha.LogConfig.ForceSendFields = []string{"Enable"}
}

return alpha, nil
}
Expand All @@ -3201,6 +3204,9 @@ func (backendService *BackendService) ToBeta() (*computebeta.BackendService, err
if beta.Iap != nil {
beta.Iap.ForceSendFields = []string{"Enabled", "Oauth2ClientId", "Oauth2ClientSecret"}
}
if beta.LogConfig != nil {
beta.LogConfig.ForceSendFields = []string{"Enable"}
}

return beta, nil
}
Expand All @@ -3220,6 +3226,9 @@ func (backendService *BackendService) ToGA() (*compute.BackendService, error) {
if ga.Iap != nil {
ga.Iap.ForceSendFields = []string{"Enabled", "Oauth2ClientId", "Oauth2ClientSecret"}
}
if ga.LogConfig != nil {
skmatti marked this conversation as resolved.
Show resolved Hide resolved
ga.LogConfig.ForceSendFields = []string{"Enable"}
}

return ga, nil
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/composite/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,9 @@ func ({{$type.VarName}} *{{$type.Name}}) To{{$version}}() (*compute{{$extension}
if {{$lower}}.Iap != nil {
{{$lower}}.Iap.ForceSendFields = []string{"Enabled", "Oauth2ClientId", "Oauth2ClientSecret"}
}
if {{$lower}}.LogConfig != nil {
{{$lower}}.LogConfig.ForceSendFields = []string{"Enable"}
}
{{- end}}

return {{$lower}}, nil
Expand Down