This repository contains a comprehensive collection of Go projects designed to demonstrate various Go concepts and Kubernetes operator development skills for technical interviews.
go-interviews/
├── operator/ # Kubernetes Operator Project
│ ├── api/ # CRD definitions
│ ├── controllers/ # Operator controller logic
│ ├── config/ # Kubernetes manifests
│ └── main.go # Operator entry point
├── patterns/ # Go Patterns and Examples
│ ├── pkg/ # Reusable Go packages
│ ├── examples/ # Go concept examples
│ └── cmd/ # Command-line applications
└── INTERVIEW_GUIDE.md # This file
- Location:
patterns/pkg/interfaces/ - Key Files:
reconciler.go,logger.go - Interview Topics:
- Interface design principles
- Dependency injection
- Mock implementations for testing
Example Questions:
- "How would you design an interface for a logger that can be easily mocked?"
- "Explain the difference between concrete types and interfaces in Go."
- Location:
patterns/pkg/patterns/ - Key Files:
observer.go,strategy.go,builder.go - Interview Topics:
- Observer pattern implementation
- Strategy pattern for different processing types
- Builder pattern for complex object construction
Example Questions:
- "Implement the Observer pattern in Go."
- "How would you use the Strategy pattern to handle different data formats?"
- Location:
patterns/examples/concurrency/ - Key Files:
worker_pool.go,pipeline.go - Interview Topics:
- Worker pools
- Pipeline processing
- Channel communication
- Context usage
Example Questions:
- "How would you implement a worker pool in Go?"
- "Explain the difference between buffered and unbuffered channels."
- Location:
patterns/pkg/utils/retry.go,patterns/pkg/utils/validation.go - Interview Topics:
- Custom error types
- Error wrapping
- Retry mechanisms
- Validation patterns
Example Questions:
- "How do you handle errors in Go applications?"
- "Implement a retry mechanism with exponential backoff."
- Location:
patterns/examples/testing/ - Key Files:
mocks.go,table_driven.go - Interview Topics:
- Table-driven tests
- Mock implementations
- Benchmarking
- Test helpers
Example Questions:
- "Write table-driven tests for a calculator function."
- "How do you mock dependencies in Go tests?"
- Location:
patterns/cmd/cli/ - Key Files:
main.go - Interview Topics:
- Flag parsing
- Subcommands
- Context usage
- CLI design
Example Questions:
- "How do you parse command-line arguments in Go?"
- "Design a CLI with subcommands."
- Location:
operator/api/v1alpha1/ - Key Files:
webserver_types.go,groupversion_info.go - Interview Topics:
- CRD design
- API versioning
- Validation rules
- Status subresources
- Location:
operator/controllers/ - Key Files:
webserver_controller.go - Interview Topics:
- Reconciliation loops
- Resource management
- Owner references
- Status updates
- Location:
operator/config/ - Key Files: RBAC, CRDs, deployments
- Interview Topics:
- RBAC configuration
- Resource manifests
- Operator deployment
Focus: Core Go concepts, patterns, and best practices
Demo Flow:
- Show interface design (
patterns/pkg/interfaces/) - Demonstrate design patterns (
patterns/pkg/patterns/) - Walk through concurrency examples (
patterns/examples/concurrency/) - Explain testing strategies (
patterns/examples/testing/) - Show utility functions (
patterns/pkg/utils/)
Key Talking Points:
- Interface design and dependency injection
- Concurrency patterns and channel usage
- Error handling strategies
- Testing methodologies
Focus: Operator development and Kubernetes integration
Demo Flow:
- Explain CRD design (
operator/api/v1alpha1/) - Walk through controller logic (
operator/controllers/) - Show Kubernetes manifests (
operator/config/) - Demonstrate end-to-end operator functionality
- Access the web server to show it working
Key Talking Points:
- Operator pattern and reconciliation
- Resource management and garbage collection
- RBAC and security considerations
- Status management and conditions
Focus: Both Go fundamentals and Kubernetes knowledge
Demo Flow:
- Start with Go patterns and interfaces
- Show concurrency and testing examples
- Transition to operator development
- Demonstrate end-to-end functionality
- Show CLI tool (
patterns/cmd/cli/)
Key Talking Points:
- Go language features and best practices
- System design and architecture
- Kubernetes operator development
- Production readiness considerations
Task: Implement the Factory pattern in patterns/pkg/patterns/
Skills: Interface design, pattern implementation
Time: 15-20 minutes
Task: Add a new field to the CRD and handle it in the controller Skills: CRD development, controller logic Time: 20-25 minutes
Task: Implement a concurrent processing feature Skills: Goroutines, channels, synchronization Time: 15-20 minutes
Task: Add comprehensive tests for a utility function Skills: Testing, mocking, table-driven tests Time: 10-15 minutes
- "Explain the difference between
makeandnewin Go." - "How do you handle panics in Go applications?"
- "What's the difference between a slice and an array?"
- "Explain Go's garbage collector and how it affects performance."
- "How do you prevent race conditions in Go?"
- "Explain the difference between
sync.Mutexandsync.RWMutex." - "When would you use
selectvsswitchin Go?" - "How do you implement a timeout for a goroutine?"
- "What is the operator pattern and why is it useful?"
- "How do you handle resource conflicts in a controller?"
- "Explain the difference between
CreateOrUpdateandCreatein controller-runtime." - "How do you implement proper error handling in a Kubernetes controller?"
- "How would you design a scalable web service in Go?"
- "Explain how you would implement circuit breakers in Go."
- "How do you handle configuration management in Go applications?"
- "What strategies would you use for graceful shutdown?"
# Show interfaces
cd patterns/pkg/interfaces && go doc Logger
# Show patterns
cd ../patterns && go run observer.go
# Show concurrency
cd ../../examples/concurrency && go run worker_pool.go# Build and deploy
cd operator/
make build
make install
make deploy
# Create instance and show it working
make create-sample
make port-forward
# Open http://localhost:8080# Run the complete demo
cd operator/
./test-demo.sh
# Show the web server
make port-forward
# Open http://localhost:8080
# Clean up
./cleanup.sh- Clean Architecture: Well-organized code with clear separation of concerns
- Interface Design: Proper use of interfaces for testability and flexibility
- Error Handling: Comprehensive error handling with custom error types
- Testing: Table-driven tests and proper mocking strategies
- Concurrency: Safe concurrent programming with proper synchronization
- Production Ready: Proper logging, metrics, and health checks
- Documentation: Comprehensive documentation and examples
- Real-World Application: Actual working operator with tangible results
This project demonstrates both deep Go knowledge and practical Kubernetes operator development skills, making it perfect for a wide range of Go interview scenarios.