https://github.com/empath-nirvana/magic-happens Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} empath-nirvana / magic-happens Public * Notifications * Fork 1 * Star 31 A kubernetes operator you should never run under any circumstances 31 stars 1 fork Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights empath-nirvana/magic-happens This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/e] Use Git or checkout with SVN using the web URL. [gh repo clone empath] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @empath-nirvana empath-nirvana Merge pull request #4 from empath-nirvana/changes ... 2244905 Apr 17, 2023 Merge pull request #4 from empath-nirvana/changes added in dry run and the ability to specify some starter yaml on crea... 2244905 Git stats * 14 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows updated readme April 16, 2023 17:01 install made the model to use an environment variable April 16, 2023 17:10 .dockerignore updated readme April 16, 2023 17:01 .gitignore initial commit April 16, 2023 16:19 Dockerfile updated readme April 16, 2023 17:01 README.md Update README.md April 16, 2023 17:12 handler.py added in dry run and the ability to specify some starter yaml on crea... April 17, 2023 09:45 requirements.txt updated readme April 16, 2023 17:01 test.yaml added in dry run and the ability to specify some starter yaml on crea... April 17, 2023 09:45 View code [ ] MagicHappens Kubernetes Operator Overview Prerequisites Installation Usage Limitations License Contributing README.md Readme written by chatgpt, because of course it is: MagicHappens Kubernetes Operator Welcome to the MagicHappens Kubernetes Operator project! This is a proof-of-concept (PoC) operator, built using Kopf, that leverages OpenAI's GPT-powered generation capabilities to create a Kubernetes spec from a simple, human-readable description. Please note that this project is just for fun and should NOT be deployed to a real Kubernetes cluster under any circumstances. Overview The MagicHappens operator takes the following YAML as input: kind: MagicHappens apiVersion: gptmagic.io/v1 metadata: name: redis spec: description: "create a redis namespace, and inside the namespace, create a redis cluster, backed by a stateful set, along with a service" Upon receiving the YAML, the operator sends the description to OpenAI, which then generates a Kubernetes spec. The operator applies the returned YAML, attempting to correct any errors and maintain consistency across updates. Prerequisites * A Kubernetes cluster (for testing purposes only). * kubectl installed and configured to interact with your cluster. * Python 3.7+ installed. * an openai api key (you can use gpt-3.5 if you don't have access to gpt-4, but the results aren't as reliable Installation git clone https://github.com/empath-nirvana/magic-happens.git cd magic-happens Install the required Python packages: pip install -r requirements.txt Deploy the Custom Resource Definition (CRD) to your cluster: kubectl apply -f crd.yaml Set up your OpenAI API key as an environment variable: export OPENAI_API_KEY=your_openai_api_key Usage Start the operator locally: kopf run handler.py --verbose In another terminal, create a new MagicHappens custom resource: kubectl apply -f test.yaml This will trigger the MagicHappens operator to generate and apply the Kubernetes spec based on the description provided in the YAML. Monitor the operator logs for the generated YAML and any errors or corrections. To clean up the resources created by the operator, delete the MagicHappens custom resource: kubectl delete -f example.yaml Limitations This PoC operator is meant for fun and experimentation only. It is not production-ready, and should not be deployed to real Kubernetes clusters. The generated specs may not always be accurate or secure, and the operator may not handle all edge cases or errors gracefully. License This project is licensed under the MIT License - see the LICENSE file for details. Contributing Feel free to open issues, submit pull requests, or provide feedback to help improve this proof-of-concept project. Remember, this is just for fun and learning! About A kubernetes operator you should never run under any circumstances Resources Readme Stars 31 stars Watchers 1 watching Forks 1 fork Report repository Releases No releases published Packages 1 Languages * Python 98.6% * Dockerfile 1.4% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.