Skip to content

otomato-gh/vibbit-controller

Repository files navigation

Vibbit Controller

A Kubernetes controller for managing Vibbit custom resources.

Table of Contents

Overview

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.

Getting Started

Prerequisites

  • Kubernetes cluster (v1.20+)
  • kubectl configured to communicate with your cluster
  • Go (v1.20+)
  • Docker (for building container images)

Installation

  1. Clone the repository:
git clone https://github.com/your-org/vibbit-controller.git
cd vibbit-controller
  1. Install the CustomResourceDefinition (CRD):
kubectl apply -f config/crd/vibbits.yaml
  1. Build and run the controller (see Development section for more details).

Usage

Creating a Vibbit Resource

  1. 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)
  1. Apply the configuration:
kubectl apply -f my-vibbit.yaml

Monitoring Vibbit Resources

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 creation
  • Running: Processing the vibration
  • Completed: Successfully finished the vibration
  • Failed: An error occurred during processing

Development

Building the Controller

  1. Ensure dependencies are up to date:
go mod tidy
  1. Build the controller:
make build

This will create a binary at bin/manager.

Running the Controller Locally

To run the controller locally against your Kubernetes cluster:

./bin/manager

Or use the Makefile target:

make run

Testing

Run tests with:

make test

Deployment

Building the Docker Image

  1. Build the controller image:
make docker-build IMG=your-registry/vibbit-controller:tag
  1. Push the image to a registry:
make docker-push IMG=your-registry/vibbit-controller:tag

Deploying to Kubernetes

  1. Update the deployment configuration in config/deployment.yaml with your image.

  2. Deploy the controller:

make deploy

Or manually:

kubectl apply -f config/crd/vibbits.yaml
kubectl apply -f config/deployment.yaml

Troubleshooting

Common Issues

  1. 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
  1. Controller logs

Check the controller logs for errors:

kubectl logs -l app=vibbit-controller -n <controller-namespace>
  1. Build errors

If you encounter "missing go.sum entry" errors, run:

go mod tidy

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published