Skip to content
Snippets Groups Projects
Commit b637b9ae authored by Balasankar 'Balu' C's avatar Balasankar 'Balu' C
Browse files

Merge branch 'registry-add-notifications-maxretries' into 'master'

parents e3c9c7ab 493b4b8f
No related branches found
No related tags found
1 merge request!137Remerge after conversion fixups
......@@ -1055,7 +1055,8 @@
# 'name' => 'test_endpoint',
# 'url' => 'https://gitlab.example.com/notify2',
# 'timeout' => '500ms',
# 'threshold' => 5,
# 'threshold' => 5, # DEPRECATED: use maxretries instead https://gitlab.com/gitlab-org/container-registry/-/issues/1243
# 'maxretries' => 5,
# 'backoff' => '1s',
# 'headers' => {
# "Authorization" => ["AUTHORIZATION_EXAMPLE_TOKEN"]
......@@ -1065,6 +1066,7 @@
### Default registry notifications
# registry['default_notifications_timeout'] = "500ms"
# registry['default_notifications_threshold'] = 5
# registry['default_notifications_maxretries'] = 5
# registry['default_notifications_backoff'] = "1s"
# registry['default_notifications_headers'] = {}
......
......@@ -137,6 +137,7 @@
# Use the registry defaults configured by the user but use the defaults from gitlab if they were not set
user_configuration['default_notifications_timeout'] ||= gitlab_configuration['default_notifications_timeout']
user_configuration['default_notifications_threshold'] ||= gitlab_configuration['default_notifications_threshold']
user_configuration['default_notifications_maxretries'] ||= gitlab_configuration['default_notifications_maxretries']
user_configuration['default_notifications_backoff'] ||= gitlab_configuration['default_notifications_backoff']
user_configuration['default_notifications_headers'] ||= gitlab_configuration['default_notifications_headers']
......@@ -144,6 +145,7 @@
# Get the values from default if they are not set
endpoint['timeout'] ||= user_configuration['default_notifications_timeout']
endpoint['threshold'] ||= user_configuration['default_notifications_threshold']
endpoint['maxretries'] ||= user_configuration['default_notifications_maxretries']
endpoint['backoff'] ||= user_configuration['default_notifications_backoff']
# And merge the default headers with the ones specific to this endpoint
......
......@@ -361,6 +361,12 @@
deprecation: '16.10',
removal: '17.0',
note: "`omnibus_gitconfig` will be removed in GitLab 17.0. For details and migration instructions, please see: https://docs.gitlab.com/ee/update/versions/gitlab_16_changes.html#gitlabomnibus_gitconfig-deprecation"
},
{
config_keys: %w(registry default_notifications_threshold),
deprecation: '17.1',
removal: '18.0',
note: "`registry['default_notifications_threshold'] will be removed in 18.0. Please use `default_notifications_maxretries` instead https://gitlab.com/gitlab-org/container-registry/-/issues/1243."
}
]
......@@ -600,6 +606,14 @@
messages += deprecate_only_if_value(incoming_version, existing_config, type, ['praefect'], 'failover_election_strategy', 'sql', '13.12', '14.0', note: praefect_note, ignore_deprecation: true)
messages += deprecate_only_if_value(incoming_version, existing_config, type, ['praefect'], 'failover_election_strategy', 'local', '13.12', '14.0', note: praefect_note, ignore_deprecation: true)
grafana_note = <<~EOS
The bundled Grafana is deprecated and no longer available. We recommond following
https://docs.gitlab.com/ee/administration/monitoring/performance/grafana_configuration.html#deprecation.
EOS
messages += deprecate_only_if_value(incoming_version, existing_config, type, ['monitoring', 'grafana'], 'enable', true, '16.0', '16.3', note: grafana_note)
messages += deprecate_registry_notifications(incoming_version, existing_config, type, ['registry', 'notifications'], 'threshold', 17.1, 18.0)
messages
end
......@@ -630,6 +644,40 @@
messages
end
def deprecate_registry_notifications(incoming_version, existing_config, type, config_keys, key, deprecated_version, removed_version)
settings = existing_config.dig(*config_keys) || []
return [] if settings.empty?
notifications_note =
case key
when "threshold"
<<~EOS
Starting with GitLab 18.0, `registry['notifications'][{'threshold'=> value}] will be removed.
Please use `maxretries` instead https://gitlab.com/gitlab-org/container-registry/-/issues/1243.
EOS
else
""
end
messages = []
settings.to_a.each do |setting|
next unless setting.key?(key)
if Gem::Version.new(incoming_version) >= Gem::Version.new(removed_version) && type == :removal
message = "* #{config_keys[0]}['#{config_keys[1]}'][{#{key} => value}] has been deprecated since #{deprecated_version} and was removed in #{removed_version}."
message += " #{notifications_note}"
messages << message
elsif Gem::Version.new(incoming_version) >= Gem::Version.new(deprecated_version) && type == :deprecation
message = "*#{config_keys[0]}['#{config_keys[1]}'][{#{key} => value}] has been deprecated since #{deprecated_version} and will be removed in #{removed_version}."
message += " #{notifications_note}"
messages << message
end
end
messages
end
end
class NodeAttribute < ObjectProxy
......
......@@ -45,5 +45,6 @@
default['registry']['notifications'] = nil
default['registry']['default_notifications_timeout'] = "500ms"
default['registry']['default_notifications_threshold'] = 5
default['registry']['default_notifications_maxretries'] = 5
default['registry']['default_notifications_backoff'] = "1s"
default['registry']['default_notifications_headers'] = {}
......@@ -378,6 +378,7 @@
],
default_notifications_timeout: '5000ms',
default_notifications_threshold: 10,
default_notifications_maxretries: 5,
default_notifications_backoff: '50s',
default_notifications_headers: {
"Authorization" => %w(AUTHORIZATION_EXAMPLE_TOKEN1 AUTHORIZATION_EXAMPLE_TOKEN2)
......@@ -396,6 +397,8 @@
expect(chef_run).to render_file('/var/opt/gitlab/registry/config.yml')
.with_content(/"threshold":10/)
expect(chef_run).to render_file('/var/opt/gitlab/registry/config.yml')
.with_content(/"maxretries":5/)
expect(chef_run).to render_file('/var/opt/gitlab/registry/config.yml')
.with_content(/"backoff":"50s"/)
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment