-
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.
Wires up user correlation for models in DQlite.
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. This PR also removes some hard coded values that were living in the wrong place. Specifically the username we give to the admin user at bootstrap time. Also moved controller defaults such as controller name and controller model user to the core package so they can be referenced properly.
- 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.