-
Notifications
You must be signed in to change notification settings - Fork 508
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
Ensure we validate the model target #12888
Conversation
514535c
to
21cf773
Compare
Combined with #12881: $ juju deploy ambassador |
Instead of using the charm URL, which will be wrong for bases, instead use only the metadata. The metadata will always be right! So the following code changes what the purpose of this validate code, from catching a non container on a container work load. We drop the series check because we validate that check in other places.
The following fixes tests where it was wrong to assume that you could craft your way through adding a charm or an application if you didn't know the series.
21cf773
to
b885f3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better.
We're looking sweet now.
On LXD:
$ juju deploy hello-juju
located charm "hello-juju" in charm-hub, revision 6
deploying "hello-juju" from charm-hub charm "hello-juju", revision 6 in channel stable
$ juju deploy ambassador
located charm "ambassador" in charm-hub, revision 13
deploying "ambassador" from charm-hub charm "ambassador", revision 13 in channel stable
error cannot add application "ambassador": container base charm for non container based model type not valid
$ juju deploy facundo-snappass-test
located charm "facundo-snappass-test" in charm-hub, revision 3
deploying "facundo-snappass-test" from charm-hub charm "facundo-snappass-test", revision 3 in channel stable
error cannot add application "facundo-snappass-test": container base charm for non container based model type not valid
On Microk8s:
$ juju deploy facundo-snappass-test
Located charm "facundo-snappass-test" in charm-hub, revision 3
Deploying "facundo-snappass-test" from charm-hub charm "facundo-snappass-test", revision 3 in channel stable
$ juju deploy ambassador
Located charm "ambassador" in charm-hub, revision 13
Deploying "ambassador" from charm-hub charm "ambassador", revision 13 in channel stable
$ juju deploy hello-juju
Located charm "hello-juju" in charm-hub, revision 6
Deploying "hello-juju" from charm-hub charm "hello-juju", revision 6 in channel stable
ERROR cannot add application "hello-juju": non container base charm for container based model type not valid
Everything quiesced as expected.
@@ -272,9 +272,19 @@ func addTestingApplication(c *gc.C, params addTestingApplicationParams) *Applica | |||
return app | |||
} | |||
|
|||
func addCustomCharm(c *gc.C, st *State, repo *charmrepotesting.Repo, name, filename, content, series string, revision int) *Charm { | |||
func addCustomCharmWithManifest(c *gc.C, st *State, repo *charmrepotesting.Repo, name, filename, content, series string, revision int, manifest bool) *Charm { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is testing infra, but the options pattern starts to loo attractive here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but I don't think we have much option as this stuff is just getting silly now. The code in question tests that the charm loaded is kubernetes, but then uses a totally different metadata. I'm kinda thinking that most of this code should be nuked from up high.
Both CAAS and IAAS should not be leaked outside of Juju, so don't do it in an error message.
The following ensures that we don't allow --series kubernetes from happening during a deployment.
Adding the correct tests for CAAS for IAAS, previously the code was written by forcing or cheaking the CAAS charm onto a IAAS model. This was wrong, badly wrong, instead we should have a test for just CAAS and IAAS. I'm deeply concerned that this happens more than it should, even the way you create a IAAS model is baked in (conn suite), but CAAS is very much an after thought and there are no symmetrical versions for CAAS.
Issues where the charm was missing have been fixed.
We ALWAYS require series for kubernetes in the metadata, so ensure the tests handle that.
|
#12898 Here, we remove usage of the _systems_ package for determining: - A base for the provisioning info series. - A charm-base OCI image from the base. Instead of `systems.ParseImageFromBase` we determine the OS and version using the _series_ package, and from the construct a `charm.Base` now expected by `ImageForBase` When #12888 lands, there should by no further need of the _systems_ package. ## QA steps - Update your MicroK8s operator image. - Bootstrap and add a model. - `juju deploy facundo-snappass-test` should complete without error. ## Documentation changes None. ## Bug reference N/A
#12909 Merge 2.9 #12827 Unsubscribe from hub when closing state pool #12829 Correct default bootstrap-timeout value displayed in help. #12840 Constraint tags can be used for pod affinity #12842 Fix upgrade series agent version handling #12794 Add disk provisioning customization #12845 Restore space support for manual machines #12839 Support merging of netplan configs #12853 Add display type for network-get results #12854 Fix for LP1921557 sni in Juju login. #12850 Use Base in Charmhub packge and its response structures. #12858 Ensure assess-upgrade-series does not report started prematuremly #12860 Removed logging from core annotations. #12861 Fixes bug where empty error can happen in storage #12865 Update Pebble version to include new files API #12866 Workaround for k8s dashboard URL with k8s client proxy #12862 Fix/lp 1923051 #12867 Fix/lp 1923561 #12870 Use channel logic in charm library #12873 Add support for setting pod affinity topology key #12874 Use Patch instead of Update for ensuring ingress resources #12831 Integration fixes #12879 Ensure refresh uses version #12864 bug: fix for bootstrap fail on vsphere 7 + multi network #12883 Initial work to allow juju trust for sidecar charms #12884 Fix ssh with sidecar charms and containers. #12886 Charmhub bases #12881 Use charm pkg updates #12889 Ignore projected volume mounts when looking up juju storage #12890 Fix passing empty string container name to unit params #12893 Add CLA checker GH action and remove codecov push action #12897 Use production charmhub endpoint #12887 Resource validation error #12888 Ensure we validate the model target #12898 Remove usage of systems package from CAAS application provisioner #12899 CAAS bundle deployments #12900 Bump up Pebble version to include user/group in list-files #12901 charm Format helper #12902 charm Iskubernetes helper #12903 Display ... for really long k8s app versions in status #12904 Filter out more full registry paths for app version in status #12905 Fix k8s bundle deploys with v2 charms #12906 Register resource-get for containeragent binary Conflicts mostly due to charm v8 vs v9 imports. The other one was due to changes to dashboard CLI. ``` # Conflicts: # api/common/charms/common.go # api/common/charms/common_test.go # apiserver/facades/client/application/application.go # apiserver/facades/client/application/charmstore.go # apiserver/facades/client/application/update_series_mocks_test.go # apiserver/facades/client/charms/client.go # apiserver/facades/client/charms/convertions.go # apiserver/facades/client/machinemanager/types_mock_test.go # apiserver/facades/controller/caasoperatorprovisioner/provisioner.go # cmd/juju/application/deployer/bundlehandler_test.go # cmd/juju/application/refresh_test.go # cmd/juju/application/refresher/refresher_mock_test.go # cmd/juju/dashboard/dashboard.go # core/charm/strategies_mock_test.go # core/model/model.go # core/model/model_test.go # go.mod # go.sum # resource/resourceadapters/charmhub.go # scripts/win-installer/setup.iss # service/agentconf_test.go # snap/snapcraft.yaml # state/charm.go # state/migration_export.go # state/state.go # version/version.go # worker/caasfirewallerembedded/applicationworker.go # worker/caasfirewallerembedded/applicationworker_test.go ``` ## QA steps See PRs
Instead of using the charm URL, which will be wrong for bases, instead
use only the metadata. The metadata will always be right!
So the following code changes the purpose of this validate code,
from catching a non-container on a container workload. We drop the
series check because we validate that check in other places.
QA steps
$ juju bootstrap lxd test $ juju deploy hello-juju