go version # 1.21+
kubectl # v1.20+
docker # 17.03+
operator-sdk # latest# Fork and clone
git clone https://github.com/devopscorner/amazonq-golang-restfulapi-operator
cd amazonq-golang-restfulapi-operator
# Install dependencies
go mod tidy
# Run tests
make test
# Build locally
make buildgit checkout -b feature/your-feature-name# Edit code
vim api/v1/restapi_types.go
vim internal/controller/restapi_controller.go
# Generate manifests
make manifests
# Run tests
make test
# Build and verify
make build# Run operator locally
make run
# In another terminal, test with sample
kubectl apply -f config/samples/apps_v1_restapi.yamlgit add .
git commit -m "feat: add new feature"
git push origin feature/your-feature-name- New Component Types: Add support for additional MVC+R components
- Advanced Scaling: Implement custom metrics scaling
- Multi-cluster: Support for cross-cluster deployments
- Security: Enhanced RBAC and security policies
- Service Mesh: Istio/Linkerd integration
- Monitoring: Prometheus/Grafana dashboards
- CI/CD: GitOps workflow templates
- Storage: Persistent volume management
- API Reference: Complete API documentation
- Examples: More real-world examples
- Tutorials: Advanced use case tutorials
- Troubleshooting: Common issue solutions
# Run all tests
make test
# Test specific package
go test ./internal/controller/...
# Test with coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out# Run e2e tests
make test-e2e
# Test with local cluster
kind create cluster
make deploy
kubectl apply -f config/samples/# Test basic functionality
kubectl apply -f examples/complete-example.yaml
kubectl get restapi -A
kubectl get pods,svc,hpa
# Test scaling
kubectl patch restapi guestbook-api --type='merge' -p='{"spec":{"replicas":5}}'
# Test blue-green
kubectl patch restapi guestbook-api --type='merge' -p='{"spec":{"blueGreen":{"enabled":true}}}'// Use meaningful names
type RestAPIReconciler struct {
client.Client
Scheme *runtime.Scheme
}
// Add comments for exported functions
// ReconcileMVCRComponents manages MVC+R pattern deployments
func (r *RestAPIReconciler) ReconcileMVCRComponents(ctx context.Context, restAPI *restapiv1.RestAPI) error {
// Implementation
}
// Use structured logging
log := logf.FromContext(ctx)
log.Info("Reconciling RestAPI", "name", restAPI.Name)# Use consistent indentation (2 spaces)
apiVersion: apps.aws.com/v1
kind: RestAPI
metadata:
name: example
spec:
model:
enabled: true
image: "example/model:v1"
port: 8080# Format: type(scope): description
feat(controller): add blue-green deployment support
fix(api): resolve validation error for health checks
docs(readme): update installation instructions
test(e2e): add auto-scaling test cases- Tests pass locally
- Code follows style guidelines
- Documentation updated
- Examples work correctly
- No breaking changes (or documented)
- Clear description of changes
- Link to related issues
- Test coverage maintained/improved
- Documentation updated
- Examples provided for new features
- Functionality: Does it work as intended?
- Performance: No performance regressions
- Security: No security vulnerabilities
- Maintainability: Code is readable and maintainable
- Compatibility: Backward compatibility preserved
**Bug Description**
Clear description of the bug
**Steps to Reproduce**
1. Deploy operator
2. Apply RestAPI resource
3. Observe error
**Expected Behavior**
What should happen
**Actual Behavior**
What actually happens
**Environment**
- Kubernetes version:
- Operator version:
- Go version:
**Logs**kubectl logs deployment/amazonq-golang-restfulapi-operator-controller-manager
**Additional Context**
Any other relevant information
**Feature Description**
Clear description of the proposed feature
**Use Case**
Why is this feature needed?
**Proposed Solution**
How should this be implemented?
**Alternatives Considered**
Other approaches considered
**Additional Context**
Any other relevant information- Design First: Create design document
- API Changes: Update CRD if needed
- Controller Logic: Implement reconciliation
- Tests: Add comprehensive tests
- Documentation: Update all relevant docs
api/v1/ # CRD definitions
internal/controller/ # Controller logic
config/ # Kubernetes manifests
examples/ # Usage examples
docs/ # Documentation
test/ # Test files
- Minimize external dependencies
- Use standard Kubernetes libraries
- Pin dependency versions
- Document dependency changes
- Follow semantic versioning (v1.2.3)
- Tag releases in git
- Update CHANGELOG.md
- Build and publish container images
- All tests pass
- Documentation updated
- Examples verified
- Breaking changes documented
- Migration guide provided (if needed)
- Issues: GitHub issues for bugs/features
- Discussions: GitHub discussions for questions
- Slack: #restapi-operator channel
- Email: maintainers@example.com
- @maintainer1: Core features, API design
- @maintainer2: Testing, CI/CD
- @maintainer3: Documentation, examples
- Add more examples in
examples/directory - Improve error messages and logging
- Add unit tests for utility functions
- Update documentation with screenshots
- Fix typos and improve code comments
- Implement custom metrics for auto-scaling
- Add support for init containers
- Enhance blue-green deployment strategies
- Add webhook validation
- Implement operator metrics
- Multi-cluster support
- Custom resource validation
- Advanced scheduling policies
- Integration with service mesh
- Performance optimizations
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.
Thank you for contributing to RestAPI Operator! 🎉