# NextJS Slack Clone Helm Chart

This Helm chart deploys the NextJS Slack Clone application to a Kubernetes cluster.

## Prerequisites

- Kubernetes 1.19+
- Helm 3.2.0+

## Installing the Chart

To install the chart with the release name `my-release`:

```bash
# For deployments without private registry
helm install my-release ./helm/nextjs-slack-clone

# For deployments with private registry authentication
helm install my-release ./helm/nextjs-slack-clone \
  --set registry.username=your-username \
  --set registry.password=your-password
```

## Configuration

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

### Private Registry Authentication

This Helm chart supports pulling images from a private Docker registry with basic authentication. Configure the following values:

| Parameter | Description | Default |
|-----------|-------------|---------|
| `registry.url` | URL of the private registry | `registry.mattiaswiberg.com` |
| `registry.username` | Username for registry authentication | `""` |
| `registry.password` | Password for registry authentication | `""` |

For security reasons, it's recommended to provide the registry credentials during installation rather than storing them in the values.yaml file.

| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `replicaCount` | Number of replicas | `1` |
| `image.repository` | Image repository | `nextjs-slack-clone` |
| `image.tag` | Image tag | `latest` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `service.type` | Kubernetes service type | `ClusterIP` |
| `service.port` | Kubernetes service port | `80` |
| `service.targetPort` | Application port | `3000` |
| `ingress.enabled` | Enable ingress | `false` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `env.NEXT_PUBLIC_SUPABASE_URL` | Supabase URL | `""` |
| `env.NEXT_PUBLIC_SUPABASE_ANON_KEY` | Supabase anonymous key | `""` |

## Setting Environment Variables

To set the required Supabase environment variables, use the `--set` flag when installing the chart:

```bash
helm install my-release ./helm/nextjs-slack-clone \
  --set env.NEXT_PUBLIC_SUPABASE_URL=your-supabase-url \
  --set env.NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
```

Alternatively, you can create a custom values file with your environment variables:

```yaml
# my-values.yaml
env:
  NEXT_PUBLIC_SUPABASE_URL: your-supabase-url
  NEXT_PUBLIC_SUPABASE_ANON_KEY: your-supabase-anon-key
```

And then install the chart using:

```bash
helm install my-release ./helm/nextjs-slack-clone -f my-values.yaml
```

## Enabling Ingress

To enable the ingress and configure a hostname:

```bash
helm install my-release ./helm/nextjs-slack-clone \
  --set ingress.enabled=true \
  --set ingress.hosts[0].host=your-hostname.com \
  --set ingress.hosts[0].paths[0].path=/ \
  --set ingress.hosts[0].paths[0].pathType=Prefix
```
