-
Notifications
You must be signed in to change notification settings - Fork 56
NO-ISSUE: Add AGENTS.md and AI convention files #14
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
Open
amir-yogev-gh
wants to merge
2
commits into
osac-project:main
Choose a base branch
from
amir-yogev-gh:feat/ai-ready-agents-md
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # host-management-openstack | ||
|
|
||
| Kubernetes controller that manages bare metal hosts via OpenStack Ironic. Watches HostLease CRs (defined in bare-metal-fulfillment-operator) and reconciles power state with Ironic nodes. | ||
|
|
||
| ## Critical Rules | ||
|
|
||
| - **Always `make manifests generate`** after modifying CRD-consuming types | ||
| - **Always `make lint`** before committing — fix all golangci-lint issues | ||
| - **Never edit** `config/crd/` or `zz_generated.deepcopy.go` — these are generated | ||
| - Run `make lint test` before committing | ||
|
|
||
| ## Dev Environment | ||
|
|
||
| ```bash | ||
| make build # Build manager binary to bin/manager | ||
| make test # Unit tests (excludes e2e) | ||
| make test-e2e # E2E tests with Kind cluster | ||
| make lint # golangci-lint | ||
| make lint-fix # Auto-fix lint issues | ||
| make fmt # go fmt | ||
| make vet # go vet | ||
|
|
||
| make manifests # Generate RBAC manifests | ||
| make generate # Generate DeepCopy methods | ||
|
|
||
| make run # Run controller locally | ||
| make install # Install CRDs into cluster | ||
| make deploy IMG=<registry>/host-management-openstack:tag | ||
| make undeploy | ||
|
|
||
| make image-build IMG=<registry>/host-management-openstack:tag | ||
| make image-push IMG=<registry>/host-management-openstack:tag | ||
|
|
||
| # Pre-commit hooks | ||
| pre-commit run --all-files | ||
| ``` | ||
|
|
||
| ## Repository Structure | ||
|
|
||
| ```text | ||
| host-management-openstack/ | ||
| ├── cmd/ | ||
| │ └── main.go # Controller entry point | ||
| ├── internal/ | ||
| │ ├── controller/ # HostLease reconciliation logic | ||
| │ └── management/ # OpenStack Ironic client | ||
| ├── config/ | ||
| │ ├── default/ # Kustomize default overlay | ||
| │ ├── manager/ # Manager deployment manifest | ||
| │ ├── rbac/ # Generated RBAC rules | ||
| │ └── samples/ # Example HostLease CRs | ||
| ├── test/ | ||
| │ ├── e2e/ # End-to-end tests | ||
| │ └── utils/ # Test utilities | ||
| ├── hack/ # Boilerplate and helper scripts | ||
| ├── Makefile # Build, test, lint, deploy targets | ||
| ├── go.mod # Go 1.26, controller-runtime, gophercloud | ||
| └── .golangci.yml # Linter configuration | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| Single controller watching HostLease CRs: | ||
|
|
||
| ```text | ||
| HostLease CR (spec.poweredOn: true/false) | ||
| ↓ (reconcile) | ||
| HostLease Controller | ||
| ↓ (OpenStack API) | ||
| Ironic Node (power state) | ||
| ``` | ||
|
|
||
| - **HostLease types** are defined in `bare-metal-fulfillment-operator/api/v1alpha1/` — this repo consumes them | ||
| - **Management client** (`internal/management/`) abstracts OpenStack Ironic interactions via gophercloud | ||
| - Controller syncs `spec.poweredOn` with Ironic node power state, requeues on interval for drift detection | ||
| - Handles auth reconnection on token expiry | ||
|
|
||
| ### Key Files | ||
|
|
||
| | File | Purpose | | ||
| |------|---------| | ||
| | `internal/controller/hostlease_controller.go` | Reconciliation logic | | ||
| | `internal/controller/hostlease_names.go` | Naming helpers | | ||
| | `internal/management/client.go` | Management client interface | | ||
| | `internal/management/openstack.go` | OpenStack Ironic implementation | | ||
|
|
||
| ## CI | ||
|
|
||
| GitHub Actions (`.github/workflows/`): | ||
| - **build-image.yaml** — runs tests, builds + pushes container image and manifests | ||
| - **pre-commit.yaml** — pre-commit hooks + golangci-lint on PRs | ||
|
|
||
| ## Code Quality | ||
|
|
||
| - **golangci-lint** with dupl, errcheck, ginkgolinter, goconst, gocyclo, revive, staticcheck, and more (see `.golangci.yml`) | ||
| - **Pre-commit hooks**: trailing-whitespace, yamllint (strict, excludes `config/`), golangci-lint | ||
| - **Tests**: Ginkgo v2 + Gomega with envtest | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Hyphenate "bare-metal" as compound adjective.
"Bare metal" modifies "hosts" and should be hyphenated: "bare-metal hosts."
🧰 Tools
🪛 LanguageTool
[uncategorized] ~3-~3: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ack Kubernetes controller that manages bare metal hosts via OpenStack Ironic. Watches Hos...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
🤖 Prompt for AI Agents