Feat/add simpleapp crd - #68
Conversation
Summary of ChangesHello @tsaishawn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request introduces a new SimpleApp CRD and its corresponding controller. While a good start, a significant security risk has been identified: the controller acts as a 'pass-through' for user-provided DeploymentSpec and ServiceSpec. This allows users with limited permissions to escalate privileges by creating resources with insecure configurations (e.g., privileged pods or traffic interception via externalIPs) using the operator's high-privilege ServiceAccount. It is recommended to implement strict validation of these specs or to only expose a safe subset of configuration options. Beyond this, critical issues include incorrect API type definitions, a bug in the service reconciliation logic that will lead to infinite reconcile loops, and an invalid sample manifest. Suggestions for improving testing, status reporting, and fixing a minor controller initialization bug are also provided.
There was a problem hiding this comment.
Pull request overview
Adds a new SimpleApp API (CRD) and controller to the otterscale-operator, wiring it into manager startup, RBAC, CRD kustomization, samples, and envtest-based controller tests.
Changes:
- Introduce
apps.otterscale.io/v1alpha1SimpleAppAPI types + generated deepcopy, and register it incmd/main.go. - Add
SimpleAppReconcilerthat manages a Deployment/Service/PVC from fields in the SimpleApp spec. - Extend manifests (CRD kustomization, RBAC, sample manifests) and add controller-runtime envtest scaffolding/tests.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/controller/apps/suite_test.go | Adds envtest/Ginkgo test suite scaffolding for apps controllers. |
| internal/controller/apps/simpleapp_controller_test.go | Adds initial reconciliation test scaffold for SimpleApp. |
| internal/controller/apps/simpleapp_controller.go | Implements SimpleApp controller logic (finalizer, reconcile PVC/Deployment/Service, status refs). |
| go.mod | Promotes sigs.k8s.io/yaml to a direct dependency. |
| config/samples/kustomization.yaml | Adds SimpleApp sample to kustomize samples set. |
| config/samples/apps_v1alpha1_simpleapp.yaml | Adds an example SimpleApp custom resource manifest. |
| config/rbac/role.yaml | Updates manager ClusterRole rules for Deployments/Services/PVCs + SimpleApp resources. |
| config/rbac/kustomization.yaml | Includes generated SimpleApp admin/editor/viewer roles in RBAC kustomization. |
| config/rbac/apps_simpleapp_viewer_role.yaml | Adds read-only ClusterRole for SimpleApp. |
| config/rbac/apps_simpleapp_editor_role.yaml | Adds edit ClusterRole for SimpleApp. |
| config/rbac/apps_simpleapp_admin_role.yaml | Adds admin ClusterRole for SimpleApp. |
| config/crd/kustomization.yaml | Adds SimpleApp CRD to CRD kustomization resources. |
| cmd/main.go | Registers the apps API scheme and sets up the SimpleApp controller with the manager. |
| api/apps/v1alpha1/zz_generated.deepcopy.go | Adds generated deepcopy implementations for new API types. |
| api/apps/v1alpha1/simpleapp_types.go | Defines SimpleApp spec/status and kubebuilder markers/printcolumns. |
| api/apps/v1alpha1/groupversion_info.go | Adds apps API group registration (GroupVersion/SchemeBuilder). |
| PROJECT | Declares the new SimpleApp API/controller to kubebuilder project metadata. |
| Makefile | Adjusts CRD generation flags for controller-gen. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2. deployment is requred
No description provided.