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

[JUJU-1129] Refactor payload client facades to match standard practice #14058

Merged
merged 3 commits into from May 20, 2022

Conversation

wallyworld
Copy link
Member

Like what was done for resources, the payload api and cli machinery is refactored to match standard practice. API clients for cli and agents are moved to api package and cli is moved to cmd/juju.
A lot of the changes are file renames and edits.

QA steps

deploy a charm with payloads, eg

payloads:
  ingress-resource:
    type: crd
  api-token:
    type: secret
$ juju exec --unit test/0 "payload-register crd ingress-resource 1234 tag1,tag2"

$ juju payloads
[Unit Payloads]
Unit    Machine  Payload class     Status   Type  Id    Tags       
test/0  1        ingress-resource  running  crd   1234  tag1,tag2  

$ juju exec --unit test/0 "payload-status-set ingress-resource 1234 stopped"

$ juju payloads
[Unit Payloads]
Unit    Machine  Payload class     Status   Type  Id    Tags       
test/0  1        ingress-resource  stopped  crd   1234  tag1,tag2  

"github.com/juju/juju/payload"
"github.com/juju/juju/payload/status"
"github.com/juju/juju/cmd/juju/payload"
corepayload "github.com/juju/juju/payload"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are going to call it core payload and it fits what is in core/ then maybe we move it out of root into juju/juju/core/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's scheduled for the last PR after everything else; trying to manage the size of the changes each time.

@wallyworld
Copy link
Member Author

$$merge$$

@jujubot jujubot merged commit 812e6e9 into juju:2.9 May 20, 2022
jujubot added a commit that referenced this pull request May 23, 2022
#14062

This looks bigger than it is - a lot of code is moved around. The resources and payloads infrastructure is moved from the so called "component based approach" to the standard juju model. The basis of the change is that (most of the) code from the "components" package is moved to the uniter worker and remodelled as part of the hook context struct. The hook commands are also moved to live with all the others. The manifold used to make the uniter worker sets up the payload and resource facades and passes these into the runner context factory. From there hook commands have access to the necessary api calls.

Where relevant, a lot of the tests were rewritten to use gomock instead of the hand crafted stubs, also adding somewhat to the bulk of the PR.

## QA steps

See QA steps for these previous PRs

#14058
#14049

Essentially, deploy charms with payloads and resources and run various hook commands.
@wallyworld wallyworld mentioned this pull request May 25, 2022
jujubot added a commit that referenced this pull request May 26, 2022
#14078

Merge 2.9

#14049 [JUJU-1129] Refactor resource client api to be consistent with other juju client api
#14051 [JUJU-1125] Improve error message for local OCI image resource
#14048 [JUJU-1119] work around golang http proxy caching by default - add more logging
#14055 Added two examples to juju status help
#14058 [JUJU-1129] Refactor payload client facades to match standard practice
#14059 Update add-unit help to clarify lp#1971956
#14060 Increase the number of open file descriptors
#14057 [JUJU-1157] Check that an AgentStreamKey value exists
#14062 Remove the componentisation of resources and payloads
#14054 Update debug-log help text
#14064 [JUJU-1159] Improved help model-defaults message
#14066 Bump actions/upload-artifact from 3.0.0 to 3.1.0
#14070 [JUJU-1129] Move resources files to a single top level package
#14071 Update the model-defaults help text

Conflicts were charm and resource import paths, deleted resource files, and struct initialisations.
```
# Conflicts:
# api/client/resources/client.go
# api/client/resources/client/base_test.go
# api/client/resources/client/client_upload_test.go
# apiserver/facades/controller/caasapplicationprovisioner/provisioner_test.go
# caas/kubernetes/provider/k8s.go
# caas/kubernetes/provider/k8s_test.go
# cmd/containeragent/initialize/package_test.go
# cmd/containeragent/unit/package_test.go
# cmd/juju/application/bundle_test.go
# cmd/juju/application/deployer/bundlehandler.go
# cmd/juju/application/deployer/deployer.go
# cmd/juju/application/refresh.go
# cmd/juju/commands/main.go
# cmd/juju/commands/main_test.go
# core/watcher/package_test.go
# go.sum
# payload/api/private/helpers_test.go
# payload/context/base_test.go
# payload/context/register_test.go
# payload/context/utils.go
# resource/charmhub.go
# resource/charmstore.go
# resource/context/context.go
# resource/context/internal/content.go
# resource/context/internal/content_test.go
# resource/context/internal/resourcedir.go
# resource/context/internal/stub_test.go
# resource/context/utils.go
# resource/context/utils_test.go
# resource/repositories/mocks/mocks.go
# resource/repositories/operations.go
# resource/repositories/operations_test.go
# resource/repositories/repository.go
# resource/resource.go
# resource/resourceadapters/interfaces.go
# resource/resourceadapters/mocks/opener_mock.go
# resource/resourceadapters/opener.go
# resource/unit.go
# snap/snapcraft.yaml
# state/mocks/resources_mock.go
# worker/caasapplicationprovisioner/application_test.go
# worker/uniter/manifold.go
# worker/uniter/runner/context/contextfactory.go
# worker/uniter/runner/jujuc/mocks/context_mock.go
# worker/uniter/runner/jujuc/payload-register.go
# worker/uniter/runner/jujuc/restricted.go
# worker/uniter/runner/jujuc/server.go
# worker/uniter/uniter.go
# worker/uniter/uniter_test.go
# worker/uniter/util_test.go
```
## QA steps

See PRs


[JUJU-1129]: https://warthogs.atlassian.net/browse/JUJU-1129?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-1125]: https://warthogs.atlassian.net/browse/JUJU-1125?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-1119]: https://warthogs.atlassian.net/browse/JUJU-1119?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-1129]: https://warthogs.atlassian.net/browse/JUJU-1129?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-1157]: https://warthogs.atlassian.net/browse/JUJU-1157?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-1159]: https://warthogs.atlassian.net/browse/JUJU-1159?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-1129]: https://warthogs.atlassian.net/browse/JUJU-1129?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants