A Kubernetes controller for managing Vibbit custom resources.
The Vibbit Controller is a Kubernetes operator that manages Vibbit custom resources. A Vibbit resource simulates a vibration with a specified frequency, amplitude, and duration. The controller manages the lifecycle of these resources from initialization to completion.
- Kubernetes cluster (v1.20+)
kubectl
configured to communicate with your cluster- Go (v1.20+)
- Docker (for building container images)
- Clone the repository:
git clone https://github.com/your-org/vibbit-controller.git
cd vibbit-controller
- Install the CustomResourceDefinition (CRD):
kubectl apply -f config/crd/vibbits.yaml
- Build and run the controller (see Development section for more details).
- Create a YAML file (e.g.,
my-vibbit.yaml
) with your Vibbit configuration:
apiVersion: otomato.io/v1
kind: Vibbit
metadata:
name: my-vibbit
spec:
frequency: 60 # Hz (1-1000)
amplitude: 75 # Percentage (0-100)
duration: 30 # Seconds (minimum 1)
- Apply the configuration:
kubectl apply -f my-vibbit.yaml
You can monitor the status of your Vibbit resources using standard kubectl commands:
# List all Vibbit resources
kubectl get vibbits
# Get detailed information about a specific Vibbit
kubectl describe vibbit my-vibbit
The Vibbit resource will transition through the following states:
Pending
: Initial state after creationRunning
: Processing the vibrationCompleted
: Successfully finished the vibrationFailed
: An error occurred during processing
- Ensure dependencies are up to date:
go mod tidy
- Build the controller:
make build
This will create a binary at bin/manager
.
To run the controller locally against your Kubernetes cluster:
./bin/manager
Or use the Makefile target:
make run
Run tests with:
make test
- Build the controller image:
make docker-build IMG=your-registry/vibbit-controller:tag
- Push the image to a registry:
make docker-push IMG=your-registry/vibbit-controller:tag
-
Update the deployment configuration in
config/deployment.yaml
with your image. -
Deploy the controller:
make deploy
Or manually:
kubectl apply -f config/crd/vibbits.yaml
kubectl apply -f config/deployment.yaml
- CRD not found
If you get an error like "the server doesn't have a resource type 'vibbits'", ensure the CRD is properly installed:
kubectl get crd vibbits.otomato.io
- Controller logs
Check the controller logs for errors:
kubectl logs -l app=vibbit-controller -n <controller-namespace>
- Build errors
If you encounter "missing go.sum entry" errors, run:
go mod tidy
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request