diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..8c77747 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,47 @@ +--- +name: Bug report +about: Report a problem with the Agones Headlamp plugin +title: '' +labels: kind/bug +assignees: '' +--- + + + +**Describe the bug** + +A clear description of what went wrong in the plugin UI. + +**What you expected** + +What should have happened instead. + +**Steps to reproduce** + +1. Open Headlamp → Agones → … +2. … +3. See error / wrong data + +**Screenshots or recordings** + +If applicable, add screenshots or a short recording. + +**Environment** + +- Plugin version / commit (if known): +- Headlamp version (desktop or in-cluster): +- Agones version: +- Kubernetes version (`kubectl version`): +- Browser (if using Headlamp in a browser): + +**RBAC / permissions** + +Does your user/ServiceAccount have `get`, `list`, `watch` on `agones.dev` resources (and `create` on `gameserverallocations` if using allocation)? + +**Logs** + +Any relevant browser console errors or Headlamp logs. + +**Additional context** + +Anything else that might help (sample Fleet/GameServer YAML, feature flags enabled in Agones, etc.). diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..4508abb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,14 @@ +blank_issues_enabled: false +contact_links: + - name: Agones documentation + url: https://agones.dev/site/docs/ + about: Agones install, CRDs, and game server lifecycle (not this UI plugin) + - name: Headlamp plugin development + url: https://headlamp.dev/docs/latest/development/plugins/getting-started + about: Headlamp plugin SDK, packaging, and core UI behavior + - name: Report a plugin security issue + url: https://github.com/manumathon/headlamp-plugin/security/advisories/new + about: Private security reports for this plugin repository + - name: Agones security + url: https://github.com/googleforgames/agones/security/advisories/new + about: Security issues in Agones itself (upstream control plane) diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md new file mode 100644 index 0000000..a1b36eb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -0,0 +1,22 @@ +--- +name: Documentation +about: Report missing or incorrect docs (README, RBAC, install steps) +title: '' +labels: kind/documentation +assignees: '' +--- + +**What is unclear or wrong?** + +Describe the doc gap (README, install, RBAC, development guide, etc.). + +**Where did you look?** + +- [ ] README.md +- [ ] CONTRIBUTING.md +- [ ] Headlamp.dev plugin docs +- [ ] Other: + +**Suggested improvement** + +What text or examples would have helped? diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..16dda81 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,27 @@ +--- +name: Feature request +about: Suggest an improvement to the Agones Headlamp plugin +title: '' +labels: kind/feature +assignees: '' +--- + +**Is your request related to a problem?** + +Describe the operator or developer pain point (e.g. hard to debug rolling fleet updates without GameServerSet visibility). + +**Describe the solution you'd like** + +What should the plugin show or let users do? + +**Agones resources involved** + +Which CRDs or workflows? (e.g. Fleet, GameServerSet, GameServer, GameServerAllocation, FleetAutoscaler) + +**Alternatives considered** + +Other UI approaches, `kubectl` workflows, or upstream Headlamp features you considered. + +**Additional context** + +Mockups, links to Agones docs, or related issues in [kubernetes-sigs/headlamp](https://github.com/kubernetes-sigs/headlamp) / [headlamp-k8s/plugins](https://github.com/headlamp-k8s/plugins). diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..a73beb5 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,34 @@ +# Security policy + +## Scope + +This repository contains the **Agones Headlamp plugin** — a UI extension for [Headlamp](https://headlamp.dev) that reads and displays Agones custom resources. It does not run game servers or implement the Agones control plane. + +Security of your deployment still depends on: + +- Kubernetes RBAC for the Headlamp user or ServiceAccount +- Agones installation and configuration ([Agones docs](https://agones.dev/site/docs/)) +- Headlamp deployment mode (desktop vs in-cluster) and cluster access + +## Reporting a vulnerability + +**Do not report security vulnerabilities through public GitHub issues or pull requests.** + +### This plugin + +If you believe you have found a security issue **in this plugin repository** (e.g. unsafe handling of cluster data in the UI, dependency vulnerability with exploitable impact in context of the plugin): + +1. Open a [private vulnerability report](https://github.com/manumathon/headlamp-plugin/security/advisories/new) for this repository. +2. Include a clear description, affected version or commit, steps to reproduce, and suspected impact. + +Maintainers will acknowledge as soon as practical and work on validation and fixes. + +### Agones or Headlamp core + +Issues in **Agones** itself should be reported via the [Agones security policy](https://github.com/googleforgames/agones/blob/main/.github/SECURITY.md) (or the current upstream Agones repository security page). + +Issues in **Headlamp** should be reported to [kubernetes-sigs/headlamp](https://github.com/kubernetes-sigs/headlamp/security). + +## Supported versions + +Security fixes are delivered through normal releases and tags on this repository. Prefer the latest release and keep npm dependencies updated (`npm audit`). diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4d15ca2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,35 @@ +# Copyright Contributors to Agones a Series of LF Projects, LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: 2 +updates: + - package-ecosystem: npm + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 5 + labels: + - dependencies + groups: + headlamp-plugin: + patterns: + - '@kinvolk/headlamp-plugin' + - '@headlamp-k8s/*' + + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + labels: + - dependencies diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..0e43b69 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,40 @@ + + +## Type of change + +- [ ] Bug fix +- [ ] New feature / enhancement +- [ ] Documentation +- [ ] Refactoring / cleanup +- [ ] CI / tooling +- [ ] Breaking change + +## What this PR does / Why we need it + + + +## Related issues + + + +Fixes # + +## Screenshots / recordings + + + +## Test plan + +- [ ] `npm ci` +- [ ] `npm run build` +- [ ] `npm run tsc` +- [ ] `npm run lint` +- [ ] `npm run format -- --check` +- [ ] `npm run test` +- [ ] Manual check in Headlamp (`npm run start`) against a cluster with Agones + + + +## Notes for reviewers + + diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..0589f66 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,29 @@ +changelog: + exclude: + labels: + - duplicate + - question + - invalid + - wontfix + categories: + - title: Breaking changes + labels: + - kind/breaking + - title: Features + labels: + - kind/feature + - title: Bug fixes + labels: + - kind/bug + - title: Documentation + labels: + - kind/documentation + - title: Security + labels: + - area/security + - title: Dependencies + labels: + - dependencies + - title: Other + labels: + - '*' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c09b892 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,62 @@ +# Copyright Contributors to Agones a Series of LF Projects, LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Based on https://github.com/headlamp-k8s/plugins/blob/main/.github/workflows/headlamp-plugin-github-workflow.yaml + +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + plugin: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [22.x] + + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Typecheck + run: npm run tsc + + - name: Lint + run: npm run lint + + - name: Check formatting + run: npm run format -- --check + + - name: Test + run: npm run test diff --git a/.gitignore b/.gitignore index 5e59a0e..2c1aec9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -.* +# .* !.gitignore ### Node template diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a64eecd --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,72 @@ +# Contributing to the Agones Headlamp plugin + +Thank you for helping improve this plugin. Contributions via issues and pull requests are welcome. + +## Before you start + +- Read the [README](README.md) for prerequisites (Headlamp + Agones in a cluster). +- For **bugs** and **features**, use the [GitHub issue templates](.github/ISSUE_TEMPLATE/). +- For **security**, see [SECURITY.md](.github/SECURITY.md) — do not file public issues for vulnerabilities. + +## Development setup + +```bash +git clone +cd headlamp-plugin +npm install +npm run start +``` + +`npm run start` runs the plugin in development mode against your Headlamp instance. See the [Headlamp plugin getting started guide](https://headlamp.dev/docs/latest/development/plugins/getting-started). + +## Commands + +| Command | Purpose | +|---------|---------| +| `npm run start` | Dev mode | +| `npm run build` | Production build → `dist/` | +| `npm run tsc` | TypeScript check | +| `npm run lint` | ESLint | +| `npm run lint-fix` | ESLint with auto-fix | +| `npm run format` | Prettier write | +| `npm run format -- --check` | Prettier check (CI) | +| `npm run test` | Vitest unit tests | +| `npm run package` | Package for distribution | + +Run the same checks as CI before opening a PR: + +```bash +npm ci +npm run build && npm run tsc && npm run lint && npm run format -- --check && npm run test +``` + +## Pull requests + +- Use the [pull request template](.github/pull_request_template.md). +- Keep changes focused; link related issues. +- Add or update tests for non-trivial logic (see `src/**/*.test.ts`). +- Include screenshots for UI changes when possible. + +## Project layout + +```text +src/ + index.tsx # Routes and sidebar registration + resources/ # KubeObject classes per Agones CRD + views/ # List and detail pages + components/ # Shared UI (chips, tables, dialogs) + utils/ # Pure helpers (e.g. allocation body builder) + mapView.tsx # Map graph sources +``` + +## Agones context + +This plugin surfaces [Agones](https://agones.dev) CRDs in Headlamp. Useful references: + +- [Agones CRD API](https://agones.dev/site/docs/reference/agones_crd_api_reference/) +- [GameServer lifecycle](https://agones.dev/site/docs/reference/gameserver/) +- [Official Headlamp plugins](https://github.com/headlamp-k8s/plugins) (KEDA, Flux, etc.) for patterns + +## License + +By contributing, you agree that your contributions are licensed under the [Apache License 2.0](LICENSE). diff --git a/README.md b/README.md index 7e5d325..7644579 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,11 @@ This plugin follows the standard Headlamp plugin development workflow. See the [ ## Contributing -Contributions are welcome! Please open issues or pull requests. -> ⚠️🤣⚠️🤣⚠️🤣 -> NO BUT SERIOUSLY, WE WERE JUST PLAYING WHEN WE INITIALLY MAKING THIS. IT NEEDS SOLID IMPROVEMENT. -> ⚠️🤣⚠️🤣⚠️🤣 +See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, CI checks, and pull request guidelines. + +- [Bug report](.github/ISSUE_TEMPLATE/bug_report.md) +- [Feature request](.github/ISSUE_TEMPLATE/feature_request.md) +- [Security policy](.github/SECURITY.md) ## License