-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#16813 from tlm/juju-5345-user-model-foreign-key
juju#16813 Until now we haven't had any strong referential integrity for model owners onto the user table. Now that the user DDL has been established this sets up the checks and test to assert that when adding a model the owner exists and is a valid user in the system (not removed). As part of this PR I have also wired up the bootstrap process to set the admin user as the owner of the controller model. ## Checklist - [x] Code style: imports ordered, good names, simple structure, etc - [x] Comments saying why design decisions were made - [x] Go unit tests, with comments saying what you're testing - ~[ ] [Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing~ - ~[ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~ ## QA steps Run unit tests under `service` and `state` in the model domain package. Also bootstrap a controller to lxd and make sure it succeeds with no error output around creating the controller model. ## Documentation changes N/A ## Links **Jira card:** JUJU-5345
- Loading branch information
Showing
18 changed files
with
281 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
// Copyright 2023 Canonical Ltd. | ||
// Copyright 2024 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package model | ||
|
||
import "github.com/juju/juju/core/user" | ||
|
||
const ( | ||
// ControllerModelName is the name given to the model that hosts the Juju | ||
// controller. This is a static value that we use for every Juju deployment. | ||
// It provides a common reference point that we can leverage in business | ||
// logic to ask questions and calculate defaults in Juju. | ||
ControllerModelName = "controller" | ||
|
||
// ControllerModelOwner is the name of the owner that is assigned to the | ||
// controller model. This is a static value that we ue for every Juju | ||
// deployment. | ||
ControllerModelOwner = "admin" | ||
// ControllerModelOwnerUsername is the user name of the owner that is | ||
// assigned to the controller model. This is a static value that we use for | ||
// every Juju deployment. | ||
ControllerModelOwnerUsername = user.AdminUserName | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright 2024 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package user | ||
|
||
const ( | ||
// AdminUsername is the default username that we give to the default admin | ||
// user that is created as part of every Juju bootstrap. | ||
AdminUserName = "admin" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.