Skip to content

Commit

Permalink
working otel
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Oct 16, 2023
1 parent f9b29df commit d52f377
Show file tree
Hide file tree
Showing 14 changed files with 648 additions and 49 deletions.
9 changes: 6 additions & 3 deletions charts/operator-wandb/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ dependencies:
version: 0.1.0
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 18.1.0
digest: sha256:0e062062405e017968fb5ad0e5064936cb55e2b441ddb1c2048f34eaf6de11a8
generated: "2023-09-27T12:33:43.680199603-04:00"
version: 18.1.5
- name: otel
repository: file://charts/otel
version: 0.1.0
digest: sha256:d6f7dbed1f8fcbbd34d18b0911891fb27eeef0021092b69ea35e7ca5dcede038
generated: "2023-10-16T19:07:10.090393-04:00"
7 changes: 3 additions & 4 deletions charts/operator-wandb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ dependencies:
version: "18.*.*"
condition: redis.install
repository: https://charts.bitnami.com/bitnami
- name: opentelemetry-collector
version: "0.70.*"
- name: otel
version: "*.*.*"
repository: file://charts/otel
condition: otel.install
alias: otel
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
8 changes: 4 additions & 4 deletions charts/operator-wandb/charts/console/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ resources:
# specify resources, uncomment the following lines, adjust them as necessary,
# and remove the curly braces after 'resources:'.
requests:
cpu: 500m
memory: 1Gi
cpu: 200m
memory: 200Mi
limits:
cpu: 4000m
memory: 8Gi
cpu: 1
memory: 500Mi
23 changes: 23 additions & 0 deletions charts/operator-wandb/charts/otel/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions charts/operator-wandb/charts/otel/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
name: otel
type: application
description: A Helm chart for Kubernetes

version: 0.1.0
appVersion: "0.33.0"

home: https://wandb.ai
icon: https://wandb.ai/logo.svg

maintainers:
- name: wandb
email: [email protected]
url: https://wandb.com
87 changes: 87 additions & 0 deletions charts/operator-wandb/charts/otel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Local

- [Local](#local)
- [Requirements](#requirements)
- [Configuration](#configuration)
- [Globals](#globals)
- [Options](#options)
- [Chart configuration examples](#chart-configuration-examples)
- [extraEnv](#extraenv)
- [extraEnvFrom](#extraenvfrom)
- [extraEnvFrom](#extraenvfrom-1)

## Requirements

This chart depends on Redis, Bucket and MySQL services, either as part of the
complete W&B Server chart or provided as external services reachable from the
Kubernetes cluster this chart is deployed onto.

## Configuration

### Globals

### Options

| Parameter | Default | Description |
| ------------------- | ------------- | -------------------------------------------------------------------------------------------------- |
| `enabled` | `true` | Server enable flag |
| `priorityClassName` | `""` | Allow configuring pods priorityClassName, this is used to control pod priority in case of eviction |
| `common.labels` | | Supplemental labels that are applied to all objects created by this chart. |
| `podLabels` | | Supplemental Pod labels. Will not be used for selectors. |
| `extraEnv` | | List of extra environment variables to expose |
| `extraEnvFrom` | | List of extra environment variables from other data sources to expose |
| `image.pullPolicy` | `Always` | Server image pull policy |
| `image.pullSecrets` | | Secrets for the image repository |
| `image.repository` | `wandb/local` | Server image repository |
| `image.tag` | | Server image tag |
| `tolerations` | `[]` | Toleration labels for pod assignment |

### Chart configuration examples

#### extraEnv

#### extraEnvFrom

`extraEnv` allows you to expose additional environment variables in all
containers in the pods.

```yaml
extraEnv:
SOME_KEY: some_value
SOME_OTHER_KEY: some_other_value
```
When the container is started, you can confirm that the environment variables
are exposed:
Below is an example use of extraEnv:
```bash
env | grep SOME
SOME_KEY=some_value
SOME_OTHER_KEY=some_other_value
```

#### extraEnvFrom

`extraEnvFrom` allows you to expose additional environment variables from other
data sources in all containers in the pods. Subsequent variables can be
overridden per deployment.

Below is an example use of `extraEnvFrom`:

```yaml
extraEnvFrom:
MY_NODE_NAME:
fieldRef:
fieldPath: spec.nodeName
MY_CPU_REQUEST:
resourceFieldRef:
containerName: test-container
resource: requests.cpu
SECRET_THING:
secretKeyRef:
name: special-secret
key: special_token
# optional: boolean
```
102 changes: 102 additions & 0 deletions charts/operator-wandb/charts/otel/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Expand the name of the chart.
*/}}
{{- define "otel.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "otel.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "otel.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "otel.labels" -}}
helm.sh/chart: {{ include "otel.chart" . }}
{{ include "otel.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
wandb.com/app-name: {{ include "otel.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "otel.selectorLabels" -}}
app.kubernetes.io/name: {{ include "otel.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "otel.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "otel.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Returns the extraEnv keys and values to inject into containers.
Global values will override any chart-specific values.
*/}}
{{- define "otel.extraEnv" -}}
{{- $allExtraEnv := merge (default (dict) .local.extraEnv) .global.extraEnv -}}
{{- range $key, $value := $allExtraEnv }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end -}}
{{- end -}}

{{/*
Returns a list of _common_ labels to be shared across all
app deployments and other shared objects.
*/}}
{{- define "otel.commonLabels" -}}
{{- $commonLabels := default (dict) .Values.common.labels -}}
{{- if $commonLabels }}
{{- range $key, $value := $commonLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end -}}
{{- end -}}

{{/*
Returns a list of _pod_ labels to be shared across all
app deployments.
*/}}
{{- define "otel.podLabels" -}}
{{- range $key, $value := .Values.pod.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end -}}

Loading

0 comments on commit d52f377

Please sign in to comment.