Skip to content

Commit

Permalink
=add markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
yxxchange committed Aug 21, 2023
1 parent 33343d4 commit 1cd7d81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion controllers/licenseissuer/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# licenseissuer-controller
// TODO(user): Add simple overview of use/purpose

LicenseIssuer is a Operator that authorizes the use of a license for a given user.

In this module, there are three binaries in total, which are launcher, preset, and manager.

Launcher is a starter responsible for launching preset and manager.

Preset is an idempotent binary program responsible for registering the root user in the database, and the root user has a certain amount of free quota.

Manager is used to create license resources and activate the license injected into the cluster.

## Description
// TODO(user): An in-depth paragraph about your project and overview of use
Expand Down
6 changes: 3 additions & 3 deletions controllers/licenseissuer/preset/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {

const (
// pre-defined user name and password
defaultuser = "root"
defaultUser = "root"
defaultPassword = "sealos2023"

// kubernetes default user cr is admin
Expand Down Expand Up @@ -114,7 +114,7 @@ func presetRootUser(ctx context.Context, o util.Options) error {
// preset root user
uuid := uuid.New().String()
passwd := hashPassword(defaultPassword, o.GetEnvOptions().SaltKey)
user := newUser(uuid, defaultuser, defaultuser, passwd, defaultK8sUser)
user := newUser(uuid, defaultUser, defaultUser, passwd, defaultK8sUser)

collection := client.Database(defaultDB).Collection(defaultCollection)
// check if the user already exists
Expand Down Expand Up @@ -162,7 +162,7 @@ func initMongoDB(ctx context.Context, o util.Options) (*mongo.Client, error) {

// makesure the user does not exist
func preCheck(ctx context.Context, collection *mongo.Collection) bool {
filter := bson.M{"password_user": defaultuser}
filter := bson.M{"password_user": defaultUser}
var existingUser User
err := collection.FindOne(ctx, filter).Decode(&existingUser)
return err == nil
Expand Down

0 comments on commit 1cd7d81

Please sign in to comment.