Skip to content
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

Community edition dev #3712

Merged
merged 12 commits into from
Aug 21, 2023
Merged

Community edition dev #3712

merged 12 commits into from
Aug 21, 2023

Conversation

yxxchange
Copy link
Contributor

@yxxchange yxxchange commented Aug 18, 2023

πŸ€– Generated by Copilot at 348745f

Summary

πŸ”‘πŸš€πŸ› οΈ

This pull request refactors and updates the license issuer controller to use a new command, a new license key mechanism, and new RBAC permissions. It also adds two new binaries, preset and launcher, to simplify the MongoDB initialization and the controller execution. It modifies the manager.yaml, deploy.yaml, license_controller.go, init.go, Makefile, role.yaml, configmaps.yaml, Dockerfile, const.go, main.go files, and the .github/workflows/controllers.yml workflow.

Oh we're the crew of the license issuer
We work with code and secrets and clusters
We pull and push and build and deploy
And we sing this shanty with joy

Walkthrough

  • Add launcher binary to run preset and manager binaries in sequence (link, link, link, link, link)
  • Add preset binary to preset the root user for MongoDB (link, link, link, link, link, link)
  • Pass license key as a secret using LICENSE_KEY environment variable (link, link, link)
  • Add three new environment variables to configure MongoDB connection, password salt, and controller namespace (link, link)
  • Add access to namespaces, nodes, and persistentvolumes resources for the controller (link, link, link)
  • Remove Launcher CRD and related logic from the controller (link, link, link)
  • Add imagePullPolicy: Always to the manager deployment manifest (link, link)
  • Reorder key and name fields of secretKeyRef for consistency (link, link)
  • Remove and add some imports in init.go file (link)
  • Remove an empty line in license_controller.go file (link)
  • Add a blank line to the Makefile for readability (link)

@sealos-ci-robot
Copy link
Member

sealos-ci-robot commented Aug 18, 2023

πŸ€– Generated by lychee action

Summary

Status Count
πŸ” Total 907
βœ… Successful 370
⏳ Timeouts 0
πŸ”€ Redirected 0
πŸ‘» Excluded 536
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (016c05e) 66.36% compared to head (cc39413) 66.36%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3712   +/-   ##
=======================================
  Coverage   66.36%   66.36%           
=======================================
  Files           8        8           
  Lines         654      654           
=======================================
  Hits          434      434           
  Misses        173      173           
  Partials       47       47           

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

err = presetRootUser(context.Background(), options)
fmt.Println("failed to preset root user, retrying...")
if err != nil {
time.Sleep(time.Minute)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to long for sleep?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok by testing


const (
// pre-defined user name and password
defaultuser = "root"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to defaultUser.


// kubernetes default user cr is admin
// it is corresponding to the root account
defaultK8sUser = "admin"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to defaultCloudUser.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it not a good idear to rename this

Comment on lines +67 to +68
defaultDB = "test"
defaultCollection = "user"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this chanageable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just use mongoURI to connect db, do not set this.

passwd := hashPassword(defaultPassword, o.GetEnvOptions().SaltKey)
user := newUser(uuid, defaultuser, defaultuser, passwd, defaultK8sUser)

collection := client.Database(defaultDB).Collection(defaultCollection)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix this.

}
err = client.Ping(ctx, nil)
if err != nil {
fmt.Println("failed to ping mongo", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use log.

@lingdie lingdie merged commit 076c77c into labring:main Aug 21, 2023
64 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants