Thank you for your interest in contributing to the AWS Multi-ENI Controller! This document provides guidelines and instructions for contributing to this project.
By participating in this project, you agree to abide by our Code of Conduct.
If you find a bug in the project, please create an issue on GitHub with the following information:
- A clear, descriptive title for the issue
- A description of the problem, including steps to reproduce
- The expected behavior
- Screenshots, if applicable
- Your environment (Kubernetes version, AWS region, etc.)
- Any additional context that might be helpful
If you have an idea for a new feature or enhancement, please create an issue with the following information:
- A clear, descriptive title
- A detailed description of the proposed enhancement
- The motivation behind this enhancement
- Any potential implementation details
- Any potential drawbacks or concerns
Please do not report security vulnerabilities through public GitHub issues. Instead, follow the security vulnerability reporting process outlined in our Security Policy.
We welcome pull requests! To submit a pull request:
- Fork the repository
- Create a new branch for your changes
- Make your changes
- Write or update tests as necessary
- Update documentation as necessary
- Submit a pull request
- Keep your changes focused. If you're fixing a bug, focus on that bug. If you're adding a feature, focus on that feature.
- Write clear, descriptive commit messages
- Include tests for your changes
- Update documentation as necessary
- Make sure all tests pass before submitting
- Reference any relevant issues in your pull request description
- Go 1.23 or higher
- Docker
- Access to a Kubernetes cluster (e.g., EKS)
- AWS CLI configured with appropriate permissions
- kubectl installed and configured
-
Clone the repository:
git clone https://github.com/johnlam90/aws-multi-eni-controller.git cd aws-multi-eni-controller -
Build the controller:
go build -o bin/manager cmd/main.go
-
Run tests:
# Run unit tests only go test -v ./pkg/... -short # Run integration tests (requires AWS credentials) export AWS_REGION=us-east-1 export TEST_SUBNET_ID=subnet-xxxxxxxx export TEST_SECURITY_GROUP_ID=sg-xxxxxxxx go test -v ./pkg/aws -tags=integration
-
Build and push the Docker image:
# The deploy.sh script builds and pushes the Docker image ./hack/deploy.sh
cmd/: Contains the main entry point for the controllerpkg/: Contains the core controller logicapis/: Contains the API definitionscontroller/: Contains the controller implementation
deploy/: Contains Kubernetes deployment manifestscrds/: Contains the Custom Resource Definitionssamples/: Contains sample NodeENI resources
hack/: Contains scripts for development and deploymenttest/: Contains test utilities and integration testsdocs/: Contains project documentation
- Follow Go best practices and style guidelines
- Maximum cyclomatic complexity of 15 per function
- Use meaningful variable and function names
- Follow the project's existing code structure and patterns
- Ensure context.Context is always the first parameter of a function
- Avoid underscores in Go package names
- Use Go modules for dependency management
- Format code with
gofmtbefore submitting
- All new features must include unit tests
- Maintain or improve the current test coverage percentage
- Tests should cover both success and error paths
- Include integration tests for AWS-dependent functionality
- Skip AWS-dependent tests when credentials are not available
- Use mocks for external dependencies in unit tests
- Update relevant documentation for any new features or changes
- Include examples for new functionality
- Document any new configuration options
- Update the README.md if necessary
- Add comments to exported functions and types
- Do not include hardcoded credentials or sensitive information
- Validate all user inputs and file paths
- Follow secure coding practices for shell command execution
- Document security implications of your changes if applicable
- Use proper error handling that doesn't leak sensitive information
- Follow the principle of least privilege for AWS IAM permissions
The AWS Multi-ENI Controller project requires tests for all new functionality:
- Unit Tests: All new functions and methods must have corresponding unit tests
- Integration Tests: Features that interact with AWS services must have integration tests
- End-to-End Tests: Major features should include end-to-end tests where appropriate
- New code should maintain or improve the current test coverage percentage
- Tests should cover both success and error paths
- Edge cases should be tested where applicable
# Run unit tests
go test -v ./pkg/... -short
# Run integration tests (requires AWS credentials)
export AWS_REGION=us-east-1
export TEST_SUBNET_ID=subnet-xxxxxxxx
export TEST_SECURITY_GROUP_ID=sg-xxxxxxxx
go test -v ./pkg/aws -tags=integrationThis policy is enforced during code review. Pull requests that add new functionality without corresponding tests will not be merged.
By contributing to this project, you agree that your contributions will be licensed under the project's Apache 2.0 License.