[04:58] morning all [08:37] Morning everyone! So I'm working on a Kubernetes Charm with the new framework, and the docker image I'm using doesn't have python3 installed. How should I proceed if I want actions? What is the best practice of using actions with bash? Preferably i would install python on the pod each time I instantiate one, but don't know if thats possible. [08:48] mo'in! [08:50] Hi DominikF. You can do actions in bash, though the python framework obviously can't help you. [08:50] You could have a bash script that then installs python, but I'm not sure that fits with how people expect K8s pods to work [08:51] You could use the docker image as a base and build another image on top of it that *does* include python [08:53] jam: yes, I was thinking about something like that, what is your guys plan for this in the future? [08:54] jam: If I would do it in bash I would I just add an actions folder like in the previous charms? [08:58] DominikF, correct. even when using the framework, if you have an actions directory with scripts in there, the framework will call them. [08:59] DominikF, "plan for this". How to get python where you need it? [08:59] jam: yep [08:59] morning Chipaca [09:00] DominikF, so my recommendation would be to build a container based on the one you want that also includes python, as it seems the most k8s/docker consistent [09:03] jam: thanks, that clears up my doubts! Just wanted to make sure I'm doing it the right way as we are going to show this Charm in the next OSM Hackfest. [09:23] MarkMaglana: I'll reach out to you to get that k8s.py usable via the library/plugin mechanism, early next week [09:23] Chipaca: rock on! [09:24] MarkMaglana: great that you said it was yours, because that was my next task :) figuring out its origin [09:44] jam: wrt breaking changes, i'd like to at least talk about moving away from action-as-a-property [09:44] but that's a big one, we change that we break everybody :) [09:44] * Chipaca breaks the world [09:44] good movie, that [09:44] er [09:44] jam: i said action i meant status [09:45] Chipaca, ah, I was a bit confused and started looking at where action was a property. :) [09:45] Chipaca, the medium term discussion was that we could do both (have it as a property and as something you can set via method) [09:45] jam: and exceptions? [09:46] Chipaca, so in my head having exceptions have a status that will be set if they bubble up doesn't have to change *how* we set the status otherwies [09:47] jam: I meant: (drop charm.status and instead) have charm.set_maintenance(...) and charm.set_active(...) but raise Waiting() and raise Blocked() [09:49] (set_active is a bad name, but you get the idea) [09:50] this accomplishes, transparently, the "let me set these while running but only set these at the end", imho [09:51] and those same semantics via charm.status = … are super weird (again imho) [09:54] Chipaca, I think you should raise an exception to set Active status... clearly. :) [09:55] Chipaca, I like where you're thinking is going, I don't know that we "have to break everyone" to have that behavior, but we could certainly deprecate it, or just break it with a .X release. [10:10] jam: in any case we need to fix #278 :) [10:10] Issue #278: Unit.status not unit tested [10:10] * Chipaca gets on it [10:10] jam: dunno if you saw I moved #190 out of draft [10:10] PR #190: README: a significant rework [10:17] Chipaca, commented on 190 [10:26] jam: right back atcha [11:06] jam: should there be an 'invalidate' for _status? [11:07] or rather, should Application and Unit have _invalidate i guess [11:08] Chipaca, you're trying to invalidate what the status is? [11:08] jam: yup [11:09] it's cached very aggressively which means the call to status-get is hard to test for reliably :) [11:10] Muy buenos días a todos! [11:10] facubatista: 👋 [11:10] hola Chipaca [11:14] morning facubatista [11:14] hola jam [11:14] Chipaca, so status-get has always been a bit weird, because you're the one responsible for telling *us* what the status is [11:15] jam, let me know when you have a minute to continue (here) my eternal blog-apache talk, thanks [11:18] facubatista, just making coffee and then we can chat [11:18] great, thanks [11:19] Chipaca, i'm fine with an invalidate, I would just caution that I don't really want to ever change status 'behind the back' of the charm. [11:26] jam: i fear there's a bug [11:26] shocking i know [11:26] getting details now [11:26] Chipaca, no bugs, only opportunities for enlightenment [11:27] jam: the harnes's status_get returns the (status, message), or None [11:28] jam: and that's then used for StatusBase.from_name(s['status'], s['message']) [11:28] jam: neither tuples, nor None, are dicts :-) [11:29] Chipaca, indeed, status_set / status_get were certainly something I didn't test via Model [11:29] status_set is tested, in def test_local_set_valid_app_status(self): [11:29] Chipaca, I think it was something I threw together as a prototype, and then added tests, but of course, my tests conformed to my implementation, but not to the *contract* of status_get :) [11:29] status_get isn't because _status gloms the value [11:30] :) [11:30] jam: i'll fix [11:33] Chipaca, thanks for the catch [11:37] jam, so, what I did after my talk is to also register my `on_apache_relation_joined` method to the upgrade-charm hook, so I could work on it until I have it in good shape [11:37] of course, I don't have the relation from the event, so I just grabbed it from elsewhere [11:37] facubatista, sorry, I am back if you want to chat [11:38] so, I first tried this: relation_data = self.model.get_relation('apache').data['apache2'] [11:38] but I got a *** KeyError: 'apache2' [11:38] so I explored a little, and end up doing this: [11:38] relation_data = [v for k, v in self.model.get_relation('apache').data.items() if k.name == 'apache2'][0] [11:39] * facubatista waits for jam's horror scream [11:39] facubatista, it is an Application, not a string [11:39] facubatista, relation = self.model.get_relation('apache'); relation_data = relation[relation.app] would work [11:39] It isn't how I'd like to see in production code, but for testing things it seems ok [11:41] jam, it will give me the same thing I grabbed juggling with the code above, right? [11:42] facubatista, indeed, but means you can relate to something that isn't exactly named 'apache2' and have it continue to work [11:42] jam, why you wouldn't want it in prod? [11:43] facubatista, for x in y: if x.name == "apache2" [11:43] means you can only relate your charm to exactly an application named "apache2"A [11:43] if I do "juju deploy apache2 custom-apache" it will break [11:43] juju relate custom-apache facus-blog [11:44] will look for an object named "apache2"A but only find an object named "custom-apache" [11:45] jam, ah, I thought that you wouldn't want *your* code snippet in prod [11:45] of course, I wouldn't want that horrible listcomp from mine in prod either [11:46] so, let's move to your code [11:48] (fwiw, it would be easier to hook into relation-changed, and then use 'juju run --unit apache2/0 relation-set blah=1' to trigger relation-changed again) [11:48] jam, relation_data = relation[relation.app] --> TypeError: 'Relation' object is not subscriptable [11:48] facubatista, relation_data = relation.data[relation.app] [11:48] sorry, I left out an attr [11:50] jam, great, so I reached the same point that yesterday, which originated my question [11:51] facubatista, so you're able to trigger the code as you want? [11:52] jam, yes! and I set data in the relation, data, but then I get a: ops.model.RelationDataError: cannot set relation data for apache2 [11:53] jam, this is the method code and log relevant part, fwiw: https://paste.ubuntu.com/p/C82HRtdDtY/ [11:54] facubatista, relation.data[relation.app] is the data being sent by apache2 [11:54] to set data you need to [11:54] relation.data[self.app] [11:55] eg, set the data in *your* bucket, so that the other units can read the data you are sending. [11:59] so frustrated with this [11:59] I still feel it backwards [12:04] facubatista, you are telling apache about yourself, not telling it how it should be configured. [12:04] what happens when there are 3 different relations to apache, each one can't set apache directly [12:04] but, but... I DO want to tell it how it should be configured!! [12:04] they tell apache about themselves and apache responds [12:05] how it should be configured *regarding me*, of course [12:05] why would I want to tell apache how it would be configured regarding somebody else? [12:06] jam, how many "buckets" may we have in relation.data ? [12:07] facubatista, each unit and each app has their own bucket [12:07] jam, each unit/app in the whole system, or in the relation? [12:07] in the relation [12:07] so, always four? two on the other end of the relation, and two here? [12:09] facubatista, well, more if you have more than 1 unit on either ide [12:09] side [12:10] and in "this side" always two, right? [12:13] a given unit will have its data bucket which it can read/write. and it can read other units data, and the remote app data [12:13] if it is the leader, it then also gets to read/write its app data bucket [12:20] Chipaca, I've tested #283 with Juju 2.7 and 2.8 and a couple permutations of symlinks vs shell scripts [12:20] PR #283: ops/main: handle dispatch being a shim [12:20] I think we should probably land it, but it doesn't handle Juju 2.7 and hooks/install is a script [12:20] (it thinks it is being invoked as dispatch but no JUJU_DISPATCH_PATH is set) [12:20] I'm not sure if we *can* support that case [12:26] jam, is this accurate? https://docs.google.com/document/d/1EXXsHXOb3ECAev-M2M2IIljnWgXEenrX2g86b57Wwwo/edit (feel free to edit to improve wording) -- thanks!! [12:27] facubatista, "how the other end presents to you", "what the other end is presenting to you" might be clearer, [12:27] but yes, looks correct to me [12:28] clearer how? I think being as precise as possible there improves the value, I was vague, but because I lack deep understanding of that point exactly [12:35] It feels like it is clearer English. [12:35] "Virtual host templates can also be specified via relation. See the vhost-config relation section below for more information." <-- aja! I'm setting the data in the wrong relation [12:36] " A candidate charm should provide a relation on the apache-vhost-config interface." ... /me adds a "provides" in blog's metadata yaml [12:38] facubatista, apache-website docs say "site_config- A vhost configuration block" [12:39] jam, yeap [12:40] jam, I'm setting this: https://paste.ubuntu.com/p/QhhFd3w4KH/ [12:40] (but IIUC in the wrong relation) [12:42] looking at https://api.jujucharms.com/charmstore/v5/apache2-35/archive/hooks/hooks.py it looks to write out a file into sites_dir/name.conf containing the vhost config [12:44] jam, you're cheating looking at the apache's charm source code, if we want wide adoption the docs should be clear enough :p [12:45] facubatista, I'm not trying to fix legacy/reactive charms just yet. [12:45] I don't disagree, but that is future world [12:45] jam, note that there are two ways of setting the config [12:45] jam, one through a config change, other through the vhost relation, which allows to be set *from the subordinate charm* [13:05] facubatista, can you look at #264 again? I think I cleaned up the merge. [13:05] PR #264: test/test_model.py: Test Model using Harness._get_backend calls [13:05] jam, will do, yes [13:06] thx [13:18] Chipaca, I was wrong, Enum defaults to a nice way of seeing the value: [13:18] >>> Relations = enum.Enum('Relations', 'PEER PROVIDES REQUIRES') [13:18] >>> str(Relations.PEER) [13:18] 'Relations.PEER' [13:18] PR operator#284 opened: ops/model: cover app.status and unit.status better [13:18] facubatista, internally they are still ints, though. right? [13:18] (if you do repr() you will see the underlying int... but you can also define the internal values as the same string, which I'm not sure it's needed) [13:19] jam, they're by default, yes [13:19] Chipaca is trying to make it look like he was working today instead of just galavanting around in his backyard [13:19] jam, galavanting? [13:19] * Chipaca gallivants with flair [13:19] "go around from one place to another in the pursuit of pleasure or entertainment." [13:20] "less common spelling of gallivant" [13:20] just misspelled :) [13:29] jam, +1 to 264, please see the comment, thanks! [14:11] jam: i'm going to emulate the "2.7 with dispatch and hooks/install not a symlink" by also supporting "no dispatch and hooks/install not a symlink" directly (which i think master supports) [14:12] Chipaca, so hooks/install as a script works if you set JUJU_DISPATCH_PATH, but 2.7 won't be setting that [14:13] which is the thing we need to fix [14:13] yep yep [14:13] "no dispatch and hooks/install is a script and no JUJU_DISPATCH_PATH" sounds great [14:19] So it seems that since ops is part of 'github.com/canonical' we end up getting serialized in travis with all other Canonical projc.ts [14:36] good meeting! glad i could help! [14:36] MarkMaglana, :) [15:35] jam: i didn't realise you were still around, i pushed the signature fix to 264 for you [15:35] Chipaca, I stopped by to check on the progress, and was pleased to see that you fixed my bug for me [15:35] jam: now travis is being travis [15:35] Chipaca, not really around :) Just trying to follow up on my PR before the weekend [15:35] it just started mine again [15:37] Chipaca, from what I can tell, Travis will only let 2 jobs from 'canonical' run, and multipass has a 2hr job [15:38] jam: the limit is 5 simultaneous workers, for free tier users [15:39] Chipaca, clearly that isn't the number they are actually running [15:39] jam: 264 now green fwiw [15:39] Chipaca, yeah, I'm writing the commit now [15:40] jam: per organisation? i see 3 in use for cloud-init right now for example [15:41] Chipaca, ah, I only see 1 "job" but it is a top level job. I guess it is indivi [15:41] sub jobs that are limited to 5 [15:41] yeah, by workers i meant the vms [15:42] you can limit it to less than 5 to be fairer within the org [15:42] or you can pay them :) [15:42] landed #264 [15:42] PR #264: test/test_model.py: Test Model using Harness._get_backend calls [15:43] woop woop [15:43] PR operator#264 closed: test/test_model.py: Test Model using Harness._get_backend calls [16:28] jam, pushed another version of charmcraft#1 and answered all conversation [16:28] s [16:28] PR charmcraft#1: Charmcraft tool base skeleton [16:53] facubatista: thanks for the review on 190, i've commented out the TBD links [16:57] Chipaca, in #283 I'm really confused about "legacy"... you wrote a "run_any_legacy_hook" method that starts working with "dispatch" (which is not a legacy hook, right?), and if dispatch is not there, it's looged like "Legacy is not there" [16:57] PR #283: ops/main: handle dispatch being a shim [16:57] Chipaca, mind to explain that a little to me? thanks! [16:58] facubatista: say you have a charm running under 2.8 [16:59] facubatista: and your charm has a dispatch file [16:59] facubatista: and your charm also has hooks/install [16:59] facubatista: juju will see the dispatch file and call it, ignoring all hooks/* guff [16:59] yes [17:00] facubatista: it is dispatch's responsibility to call the legacy hooks/install file [17:00] yes [17:00] facubatista: the end [17:00] not the OF [17:00] facubatista: not the OF? [17:00] ah, the operator framework [17:00] facubatista: what do you mean, not the OF? [17:02] mmm... I was expecting that if the developer put a dispatch file, and still wanted her hooks/* scripts to be called, that she would handle that in the dispatch file [17:03] but yes, we could handle that [17:03] and put a dispatch that is a symlink to the source, and we'll make the hooks/* to be called [17:03] facubatista: that is already supported [17:03] if she doesn't want the hooks/* to be called after setting the dispatch file, she can remove them [17:04] facubatista: this is about dispatch being a shim that still calls us, we still need to do this -- or the shim does, but we want the shim to be minimal [17:05] facubatista: for a custom dispatch all they need to do is unset the appropriate variable [17:05] facubatista: and everything would carry on as before :) [17:05] unset which variable? [17:05] MAKE_FACUNDOBATISTA_GREAT_AGAIN [17:06] facubatista: or maybe JUJU_DISPATCH_PATH [17:06] facubatista: if JUJU_DISPATCH_PATH is unset by dispatch, and they then execute e.g. hooks/install (that's a symlink to src/charm.py), it'll Just Work (tm) [17:07] yes [17:07] facubatista: anything else i can answer? otherwise i'm going to eod [17:08] Chipaca, I need to see this with fresher eyes, no worries [17:08] i can mail you one of my son's eyes [17:08] i'm sure they won't mind [17:08] they've got, like, four of them [17:39] each?? :p [19:07] facubatista: yours dont?!? [19:08] Chipaca, nop, only two eyes per kid... shall I ask for a rebate? [20:03] facubatista: are you sure they're not halflings? [20:04] * facubatista checks in the kids documentation [20:30] * facubatista is out [20:35] facubatista: take care [20:35] i too should wrap [20:35] Chipaca, hasta mañana [20:35] facubatista: disfrute