Skip to content

Commit

Permalink
W&B Server operator chart (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks authored Jul 12, 2023
1 parent 43142fe commit 4eb4923
Show file tree
Hide file tree
Showing 19 changed files with 565 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vscode/
.vscode/
dryrun.yaml
2 changes: 1 addition & 1 deletion charts/launch-agent/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ kind: ConfigMap
metadata:
name: wandb-launch-configmap
namespace: {{ .Values.namespace }}
...
...

This comment has been minimized.

Copy link
@bcsherma

bcsherma Jul 12, 2023

Contributor

@jsbroks this is what triggered the agent release. If you remove this from the branch and rerun the workflow I think it will work. Should have realized this sooner

This comment has been minimized.

Copy link
@bcsherma

bcsherma Jul 12, 2023

Contributor

Actually I think I should just do a quick PR bumping the agent version

23 changes: 23 additions & 0 deletions charts/operator/.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/
10 changes: 10 additions & 0 deletions charts/operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: operator
description: A Helm chart for Weights & Biases operator
type: application
version: 0.1.0
appVersion: "1.0.0"
maintainers:
- name: wandb
email: [email protected]
url: https://wandb.com
18 changes: 18 additions & 0 deletions charts/operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Weights & Biases Operator

# Operator

## Install

```
helm repo add wandb https://wandb.github.io/helm-charts
helm upgrade --install operator wandb/operator
```

## Install from source

```
git clone https://github.com/wandb/helm-charts.git
cd helm-charts
helm upgrade --namespace=wandb --create-namespace --install operator .
```
59 changes: 59 additions & 0 deletions charts/operator/crds/wandb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: weightsandbiases.apps.wandb.com
spec:
group: apps.wandb.com
names:
kind: WeightsAndBiases
listKind: WeightsAndBiasesList
plural: weightsandbiases
shortNames:
- wandb
singular: weightsandbiases
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: WeightsAndBiases is the Schema for the weightsandbiases API
properties:
apiVersion:
description:
"APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources"
type: string
kind:
description:
"Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
type: string
metadata:
type: object
spec:
description: WeightsAndBiasesSpec defines the desired state of WeightsAndBiases
properties:
config:
description: Unstructured values for rendering CDK8s Config.
type: object
license:
type: string
version:
type: string
type: object
status:
description: WeightsAndBiasesStatus defines the observed state of WeightsAndBiases
properties:
phase:
type: string
version:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
63 changes: 63 additions & 0 deletions charts/operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "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 "operator.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 "operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the manager service account to use
*/}}
{{- define "manager.serviceAccount.name" -}}
{{- if .Values.manager.serviceAccount.create }}
{{- $name := printf "%s-%s" (include "name" .) "manager" }}
{{- default $name .Values.manager.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.manager.serviceAccount.name }}
{{- end }}
{{- end }}
66 changes: 66 additions & 0 deletions charts/operator/templates/manager/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
control-plane: controller-manager
name: {{ include "name" . }}-controller-manager
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
control-plane: controller-manager
template:
metadata:
annotations: {{- toYaml .Values.podAnnotations | nindent 8 }}
labels:
control-plane: controller-manager
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
containers:
- name: manager
command:
- /manager
args:
- --leader-elect
{{- if .Values.manager.debug.enabled }}
- --zap-devel=true
{{- end }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
{{- if .Values.image.pullPolicy }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
{{- end }}
env:
{{- if .Values.extraEnv }}
{{- toYaml .Values.extraEnvs | nindent 8 }}
{{- end }}
- name: WANDB_MANAGER_SERVICE_ACCOUNT
value: {{ include "manager.serviceAccount.name" . }}
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
resources: {{- toYaml .Values.resources | nindent 10 }}
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=10
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.5.0
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
serviceAccountName: {{ include "manager.serviceAccount.name" . }}
terminationGracePeriodSeconds: 10
38 changes: 38 additions & 0 deletions charts/operator/templates/manager/leader-election-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# permissions to do leader election.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "name" . }}-leader-election-role
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
13 changes: 13 additions & 0 deletions charts/operator/templates/manager/leader-election-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "name" . }}-leader-election-rolebinding
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "name" . }}-leader-election-role
subjects:
- kind: ServiceAccount
name: {{ include "manager.serviceAccount.name" . }}
namespace: {{ .Release.Namespace }}
9 changes: 9 additions & 0 deletions charts/operator/templates/manager/metrics-clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "name" . }}-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
15 changes: 15 additions & 0 deletions charts/operator/templates/manager/metrics-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: controller-manager
name: {{ include "name" . }}-controller-manager-metrics-service
namespace: {{ .Release.Namespace }}
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
control-plane: controller-manager
17 changes: 17 additions & 0 deletions charts/operator/templates/manager/proxy-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "name" . }}-proxy-role
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
12 changes: 12 additions & 0 deletions charts/operator/templates/manager/proxy-rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "name" . }}-proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "name" . }}-proxy-role
subjects:
- kind: ServiceAccount
name: {{ include "manager.serviceAccount.name" . }}
namespace: {{ .Release.Namespace }}
Loading

0 comments on commit 4eb4923

Please sign in to comment.