-
Notifications
You must be signed in to change notification settings - Fork 39
PMM-8459 Ability to disable updates. #808
Changes from 5 commits
5da8245
6402f10
a528f68
7ff72c8
a8eed3e
5905f8b
c1a7f06
c8937e9
1fa4a8e
67a6e24
9c03996
4f4fe05
c54872c
5fbdea7
5125900
a2c22d4
29da0d6
4890350
bb04e5f
1abb795
f5211db
99699b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -429,7 +429,7 @@ func (s *Server) readUpdateAuthToken() (string, error) { | |
| // convertSettings merges database settings and settings from environment variables into API response. | ||
| func (s *Server) convertSettings(settings *models.Settings) *serverpb.Settings { | ||
| res := &serverpb.Settings{ | ||
| UpdatesDisabled: s.envSettings.DisableUpdates, | ||
| UpdatesDisabled: !settings.Updates.Disabled, | ||
|
JiriCtvrtka marked this conversation as resolved.
Outdated
|
||
| TelemetryEnabled: !settings.Telemetry.Disabled, | ||
| MetricsResolutions: &serverpb.MetricsResolutions{ | ||
| Hr: durationpb.New(settings.MetricsResolutions.HR), | ||
|
|
@@ -522,6 +522,13 @@ func (s *Server) validateChangeSettingsRequest(ctx context.Context, req *serverp | |
|
|
||
| // check request parameters compatibility with environment variables | ||
|
|
||
| if req.DisableUpdates && s.envSettings.EnableUpdates { | ||
| return status.Error(codes.FailedPrecondition, "Updates are enabled via ENABLE_UPDATES environment variable.") | ||
| } | ||
| if req.DisableUpdates && s.envSettings.EnableTelemetry { | ||
| return status.Error(codes.FailedPrecondition, "Updates cannot be disabled because telemetry is enabled via ENABLE_TELEMETRY environment variable.") | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updates and telemetry is independent, so we can remove this check.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here https://perconacorp.slack.com/archives/C03J8FZFU/p1626470324102700 is discussion that they are coupled. Ok I will change everything related to it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please discuss it with Roma, Steve or Denys. But previously users were able to disable updates using env variable without disabling telemetry.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that was just assumption from Steve (that disable doesn't work because of telemetry). It is not a requirement.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @denisok Ok thanks for verifying. |
||
|
|
||
|
BupycHuk marked this conversation as resolved.
|
||
| // ignore req.DisableTelemetry and req.DisableStt even if they are present since that will not change anything | ||
| if req.EnableTelemetry && s.envSettings.DisableTelemetry { | ||
| return status.Error(codes.FailedPrecondition, "Telemetry is disabled via DISABLE_TELEMETRY environment variable.") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,8 +188,22 @@ func TestServer(t *testing.T) { | |
| RemoveAlertManagerRules: true, | ||
| })) | ||
|
|
||
| s.envSettings.DisableTelemetry = true | ||
| s.envSettings.EnableUpdates = true | ||
| expected = status.New(codes.FailedPrecondition, "Updates are enabled via ENABLE_UPDATES environment variable.") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's rewrite test taking into account that we can't enable updates if it's disabled. |
||
| tests.AssertGRPCError(t, expected, s.validateChangeSettingsRequest(ctx, &serverpb.ChangeSettingsRequest{ | ||
| DisableUpdates: true, | ||
| })) | ||
| s.envSettings.EnableUpdates = false | ||
| s.envSettings.EnableTelemetry = true | ||
| expected = status.New(codes.FailedPrecondition, "Updates cannot be disabled because telemetry is enabled via ENABLE_TELEMETRY environment variable.") | ||
| tests.AssertGRPCError(t, expected, s.validateChangeSettingsRequest(ctx, &serverpb.ChangeSettingsRequest{ | ||
| DisableUpdates: true, | ||
| })) | ||
| assert.NoError(t, s.validateChangeSettingsRequest(ctx, &serverpb.ChangeSettingsRequest{ | ||
| EnableUpdates: true, | ||
| })) | ||
|
|
||
| s.envSettings.DisableTelemetry = true | ||
| expected = status.New(codes.FailedPrecondition, "Telemetry is disabled via DISABLE_TELEMETRY environment variable.") | ||
| tests.AssertGRPCError(t, expected, s.validateChangeSettingsRequest(ctx, &serverpb.ChangeSettingsRequest{ | ||
| EnableTelemetry: true, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.