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

feat: added support for changing config via API #729

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eusebiu-constantin-petu-dbk
Copy link
Collaborator

@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk commented Aug 16, 2022

closes #268, closes #698

Signed-off-by: Petu Eusebiu [email protected]

What does this PR do / Why do we need it:

  • added a http handler to GET current zot config or POST a new one

  • only admins can GET/POST configs

  • after zot successfully starts its server it will back up the current configuration

  • after a POST config, zot will validate it and restart the server with the new configuration if the server crashes because of config errors zot will restore the config to the last backup. (not anymore)

  • the config file which zot starts with is the single source of configuration and it will always reflect the current configuration of a running zot.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the api_config_reload branch 2 times, most recently from b01598f to c4a8343 Compare August 16, 2022 14:49
@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk marked this pull request as ready for review August 16, 2022 14:49
@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the api_config_reload branch 6 times, most recently from 19df363 to b8eeb82 Compare August 19, 2022 12:02
@codecov
Copy link

codecov bot commented Aug 19, 2022

Codecov Report

Merging #729 (8efbe56) into main (2d877aa) will increase coverage by 0.10%.
The diff coverage is 94.91%.

@@            Coverage Diff             @@
##             main     #729      +/-   ##
==========================================
+ Coverage   88.75%   88.85%   +0.10%     
==========================================
  Files          73       77       +4     
  Lines       13847    14009     +162     
==========================================
+ Hits        12290    12448     +158     
- Misses       1212     1215       +3     
- Partials      345      346       +1     
Impacted Files Coverage Δ
pkg/api/config/config.go 88.57% <ø> (-0.66%) ⬇️
pkg/api/authn.go 85.71% <50.00%> (ø)
pkg/cli/root.go 88.80% <72.41%> (-6.63%) ⬇️
pkg/cli/config_reloader.go 81.01% <80.95%> (-0.24%) ⬇️
pkg/api/config/loader.go 92.00% <92.00%> (ø)
pkg/api/authz.go 98.40% <100.00%> (+0.08%) ⬆️
pkg/api/config/validator.go 100.00% <100.00%> (ø)
pkg/api/controller.go 92.72% <100.00%> (-0.24%) ⬇️
pkg/api/routes.go 96.83% <100.00%> (+<0.01%) ⬆️
pkg/extensions/extension-config-disabled.go 100.00% <100.00%> (ø)
... and 7 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the api_config_reload branch 15 times, most recently from d117f37 to 4925a11 Compare September 1, 2022 16:32
@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the api_config_reload branch 6 times, most recently from d870f38 to 4bc9813 Compare September 7, 2022 16:37
pkg/api/config/config.go Outdated Show resolved Hide resolved
@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the api_config_reload branch 3 times, most recently from 0422c39 to 48b0b95 Compare September 26, 2022 09:01
@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the api_config_reload branch 3 times, most recently from 5f131e9 to 9229444 Compare October 27, 2022 10:14
@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk changed the title Added support for changing config via API feat: added support for changing config via API Oct 27, 2022
@eusebiu-constantin-petu-dbk eusebiu-constantin-petu-dbk force-pushed the api_config_reload branch 9 times, most recently from 630b3bf to ffa9e91 Compare October 28, 2022 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zot should expose the current configuration using an API call support configuration change using API calls
3 participants