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.