-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need a way to determine the expected count for a related application (or peers) #165
Comments
This omission is somewhat by design, but let me explain it more clearly: We'd like to kill goal-state medium term, because goal state provides a confusing reality to the charm. Originally, the charm design was encapsulated from future state that could never be realized. The units in goal state, for example, may never show up, and the machinery of juju itself does not expected to be communicated with about that data (relation-get, etc). In simpler terms, goal state breaks the abstraction that was created to make code inside the unit sane. With that said, we want to support fixing the problems that goal-state was created to address. For example, the key reason I see goal-state being used for is to anticipate the number of units for a given application, so that the charm can wait a bit longer before doing some action. This is data that I think we can easily provide without breaking the encapsulation I described earlier. We might do that as a number of pending units in a specific relation, for example. Is that use case reflecting your needs in OpenStack and MongoDB, and would such a pending number of units API address it? |
@majduk Polite ping. :) |
Polite pong ;-) This is partially this usage. Goal state for MongoDB is used to obtain a list of expected MongoDB units:
This is required to build an mongodb URI which contains unit names. Solution with number of pending units within a relation should be enough to cover that story, just the charm would need to check if there are any pendings units and build the URL when there are no more pending units. For this particular usage a flag stating if the relation has pending units or not would suffice. |
@majduk @niemeyer I still see a concern even if it's just a pending units count, since the charm will never be notified (via a hook) if pending units fail to come online, potentially leaving the charm in a |
Charm at the moment, without a goal-state or explicit config setting does not know what is the expected count of units. |
One of the comments around this that came up is for things that want to do clustering, it isn't always sufficient to know the count. The particular problem for K8s, is that you have to set the environment variable for the pod of the names of the peers before the pods are actually started. However, I think Juju will start the correct number of unit agents (based on the user's deployment request), and you should still see relation-joined for all of the peers even if the pods themselves have not been configured. (I'm pretty sure I've talked my way around and back to saying that count is sufficient, it is just that you have to wait to actually create the pod spec until after relation-joined has happened so that you know the names of the units to give to the pod.) |
This approach is ok for me. |
(Copying the plan from #206) Then you can use relation-created events on a peer relation to start tracking that "there should be 5 other units of this application" and as those units come up, you'll get 'relation-joined' for them, and you can use the We could expose this as something like There is still the problem that if some does:
|
We had yet another conversation about this topic. We will not be providing access to Juju's goal-state, mainly because probably juju will drift away from providing such an information, in favor on the more consistent information of "pending units" (which is better for this kind of distributed systems). But we need to understand first if having "pending units" is enough or not for all use cases. Some details to take in consideration:
For example, the operator may specify the system to scale to 15 units. The system must have odd number of units, minimum 3. So it's fine to defer initialization when having only one or two. But when having 3 it should be started. More units appear, you can configure it with 5, 7, etc. If you have 10, you need to leave it working with 9 until you get the 11st, then configure it to work with 11. But can not wait to have 15 to run the whole system, because those may never appear. But beyond that specific model, will having a "pending units count" be enough? If yes, we could add it to the Operator Framework fairly soon (using juju's If not, let's keep talking. Thanks everybody!! |
I believe that this issue is addressed by #597, which means that we probably can close it. |
Agreed. I think the crux of this conversation seems to be: planned units for a given application should be enough in most cases. |
…-get fixed juju-info network
It seems that the framework dos not have any way to read goal-state. This is required for multiple openstack charms and also MongoDB charm.
The text was updated successfully, but these errors were encountered: