Can a bundle define a model?

Today we received this question from IRC. My understanding is that bundles are collections of pre-existing charms. Is that interpretation correct?

* cloaked1 (~cloaked1@unaffiliated/cloaked) has joined
<cloaked1> Is there a way to create a bundle with multiple models within it
<cloaked1> or better question, is there a way to define multiple models within a bundle?
<cloaked1> can a bundle define a model at all actually. As far as I can tell, the answer is no based on the documentation I've read so far. However, I've also noticed that the documentation doesn't fully cover everything.

As written today, a bundle cannot span models. I think there is some limited support for cross model relations, but generally a bundle is considered a self-contained description of a group of applications working together.

1 Like

Iā€™ve always wanted to get to a point where a model, including model-config and such could be defined such that you could really make a model repeatable, but itā€™s not very sharable at that point because youā€™re getting so much environment (what networks, proxies, etc) specific details into it that it starts to feel like a different thing.

Across models seems strange though I guess in a CMR sense thatā€™s actually getting to be interesting as you need a few models, in concert, to provide the end working solution. I do think that the idea of CMR was that youā€™d have services running though and youā€™d not typically be the same person setting up each model though things like testing/dev come into play here.

1 Like

Is there a way to export model config and making them importable at least? That way you could do juju deploy with - - config modelconfig.yaml

Not at this time. Thereā€™s a tricky bit in that more than one bundle can go into a model so itā€™s something weā€™ve not solved with how that might fail/update values and such.

Wow, this was fun to see that my question in IRC made it here (Iā€™m cloaked1). Additionally, I created an issue (before the IRC question) which ended up leading me here anyway: https://github.com/juju/docs/issues/3473

OK, So with all that Iā€™ve read here, and other sources of docs Iā€™ve been able to glean, let me see if I understand fully.

One cannot, currently, create bundles that span models. Models are the only way (AFAICT) to define machines (things like tagging and cloud-init, which my current project requires), and one can do cross-model relationships, but it sounds like the whole thing is manual for now. Does that sum it up?

OK, so hereā€™s what I need to accomplish:

  1. I absolutely must be able to run cloud-init configuration of machines for k8s masters, k8s-workers, unless thereā€™s a way using the canonical-k8s charm to install helm and set some RBAC roles during instantiation.
  2. I need to tag machines with what they are doing as a requirement of the project Iā€™m working on so that if a machine is ā€˜kubernetes-masterā€™ then I want to tag it as ā€˜kubernetes-masterā€™ or any arbitrary tagging if we so desire.

For now, thatā€™s what I can remember my needs so far. What are your thoughts?

What platform are you deploying onto? MAAS supports tagging and such, but Iā€™m curious what youā€™re looking for as a tagging setup.

The machines are NUCs. The distribution is Ubuntu. Weā€™re deploying the canonical-k8s charm with a mildly (currently) altered bundle.yaml. Itā€™s within the bundle where Iā€™d love to be able to tag machines, which seems impossible.

Iā€™d recommend using annotations as an arbitrary tag mechanism.

You can specify machine annotations in the bundle, but the CLI isnā€™t good at getting you these annotations out and visible very easily just yet.

Annotations are globally namespaced, so if you were going to use them, Iā€™d recommend a key more like ā€œproject.tagā€ where ā€œprojectā€ is meaningful to you.

So the question I have about this idea is the context of ā€œglobal namespacing.ā€ I read that to mean that the same annotation(s) getting placed on each machine in use IE if I use an annotation of ā€œkubernetes-masterā€ then every machine will get that annotation instead of just the kubernetes-master hosts. That is counter-intuitive to what Iā€™m trying to accomplish. So it sounds like tagging the machines will have to be done manually for now. Sound about right?

Yes there is no auto tagging, nor actually a CLI for dealing with annotations. I did play with a plugin.