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

feat: init job. #4116

Closed
wants to merge 40 commits into from
Closed

feat: init job. #4116

wants to merge 40 commits into from

Conversation

wallyxjh
Copy link
Contributor

@wallyxjh wallyxjh commented Oct 19, 2023

🤖 Generated by Copilot at c53a965

Summary

📄🐳🔐

This pull request adds two new controllers, license and job-init, to the project. The license controller is responsible for checking and updating the license information of the project. The job-init controller is responsible for creating a default user in the database and the Kubernetes API. The pull request also adds the necessary files and configurations to build, test, and deploy the controllers, such as Dockerfiles, Makefiles, Kubefiles, manifests, and API types. It also updates the workflows for controllers and release to include the license controller and disable the job-init controller.

We added a license controller
To check and update our project's holder
It uses encryption keys
And some Kubernetes APIs
And it runs on a distroless docker

Walkthrough

  • Add a new license controller that manages the license resources and encryption keys (link, link, link, link, link, link, link, link, link)
  • Use kubebuilder to scaffold the project and generate the API types and manifests (link, link)
  • Use distroless as the base image and copy the binary from the bin/ directory (link)
  • Use Makefile to define the targets and commands for building, testing, running, and deploying the controller (link)
    • Inject the encryption keys into the binary using linker flags (link)
  • Add a placeholder README.md with some instructions and information (link)
  • Add .gitignore and .dockerignore files to ignore unwanted files (link, link)
  • Add a new job-init controller that creates a default user in the Kubernetes API and the MongoDB database (link, link, link, link, link, link, link, link, link, link, link, link)
    • Use cmd/preset/main.go to define the main function and call the database.PresetUser function (link)
    • Use distroless as the base image and copy the binary from the bin/ directory (link)
    • Use Makefile to define the targets and commands for building, testing, running, and deploying the controller (link)
    • Use kubefile to define how to build the image using kubebuilder (link)
    • Use deploy/manifests/deploy.yaml to define the Kubernetes resources for the controller (link)
      • Set some environment variables from a secret for the database connection and password salt (link)
    • Add a placeholder README.md with some TODO comments (link)
    • Add .gitignore and .dockerignore files to ignore unwanted files (link, link)
    • Add go.mod to define the module name, go version, and dependencies (link)
    • Add internal/util/controller/user.go to define some functions to interact with the Kubernetes API for creating a user resource (link)
    • Add internal/util/database/database.go to define some functions to interact with the MongoDB database (link)
    • Add internal/util/database/user.go to define some functions and types to manage the user data in the database (link)
      • Hash the password with a salt key and decode the base64 string (link)
  • Comment out the job-init entry in the controllers and release workflows, possibly because it is not ready yet or needs to be updated (link, link)

@pull-request-size
Copy link

Whoa! Easy there, Partner!

This PR is too big. Please break it up into smaller PRs.

@sealos-ci-robot
Copy link
Member

🤖 Generated by lychee action

Summary

Status Count
🔍 Total 956
✅ Successful 375
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 580
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

@wallyxjh wallyxjh closed this Oct 19, 2023
@sweep-ai
Copy link

sweep-ai bot commented Oct 19, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

@wallyxjh wallyxjh deleted the kkkk branch October 19, 2023 08:42
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.

3 participants