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

Merge 2.9 to 3.0 #15351

Merged
merged 49 commits into from
Mar 30, 2023
Merged

Merge 2.9 to 3.0 #15351

merged 49 commits into from
Mar 30, 2023

Conversation

hpidcock
Copy link
Member

@hpidcock hpidcock commented Mar 29, 2023

Forward ports from 2.9 + backport from 3.1 for pebble/plan + fix unused linter errors.

Back ports:

Forward ports:

Conflicts:

  • api/client/imagemanager/client_test.go
  • apiserver/facades/agent/caasapplication/mock_test.go
  • apiserver/facades/agent/uniter/uniter.go
  • apiserver/facades/client/application/mock_test.go
  • apiserver/facades/client/charms/client_test.go
  • apiserver/facades/client/client/client_test.go
  • apiserver/facades/client/cloud/cloudV2_test.go
  • apiserver/facades/client/modelmanager/shims.go
  • apiserver/facades/client/storage/storage.go
  • apiserver/facades/controller/remoterelations/mock_test.go
  • apiserver/mocks/resources_mock.go
  • apiserver/resources_mig_test.go
  • caas/kubernetes/provider/application/application.go
  • charmhub/refreshconfig.go
  • cmd/containeragent/main_nix.go
  • cmd/juju/action/package_test.go
  • cmd/juju/action/run.go
  • cmd/juju/action/showoutput.go
  • cmd/juju/application/bundle_test.go
  • cmd/juju/application/deployer/bundlehandler_test.go
  • cmd/juju/application/removeapplication.go
  • cmd/juju/application/removeunit.go
  • cmd/juju/application/resolved_test.go
  • cmd/juju/application/scaleapplication_test.go
  • cmd/juju/backups/backups.go
  • cmd/juju/caas/update_test.go
  • cmd/juju/charmhub/download.go
  • cmd/juju/charmhub/download_test.go
  • cmd/juju/commands/bootstrap_test.go
  • cmd/juju/commands/exec_test.go
  • cmd/juju/gui/gui.go
  • cmd/juju/gui/gui_test.go
  • cmd/juju/model/exportbundle.go
  • cmd/juju/romulus/sla/sla_test.go
  • cmd/jujud/agent/deploy_test.go
  • go.mod
  • go.sum
  • provider/azure/storage.go
  • provider/maas/maas2_test.go
  • provider/openstack/config_test.go
  • service/agentconf_test.go
  • state/backups/restore_test.go
  • state/upgrades_test.go
  • state/user.go
  • state/watcher/txnwatcher_test.go
  • worker/httpserver/cert_test.go
  • worker/proxyupdater/proxyupdater_test.go

ycliuhw and others added 30 commits March 8, 2023 13:30
This tool, given a model name or UUID, will examine each transaction
in the model's txn-queue field, test each operation's assertion, and
provide details regarding which assertions fail, what
insertions/updates would be performed, and what data already exists in
the database.  Its intent is to allow for more quickly reviewing
transaction queues to find patterns and root cause what might cause
transactions to pile up.
juju#15264

This PR fixes two issues failed migration for models with sidecar applications;
- https://bugs.launchpad.net/juju/+bug/2009566
- https://bugs.launchpad.net/juju/+bug/2008744

## Checklist

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing
- [] ~[Integration tests](https://github.com/juju/juju/tree/develop/tests), with comments saying what you're testing~
- [ ] ~[doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~

## QA steps

```sh
juju deploy prometheus-k8s --trust

juju deploy cs:~juju/mariadb-k8s-3

juju migrate k1:t1 k2
Migration started with ID "d2254384-b25c-492b-8e69-798f66e2821c:0"

```

## Documentation changes

No

## Bug reference

- https://bugs.launchpad.net/juju/+bug/2009566
- https://bugs.launchpad.net/juju/+bug/2008744
-
* Add removallog for user entries and permit to add previously removed users.
juju#15260

This tool, given a model name or UUID, will examine each transaction in the model's txn-queue field, test each operation's assertion, and provide details regarding which assertions fail, what insertions/updates would be performed, and what data already exists in the database. Its intent is to allow for more quickly reviewing transaction queues to find patterns and root cause what might cause transactions to pile up.

After discussion internally, it was suggested that I submit this tool for possible inclusion in the repository.

The tool does not contain any tests; I wrote and tested this against live databases. I may be able to add some tests but it may take me time as I am not currently assigned to work on this type of task.

----

## Checklist

*If an item is not applicable, use `~strikethrough~`.*

- [ ] Code style: imports ordered, good names, simple structure, etc
- [ ] Comments saying why design decisions were made
- [ ] ~~Go unit tests, with comments saying what you're testing~~
- [ ] ~~[Integration tests](https://github.com/juju/juju/tree/develop/tests), with comments saying what you're testing~~
- [ ] ~~[doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~~

## QA steps

Against a running Juju deployment, run the script (or its snap) as described in the README.
Updating Pebble to latest version to bring in tear down fixes.
juju#15272

Updates pebble to latest version.

Cherry picks PR juju#15234 

## Checklist

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing
- [x] [Integration tests](https://github.com/juju/juju/tree/develop/tests), with comments saying what you're testing
- [x] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages

## QA steps

Compile and bootstrap juju. Deploy a sidecar workload like snappass-test

## Documentation changes

N/A

## Bug reference

N/A
The following will attempt to download a charm of the suggested output
if there is one given. This is a simple crude implementation that looks
at the return from the suggested output before attempting another go.

This is really handy if a charm hasn't got the latest LTS support.

The code just recursively calls refresh again if there is a suggestion.
It lets the user know that the original series supplied wasn't supported
and is going to download the next series from the response. The code
ensures that we try the next one from the result set in an ordered
manor. We don't use the sorted by name for this occasion.

This should remove some of the pain points of juju download for users.
The following just updates the comment that states that we want to use
the latest/stable channels.
The following brings in the gomaasapi dependency that allows the
hardware info attribute to be optional. See the gomaasapi dependency for
more information[1].

  1. juju/gomaasapi#99
…y-suggested

juju#15300

The following will attempt to download a charm of the suggested output if there is one given. This is a simple crude implementation that looks at the return from the suggested output before attempting another go.

This is really handy if a charm hasn't got the latest LTS support.

The code just recursively calls refresh again if there is a suggestion. It lets the user know that the original series supplied wasn't supported and is going to download the next series from the response. The code ensures that we try the next one from the result set in an ordered manner. We don't use the sorted by name for this occasion.

This should remove some of the pain points of juju download for users.

## Checklist

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing

## QA steps

```sh
$ juju download ghost
```

Should output:

```sh
Suggested series "focal" is not supported, trying "xenial"
Fetching charm "ghost" using "stable" channel and base "amd64/ubuntu/16.04"
Install the "ghost" charm with:
 juju deploy ./ghost_808551b.charm
```

## Bug reference

https://bugs.launchpad.net/juju/+bug/1931738
juju#15312

The following brings in the gomaasapi dependency that allows the hardware info attribute to be optional. See the gomaasapi dependency for more information[1].

 1. juju/gomaasapi#99

## Checklist

- [x] Code style: imports ordered, good names, simple structure, etc

## QA steps

```sh
$ juju bootstrap maas test --build-agent
$ juju add-machine
$ juju deploy ubuntu
```

## Bug reference

https://bugs.launchpad.net/juju/+bug/2009064
[JUJU-3300] Fix docker build with new buildx that produces an incompatible image.
In JIMM we need to use the status formatter. The NewStatusFormatter is already exported, but the
format method (obviously) was not.
…er-export-format-method

juju#15317

In JIMM we need to use the status formatter. The NewStatusFormatter is already exported, but the format method (obviously) was not.

## Checklist


- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing

## QA steps

```sh
$ juju bootstrap lxd test
$ juju status
```
…reference added when migrating a model with cross model relations to another hosted model on the original source controller
juju#15320

If a source controller hosts consuming and offering models with a cross model relation, then migrating the consuming model to a new controller breaks because the model on the target controller now has relation(s) to an external controller (it previously was the same controller). But the migration process does not create the necessary external controller record.

Here we extend what the final model activate api call does - it is given the details of the source controller and any hosted models on that controller to which the migrated model has relations. This info is used to create the external controller record. We also need to ensure that any relevant remote application records has the source controller correctly set for reference counting purposes.

The migration target facade gets a version bump. We need to add a precheck so that if the target controller does not have the version needed, and there is an external controller record that would need to be created, the migration fails.

Also removed unused code.

## Checklist

- [X] Code style: imports ordered, good names, simple structure, etc
- [X] Comments saying why design decisions were made
- [X] Go unit tests, with comments saying what you're testing
- [ ] [Integration tests](https://github.com/juju/juju/tree/develop/tests), with comments saying what you're testing
- ~[ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~

## QA steps

bootstrap
add-model o
deploy juju-qa-dummy-source
offer dummy-source:sink
add-model c
deploy juju-qa-dummy-sink
relate dummy-sink o.dummy-source

bootstrap a new controller
migrate model c to new controller
check status

check logs on target controller to ensure no errors - previously the remote application worker would error
check the db to see that an external controller record is created and that the remote app has the source controller uuid set

## Bug reference

https://bugs.launchpad.net/bugs/2011662
Also fixes a few bugs with exported loop variables, the rest are to
silence the new linter, exportloopref.

Fixes a few errors picked up by ineffassign.
juju#15332

Also fixes a few bugs with exported loop variables, the rest are to silence the new linter, exportloopref.

Fixes a few errors picked up by ineffassign.

## QA steps

Run linters, unit tests, check the changes made.

## Documentation changes

N/A

## Bug reference

N/A
jujubot and others added 11 commits March 27, 2023 07:34
juju#15334

Re-add in a deadcode linter. Varcheck and Deadcode are replaced by Unused linter.

This picked up a lot of unused code and code that should have been used.

Depends on juju#15332

## QA steps

Unit tests.

## Documentation changes

N/A

## Bug reference

N/A
juju#15337

Fix missed snapcraft golang version to 1.20 (and to 1.19)

## QA steps

`snapcraft --use-lxd`

## Documentation changes

N/A

## Bug reference

N/A
These bits will be used in JIMM to format model statuses the same way.
…15324)

* When a user is removed we remove all the user accesses for the models the user is registered in that controller.
…er-export-params

juju#15344

We want to use the same formatter for model status. By exporting it here, it will save code duplication.

## Checklist

*If an item is not applicable, use `~strikethrough~`.*

- [*] Code style: imports ordered, good names, simple structure, etc
- ~~[] Comments saying why design decisions were made~~
- ~~[] Go unit tests, with comments saying what you're testing~~
- ~~[] [Integration tests](https://github.com/juju/juju/tree/develop/tests), with comments saying what you're testing~~
- ~~[] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~~

## QA steps

1. run `juju status`, make sure it works
2. run `juju status --format json`, make sure it works
3. run `juju status --format yaml`, make sure it works

## Documentation changes

N/A

## Bug reference

N/A
This includes the commits at
canonical/pebble@dfff363...054e5fb. Major
things:

* Revert move of plan package
* Add "ls" client command
* Add "mkdir" client command
* Improve README
* Add "current-since" field to services API and CLI
* Add "rm" client command
* Use strutil and randutil from x-go library
Conflicts:
- api/client/imagemanager/client_test.go
- apiserver/facades/agent/caasapplication/mock_test.go
- apiserver/facades/agent/uniter/uniter.go
- apiserver/facades/client/application/mock_test.go
- apiserver/facades/client/charms/client_test.go
- apiserver/facades/client/client/client_test.go
- apiserver/facades/client/cloud/cloudV2_test.go
- apiserver/facades/client/modelmanager/shims.go
- apiserver/facades/client/storage/storage.go
- apiserver/facades/controller/remoterelations/mock_test.go
- apiserver/mocks/resources_mock.go
- apiserver/resources_mig_test.go
- caas/kubernetes/provider/application/application.go
- charmhub/refreshconfig.go
- cmd/containeragent/main_nix.go
- cmd/juju/action/package_test.go
- cmd/juju/action/run.go
- cmd/juju/action/showoutput.go
- cmd/juju/application/bundle_test.go
- cmd/juju/application/deployer/bundlehandler_test.go
- cmd/juju/application/removeapplication.go
- cmd/juju/application/removeunit.go
- cmd/juju/application/resolved_test.go
- cmd/juju/application/scaleapplication_test.go
- cmd/juju/backups/backups.go
- cmd/juju/caas/update_test.go
- cmd/juju/charmhub/download.go
- cmd/juju/charmhub/download_test.go
- cmd/juju/commands/bootstrap_test.go
- cmd/juju/commands/exec_test.go
- cmd/juju/gui/gui.go
- cmd/juju/gui/gui_test.go
- cmd/juju/model/exportbundle.go
- cmd/juju/romulus/sla/sla_test.go
- cmd/jujud/agent/deploy_test.go
- go.mod
- go.sum
- provider/azure/storage.go
- provider/maas/maas2_test.go
- provider/openstack/config_test.go
- service/agentconf_test.go
- state/backups/restore_test.go
- state/upgrades_test.go
- state/user.go
- state/watcher/txnwatcher_test.go
- worker/httpserver/cert_test.go
- worker/proxyupdater/proxyupdater_test.go
@@ -540,6 +540,8 @@ type getUrlSuite struct {
apiHostPortsGetter *mocks.MockAPIHostPortsForAgentsGetter
}

var _ = gc.Suite(&getUrlSuite{})
Copy link
Member

Choose a reason for hiding this comment

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

\o/

cmd/juju/charmhub/download_test.go Show resolved Hide resolved
cmd/juju/charmhub/download.go Outdated Show resolved Hide resolved
cmd/juju/charmhub/download_test.go Show resolved Hide resolved
@juanmanuel-tirado
Copy link
Contributor

/build

@hpidcock
Copy link
Member Author

/merge

@jujubot jujubot merged commit cf87eae into juju:3.0 Mar 30, 2023
@manadart manadart mentioned this pull request Mar 30, 2023
jujubot added a commit that referenced this pull request Mar 30, 2023
#15402

Merge from 3.0 to bring forward:
- #15351
- #15382

Conflicts:
- api/client/usermanager/client_test.go
- apiserver/facades/agent/caasapplication/application_test.go
- apiserver/facades/agent/caasapplication/mock_test.go
- apiserver/facades/client/application/application_test.go
- apiserver/facades/client/charms/client_test.go
- apiserver/facades/client/modelmanager/modelinfo_test.go
- apiserver/facades/client/resources/base_test.go
- apiserver/facades/controller/remoterelations/mock_test.go
- apiserver/facades/controller/undertaker/mock_test.go
- caas/kubernetes/provider/bootstrap.go
- cmd/juju/application/deployer/bundlehandler_test.go
- cmd/juju/charmhub/download.go
- cmd/juju/charmhub/download_test.go
- go.mod
- go.sum
- provider/common/bootstrap.go
- provider/common/bootstrap_test.go
- state/charm.go
- state/migration_import.go
- state/upgrades_test.go
- state/user.go
- state/user_test.go
jujubot added a commit that referenced this pull request Mar 31, 2023
…_user_access

#15395

This PR ports the fix for the broken user access reported in #15351 and #15324 

## Checklist

*If an item is not applicable, use `~strikethrough~`.*

- [ ] Code style: imports ordered, good names, simple structure, etc
- [ ] Comments saying why design decisions were made
- [ ] Go unit tests, with comments saying what you're testing
- [ ] [Integration tests](https://github.com/juju/juju/tree/develop/tests), with comments saying what you're testing
- [ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages

## QA steps

Refer to #15324 for QA steps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet