Comment 13 for bug 1993716

Revision history for this message
Ian Booth (wallyworld) wrote : Re: placement directives for k8s cloud not working

I guess you're using Juju 2.9.

I checked the code and it seems affinity support for sidecar charms was only added in Juju 3.x. I had thought both podspec and sidecar charms supported it even in 2.9, but it seems 2.9 doesn't support affinity for sidecar charms. We can look to add in this support.

@Camille to clarify, 2.9 does support affinity for podspec charms, but only for the workload pod, not the operator pod that runs the charm. The original thinking way back when this was done was that it's the workload that needs access to gpu etc. Because podspec charms spin up 2 statefulsets, one for the operator and one for the workload, there's no good way to use the constraint syntax to provide a different set of affinity rules for the operator vs workload pods. But you can use the same approach as already used in sidecar charms for changing the cluster in ways juju doesn't support - use the k8s api client from the charm to update the operator's statefulset podspec template.