Skip to content

Commit

Permalink
Merge pull request #2 from whylabs/aberg/langkit-chart-updates
Browse files Browse the repository at this point in the history
Updating LangKit Helm Chart
  • Loading branch information
andyndang authored Jan 19, 2024
2 parents bcc1edd + 6dd9675 commit cc6811d
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 43 deletions.
75 changes: 73 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,73 @@
# charts
Helm charts for WhyLabs
# Helm Charts for WhyLabs

## How to use WhyLabs Helm repository

### Example Using the [LangKit Helm Chart](./charts/langkit/)

#### Quick Start
```shell
helm pull \
oci://ghcr.io/whylabs/langkit \
--version "0.2.0"

helm diff upgrade \
--allow-unreleased \
`# set namespace.create to false if the target namespace already exists` \
--set namespace.create=false \
--namespace langkit \
langkit langkit-0.2.0.tgz

helm upgrade --install \
`# set namespace.create to false if the target namespace already exists` \
--set namespace.create=false \
--namespace langkit \
langkit langkit-0.2.0.tgz
```

#### Extended Example
```shell
# Configure local variables for clarity and simplicity
helm_repo="ghcr.io/whylabs"
chart_name="langkit"
chart_version="0.2.0"
chart="${chart_name}-${chart_version}.tgz"

# Release and namespace values mirror other variables for simplicity.
# Set these to as desired
release="${chart_name}"
namespace="${release}"

# Downloads <chart_name>-<chart_version>.tgz to your current directory
helm pull \
"oci://${helm_repo}/${chart_name}" \
--version "${chart_version}"

# Performs a diff between current and proposed state
# --allow-unreleased flag will perform a diff even if there is no current state,
# i.e. a fresh installation will display all net new resource creation in the diff.
# --set namespace.create=false must be set if target namespace already exists;
# omit this line or set it to "true" if the target namespace should be created.
# Requires the helm-diff plugin to be installed:
# helm plugin install https://github.com/databus23/helm-diff
helm diff upgrade \
--allow-unreleased \
`# set namespace.create to false if the target namespace already exists` \
--set namespace.create=false \
--namespace "${namespace}" \
"${release}" "${chart}"

# helm upgrade --install supports installation and upgrades.
# In the `helm upgrade --install <release-name> <chart>` command, the chart may be
# a chart reference('example/postgres'), a path to a chart directory, a fully qualified
# URL, or a packaged chart (which is what this example uses)
helm upgrade --install \
`# set namespace.create to false if the target namespace already exists` \
--set namespace.create=false \
--namespace "${namespace}" \
"${release}" "${chart}"

# Uninstall
helm uninstall \
--namespace "${namespace}" \
"${release}"
```
6 changes: 3 additions & 3 deletions charts/langkit/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: langkit
description: A Helm chart for Kubernetes
description: A Helm chart for LangKit container deployment
type: application
version: 0.1.0
appVersion: "1.16.0"
version: 0.2.0
appVersion: "0.0.28"
38 changes: 20 additions & 18 deletions charts/langkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,34 @@ kubectl create secret generic langkit-api-secret \
## Usage

### Template
Display the full YAML manifests as they will be applied.

```shell
# This will use the "langkit" namespace
helm template \
--namespace langkit \
langkit .
helm template --namespace langkit langkit .
```

### Diff
View the difference between the current state and desired state.

```shell
# Requires the helm-diff plugin to be installed:
# helm plugin install https://github.com/databus23/helm-diff
helm diff \
helm diff upgrade \
--allow-unreleased \
`# do not create namespace if it already exists` \
--set namespace.create=false \
--namespace langkit \
--allow-unreleased \
upgrade \
langkit .
langkit langkit-0.2.0.tgz
```

### Install/Update
```shell
helm upgrade \
helm upgrade --install \
`# do not create namespace if it already exists` \
--set namespace.create=false \
--namespace langkit \
--install \
langkit .
langkit langkit-0.2.0.tgz
```

### Uninstall
Expand All @@ -72,32 +72,34 @@ helm-docs --dry-run

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchExpressions[0].key | string | `"app.kubernetes.io/name"` | |
| affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchExpressions[0].operator | string | `"In"` | |
| affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.labelSelector.matchExpressions[0].values[0] | string | `"langkit"` | |
| affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].podAffinityTerm.topologyKey | string | `"kubernetes.io/hostname"` | |
| affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[0].weight | int | `100` | |
| fullnameOverride | string | `""` | |
| image.containerPort | int | `8000` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"whylabs/whylogs"` | |
| image.tag | string | `"py-llm-latest"` | |
| imagePullSecrets | list | `[]` | |
| livenessProbe.initialDelaySeconds | int | `15` | |
| livenessProbe.periodSeconds | int | `10` | |
| livenessProbe.tcpSocket.port | int | `8000` | |
| nameOverride | string | `""` | |
| namespace.create | bool | `true` | |
| namespace.name | string | `nil` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podLabels | object | `{}` | |
| podSecurityContext | object | `{}` | |
| readinessProbe.initialDelaySeconds | int | `15` | |
| readinessProbe.periodSeconds | int | `10` | |
| readinessProbe.tcpSocket.port | int | `8000` | |
| replicaCount | int | `3` | |
| resources.limits.cpu | string | `"8"` | |
| resources.limits.memory | string | `"16Gi"` | |
| resources.requests.cpu | string | `"4"` | |
| resources.requests.memory | string | `"8Gi"` | |
| secrets.langkitApiSecret | string | `"langkit-api-secret"` | from-literal=LANGKIT_API_KEY=<langkit-api-key> |
| secrets.whylabsApiKey | string | `"whylabs-api-key"` | from-literal=WHYLABS_API_KEY=<whylabs-api-key> |
| secrets.langkitApiSecret | object | `{"name":"langkit-api-secret"}` | |
| secrets.whylabsApiKey | object | `{"name":"whylabs-api-key"}` | |
| securityContext | object | `{}` | |
| service.port | int | `8000` | |
| service.port | int | `80` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.automount | bool | `true` | |
Expand Down
8 changes: 3 additions & 5 deletions charts/langkit/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
- containerPort: {{ .Values.image.containerPort }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
Expand All @@ -47,9 +45,9 @@ spec:
{{- toYaml .Values.resources | nindent 12 }}
envFrom:
- secretRef:
name: {{ .Values.secrets.whylabsApiKey }}
name: {{ .Values.secrets.whylabsApiKey.name }}
- secretRef:
name: {{ .Values.secrets.langkitApiSecret }}
name: {{ .Values.secrets.langkitApiSecret.name }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
Expand Down
7 changes: 3 additions & 4 deletions charts/langkit/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ metadata:
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.image.containerPort }}
selector:
{{- include "langkit.selectorLabels" . | nindent 4 }}
27 changes: 16 additions & 11 deletions charts/langkit/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ image:
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: py-llm-latest
containerPort: 8000

imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -43,15 +44,17 @@ secrets:
# kubectl create secret generic langkit-api-secret \
# --namespace=langkit \
# --from-literal=WHYLABS_API_KEY=<whylabs-api-key>
whylabsApiKey: whylabs-api-key
whylabsApiKey:
name: whylabs-api-key
# kubectl create secret generic langkit-api-secret \
# --namespace=langkit \
# --from-literal=LANGKIT_API_KEY=<langkit-api-key>
langkitApiSecret: langkit-api-secret
langkitApiSecret:
name: langkit-api-secret

service:
type: ClusterIP
port: 8000
port: 80

resources:
requests:
Expand All @@ -61,14 +64,16 @@ resources:
cpu: "8"
memory: 16Gi

# livenessProbe:
# httpGet:
# path: /health
# port: http
# readinessProbe:
# httpGet:
# path: /health
# port: http
livenessProbe:
tcpSocket:
port: 8000
initialDelaySeconds: 15
periodSeconds: 10
readinessProbe:
tcpSocket:
port: 8000
initialDelaySeconds: 15
periodSeconds: 10

nodeSelector: {}

Expand Down

0 comments on commit cc6811d

Please sign in to comment.