-
Notifications
You must be signed in to change notification settings - Fork 527
feat: model life worker #19434
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
feat: model life worker #19434
Conversation
3bdb2b0
to
05111da
Compare
Adds GetModelLife and WatchModel methods to the model domain. We want to know when a model is created, changed etc. This will be used by the new model life watcher. This will replace the lifeflag worker that depends on the api and in turn the apiserver.
The model life worker will replace the life flag on the controller. The controller doesn't want to create many connections to the api just to get the information that is readily available via the domain services.
Starts add worker tests to ensure we've got good coverage of behaviour.
This wires up modellife worker with the controller manifolds.
db4b120
to
08d4745
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this change. Thanks.
@@ -744,8 +744,7 @@ func (s *Service) GetApplicationLife(ctx context.Context, appName string) (corel | |||
if err != nil { | |||
return "", errors.Errorf("getting life for %q: %w", appName, err) | |||
} | |||
result := appLife.Value() | |||
return result, errors.Capture(err) | |||
return appLife.Value() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to keep running capture over these.
@@ -3,7 +3,10 @@ | |||
|
|||
package life | |||
|
|||
import corelife "github.com/juju/juju/core/life" | |||
import ( | |||
corelife "github.com/juju/juju/core/life" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to converge these one day.
stmt, err := st.Prepare(` | ||
SELECT &dbModelLife.* | ||
FROM model | ||
WHERE uuid = $dbModelLife.uuid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little formatting inconsistency.
/merge |
This removes another slice of the pie in getting the model worker manager off the API server in terms of a dependency. By depending directly on the domain, we alleviate the burden of every request going through the API server, causing additional load on both the API and in turn the database for login requests. We're reducing the surface area of the API server creating a more focused curated API.
We're unable to remove the controller lifeflag controller facade, as the container agent requires access to it. I suspect though, that rather than having such a generic facade, we could make it more specific.
The
api-caller
dependencies have not quite gone down yet, and that is because of two more workers:Once those have made the transition, we should be free of the
api-caller
for most of the workers. A bounce of the API server should not cause Juju to go into a death spiral.QA steps
$ juju bootstrap lxd test $ juju add-model default $ juju deploy ubuntu