Thursday, 2025-07-24

noonedeadpunkI kinda also don't like this spoecial handling much - I somehow thought that we agreed on special "standalone" case for user-provided certs, but I was not following too closely tbh05:12
jrosserI think this is actually quite simple05:44
jrosserlike filter out everything from the install list that defines “src” and exclude it from the chosen backend05:44
jrosserthen as a last step filter again choosing only the things with “src” defined and use something like the copy task that we already have05:46
jrosserthat’s what I meant by having some sort of shortcut for user defined certs05:48
jrosserand a probably actually mean filter of values of “src” that are truthy05:48
noonedeadpunkand then we can make `neutron_pki_backend: "{{ openstack_pki_backend | default('standalone') }}" pretty much? 06:35
noonedeadpunkas this probably does not address one-for-all catching?06:35
noonedeadpunkbut then thinking about it....06:36
noonedeadpunkWhy do we even have that complex condition at the first place....06:37
noonedeadpunkAs `neutron_pki_backend` is the new variable we introduce, which defaults to `standalone`06:37
noonedeadpunkso if there is neutron_user_ssl_cert/neutron_user_ssl_key - we don't need to actually pick anything ,rather then leave a default06:38
noonedeadpunkbut also the condition should still be implying the filter you're talking about?06:50
noonedeadpunkas regardless of user cert or not - it's same "standalone" backend?06:50
noonedeadpunkso there should be the filter in pki anyway I'd guess06:51
jrosserI think my suggestion is that independent of backend there is just special handling/filtering for things that define a value for “src”06:59
jrosserthen that would simplify handling of user defined certs across all the roles07:00
jrosserwhen it might be that a role has a mix of standalone/pki/acme/whatever backends and perhaps just one of them is user supplied07:00
jrosserfeels simple and flexible rather than building logic into all the role default vars for this07:01
noonedeadpunkjust to double check - we're talking about logic for `neutron_pki_backend` in https://review.opendev.org/c/openstack/openstack-ansible-os_neutron/+/949420/4/defaults/main.yml#698 right?07:03
noonedeadpunkas this is not what it's doing07:03
noonedeadpunkas what it's doing is kinda noop, imo....07:03
noonedeadpunkit does not seem to replace src filtering inside of pki role in any way07:04
noonedeadpunkso what you're saying still have to exist with it, I'd guess07:04
noonedeadpunkand what it's doing, is to try to override the openstack_pki_backend if it's defined, if user certs exist07:05
noonedeadpunkso if you set `openstack_pki_backend: vault` but have user keys - user keys would have precedence07:06
noonedeadpunkand I don't think we need that logic at all07:06
noonedeadpunkas what you're describing seems to be implemented in https://review.opendev.org/c/openstack/ansible-role-pki/+/954239/17/tasks/main_certs.yml right?07:08
jrosseryes but I think we lose that in the later patches08:08
jrossersee in particular the difference between my example changes to os_glance and Damian’s to os_neutron08:08
noonedeadpunkok, I guess I was not reviewing all of them, and focused only on some "starting" points08:08
jrosser954239 is not sufficient for multiple backends + flexible handling of user supplied certs08:12
jrosserI think another modification is needed on top to generalise that case08:12
noonedeadpunkyeah, could be08:13
jrosserI’m travelling/in the datacenter this week so can’t look much at the actual code08:13
noonedeadpunkbut also I don't see too much difference in os_glance and os_neutron patches to be frank08:13
noonedeadpunkit's that os_neutron just covers all changes for vault support in a single patch08:13
noonedeadpunkinlcuding changing of san format and supplying backend with certs08:14
noonedeadpunkand type of the installable thing08:14
noonedeadpunkoh, type is actually in glance as well08:15
jrosserright - I had hoped that the glance patch would also be totally valid for the vault backend08:16
jrosserwhich is why so much discussion about group vars08:16
noonedeadpunkI commented today somewhere, that group_vars does not always work. For example - imagine HCI metal environment08:17
noonedeadpunkbut also - if you want different cert types for qemu/libvirt and ovn-controller08:18
noonedeadpunkI'm not sure there is a valid usecase for this thing though08:18
noonedeadpunkand we really can discuss if different backends should be even supported for deployment08:19
noonedeadpunkbut I don't have much against having per-role backend defenition in defaults08:19
damiandabrowskihello, ouh, seems like a lot of things were raised in the morning :D 08:20
noonedeadpunkbut the ternary logic there is not needed at all08:20
noonedeadpunkimo08:20
damiandabrowskiwe need to support multiple backends because hashi_vault cannot handle everything08:21
noonedeadpunkoh, rly?08:21
damiandabrowskioctavia is an example, where we have octavia CA and sign new certs with it08:21
noonedeadpunkdoes it have to be an own CA?08:21
noonedeadpunkas I think we made that more for backwards and upgrade compatability?08:22
noonedeadpunkIt might make sense for it to be own intermediate - sure08:22
noonedeadpunkjrosser: and then the second obvious difference to me, is san format - which is changed from string to dict08:23
damiandabrowskiyou need to store private key of the CA(or intermediate) on octavia_server to sign certs for amphora08:24
noonedeadpunkand, to be fair, dict kinda makes more sense in terms of how to operate it08:24
noonedeadpunkand it's easier to make some kind of combine/overrides in place for it?08:24
noonedeadpunkoh, ok, right08:26
jrosserthe san format change is fine yes, really thats just another patch stacked on top which my os_glance change does not account for08:54
jrosserand yes i think i'm trying (badly) to say that a filter in the pki role is better for handling the user supplied cert than a complex condition in the role defaults08:55
noonedeadpunkjrosser: so the thing is, that if you're talking about condition in neutron_pki_backend - I don't think it serves *any* purpose. it's just not needed anywhere, as it covers the usecase which does not exist kinda.09:29
noonedeadpunkwith that we likely need to have neutron_pki_backend per role as group_vars not always a solution09:31
noonedeadpunkso I think we should be able to do that without anything else https://paste.openstack.org/show/bzZltLWD67szrJ0hTUvb/09:32
noonedeadpunkor are you talking about smth completely different?09:33
noonedeadpunkas I have feeling we;'re talkign about different things, but I don't see anything else too much related :D09:36
damiandabrowskiokay, let's start from beginning - why you think that the condition in neutron_pki_backend does not serve any purpose?09:38
damiandabrowskilet's imagine that openstack_pki_backend: hashi_vault, but for neutron user wants to provide user-defined cert with neutron_user_ssl_cert09:38
damiandabrowskihow would you handle this case, assuming that hashi_vault backend cannot handle user-defined certs?09:39
noonedeadpunk`neutron_pki_backend: standalone`?09:41
noonedeadpunkThis logic would make sense, if we had to care about backwards compatability in this case.09:42
noonedeadpunkBut the thing is, that openstack_pki_backend is the new variable we're introducing09:42
noonedeadpunkSo for upgrades current behavior is preserved09:42
noonedeadpunkAnd then if anyone needs to make a concious decision to override globally the backend - they can do it09:43
noonedeadpunkBut then they should also think about their custom certs if they have one09:43
noonedeadpunkas migration from standalone to vault should be thought through and planned anyway, imio09:44
noonedeadpunkalso ` but for neutron user wants to provide` clearly states that's a specific case for a specific role. So I don't see why they would not need to also override neutron_pki_backend in this case, given they explicitly defined a global openstack_pki_backend09:45
noonedeadpunkthat's why I think that this logic basically overthinking and not needed in fact09:46
noonedeadpunknot saying that I have no idea if anybody uses user-provided certs for anything rather then haproxy...09:47
jrossermy change for using names in the pki role is not compatible with `is defined` for user defined certs09:48
damiandabrowskiokay, so in this case, we're okay with user having to manually override neutron_pki_backend - I'm fine with that09:48
damiandabrowskiI'm just trying to say that login in neutron_pki_backend had some purpose, we may just not need it :D09:49
noonedeadpunkI think it's more then fair expectation in this circumstances09:49
damiandabrowskilogic*09:49
noonedeadpunkI'd say it totally would be needed if we were changing the default backend to vault, for instance09:50
noonedeadpunkbut yeah09:50
noonedeadpunkjrosser: I still kinda feel that either we are talking about different things or there is some misconception of what this condition is. as it does not substitute nor relate to the need of filtering on PKI side09:51
noonedeadpunkas it's really jsut to be smart about backend selection and have precedence over global openstack_pki_backend when user cert is defined as a var09:52
jrossersorry /o\09:52
noonedeadpunkOr I am completely missing smth else09:53
jrosserhttps://review.opendev.org/c/openstack/openstack-ansible-os_glance/+/954269/9/defaults/main.yml09:57
jrosseri made those vars always defined but empty09:57
jrosseranyway i think we're all talking about slightly different things and it's not particularly productive09:58
jrosserimho having the external interface to the pki role not be tangled up with a specific implementation is most important09:58
noonedeadpunkright09:59
noonedeadpunkI totally agree here09:59
noonedeadpunkthough I guess src even in glance patch is somehow tangled with standalone, unless we do some "user" backend which will just install certs?10:00
noonedeadpunkand then we can pass path to the cert as a name kinda...10:01
noonedeadpunkand don't have src as a unique parameter10:01
noonedeadpunkor, document directory structure for user-provided backend10:01
jrosserso my whole idea was to make it so that defining a value for the user defined cert rather than '' made it get installed from that path10:02
jrosserthe user didnt have to understand how10:02
jrosserbut also at the same time not put logic about specific backends into the service role defaults10:02
noonedeadpunkok, sure ,we can do that as well10:02
noonedeadpunkI just don't see a logic in https://review.opendev.org/c/openstack/openstack-ansible-os_neutron/+/949420/4/defaults/main.yml except `neutron_pki_backend` which I think we've addressed?10:04
noonedeadpunkas these patches are super simmilar to me, excpet this var10:04
noonedeadpunk(and san and passing backend explicitly)10:04
noonedeadpunksan we agreed that is good, right?10:05
noonedeadpunkand passing backend I find necessary as group_vars might not be enough as it's not always scoping things good enough10:06
noonedeadpunkso I think we are pretty much aligned then, no?10:08
damiandabrowski1. passing `neutron_pki_backend` may not be necessary if we accept the fact that overriding backend for a single role would require overriding *_pki_certificates and *_pki_install_certificates.10:15
damiandabrowskiI think we may accept it considering the fact that doing this(changing backend for a single role) is quite rare thing to do10:16
noonedeadpunknot for octavia, right? 10:16
noonedeadpunkand then we would be back to user certs kinda10:17
damiandabrowskibut for amphora certs we don't rely on octavia_pki_backend10:17
damiandabrowskiwe just statically define: backend: standalone10:17
damiandabrowskihttps://review.opendev.org/c/openstack/openstack-ansible-os_octavia/+/94941910:17
damiandabrowskiso it's fine10:18
noonedeadpunkimo, <service>_pki_backend is reasonable to have10:19
noonedeadpunkit's still a common interface thing for the role.10:19
damiandabrowskiI don't have a strong opinion here, we can keep it10:19
noonedeadpunkand again - user certs10:21
noonedeadpunkso to have aa user cert - they need to override <service>pki_install_certificates10:21
noonedeadpunkwhich can be problematic for upgrades10:22
damiandabrowskiwhat is "aa user cert"?10:22
noonedeadpunk`neutron_user_ssl_cert `10:23
noonedeadpunkor well, you filter in role, if src is defined - then use standalone?10:24
noonedeadpunkThis is what jrosser you meant? ^10:24
damiandabrowskiah yes, keeping  `<service>_pki_backend` would help to avoid overriding the whole *_pki_install_certificates10:24
damiandabrowskichoosing pki backend based on src won't work for hashi_vault10:25
damiandabrowskibecause src is only specified in *_pki_install_certificates, while neutron_pki_backend is used also in *_pki_certificates10:25
damiandabrowskihttps://review.opendev.org/c/openstack/openstack-ansible-os_neutron/+/949420/comment/870da622_215b554f/10:25
noonedeadpunkyeah, ok, right10:26
noonedeadpunknow I understand this convo more10:26
noonedeadpunkso I don't see why having <service>_pki_backend is really problematic10:26
noonedeadpunkas group_vars are not fine-grained control of this var and might have very unexpected behavior10:27
noonedeadpunkwhen service partially would be served by diferent backends10:27
noonedeadpunkdamiandabrowski: we had a variable somewhere to disable cert generation, right?10:29
noonedeadpunkhttps://review.opendev.org/c/openstack/openstack-ansible-os_glance/+/954269/9/tasks/main.yml10:29
noonedeadpunkso, if we refactor this condition a bit, then choosing pki backend based on src will work for hashi_vault10:30
noonedeadpunkas we don't care about pki_certificates if pki_create_certificates is false10:31
damiandabrowskiDidn't we just end up right where we started? :D 10:38
damiandabrowski1. Idea: move the logic from `neutron_pki_backend` to the pki role(to fallback to standalone backend when `src` is defined)10:39
damiandabrowski2. Decision: it's okay to let users override `neutron_pki_backend` when they want to use user-defined certs10:39
damiandabrowski3. Idea: Refactor other condition in service role logic, to dynamically fallback to standalone backend when user-defined cert is used10:39
damiandabrowski3. contradicts with the original idea 1. of fully moving the logic to pki role10:39
noonedeadpunkI was just saying that chosing backend on src is possible :)10:41
noonedeadpunkand we still need to have pki_create_certificates logic in place10:42
noonedeadpunkBut, I kinda in favor of explicitly supplying backend per role instead of detecting in inside of pki based on data10:42
noonedeadpunkdamiandabrowski: one thing though, is that potentially we don't need to supply `backend` in pki_install_certificates or whenever - we can pass it to the pki role directly in all cases except octavia?10:45
noonedeadpunkbut then anyway backend defined for cert is having precedence over generic one I guess10:45
noonedeadpunkdamiandabrowski: moreover, you already do that: https://review.opendev.org/c/openstack/openstack-ansible-os_neutron/+/949420/4/tasks/main.yml10:50
noonedeadpunkso what's the purpose of `backend: "{{ neutron_pki_backend }}"` in _pki_certificates ?10:51
noonedeadpunkso I think this:10:54
damiandabrowskihmm, let's clarify if we're talking about _pki_certificates or _pki_install_certificates :D 10:55
noonedeadpunkboth10:55
noonedeadpunk1. drop complexity for neutron_pki_backend10:55
noonedeadpunk2. drop backend in certs stanza when it's absolutely needed (Octavia) in favor of include-wide var (as it's same anyway)10:56
noonedeadpunk3. almost profit?10:56
damiandabrowskimaybe you're right and defining backend in _certificates and _install_certificates is reasonable only when its value is different than pki_backend10:58
damiandabrowskiI'll test it today10:58
noonedeadpunkI would expect it to be the case, otherwise it could be a bug somewhere11:19
noonedeadpunk3. adjust pki_create_certificates condition to respect _user_ssl_cert being in defaults11:20
opendevreviewDmitriy Rabotyagov proposed openstack/openstack-ansible master: [doc] Use ${REINSTALLED_HOST} env var for OS re-deployment guide  https://review.opendev.org/c/openstack/openstack-ansible/+/95581116:59
opendevreviewDamian Dąbrowski proposed openstack/openstack-ansible-os_neutron master: Add hashi_vault pki backend support  https://review.opendev.org/c/openstack/openstack-ansible-os_neutron/+/94942018:47
opendevreviewDamian Dąbrowski proposed openstack/ansible-role-pki master: Add hashi_vault backend  https://review.opendev.org/c/openstack/ansible-role-pki/+/94888118:50

Generated by irclog2html.py 4.0.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!