Skip to content

Commit

Permalink
Launch: Support multiple instances in the same namespace (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGoyette authored Nov 22, 2023
1 parent a07aac2 commit 54cc79b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion charts/launch-agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: launch-agent
icon: https://em-content.zobj.net/thumbs/240/apple/354/rocket_1f680.png
description: A Helm chart for running the W&B Launch Agent in Kubernetes
type: application
version: 0.11.5
version: 0.11.6
maintainers:
- name: wandb
email: support@wandb.com
Expand Down
2 changes: 1 addition & 1 deletion charts/launch-agent/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ data:
{{ required "Please set launchConfig to the contents of your agent config file" .Values.launchConfig | nindent 4 }}
kind: ConfigMap
metadata:
name: wandb-launch-configmap
name: wandb-launch-configmap-{{ .Release.Name }}
namespace: {{ .Values.namespace }}
...
14 changes: 7 additions & 7 deletions charts/launch-agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: launch-agent
name: launch-agent-{{ .Release.Name }}
namespace: {{ .Values.namespace }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
Expand All @@ -12,16 +12,16 @@ spec:
type: Recreate
selector:
matchLabels:
app: launch-agent
app: launch-agent-{{ .Release.Name }}
template:
metadata:
labels:
app: launch-agent
app: launch-agent-{{ .Release.Name }}
{{- if .Values.agent.labels }}
{{- toYaml .Values.agent.labels | trim | nindent 8 }}
{{- end }}
spec:
serviceAccountName: wandb-launch-serviceaccount
serviceAccountName: wandb-launch-serviceaccount-{{ .Release.Name }}
containers:
- name: launch-agent
image: {{ .Values.agent.image }}
Expand All @@ -40,7 +40,7 @@ spec:
- name: WANDB_API_KEY
valueFrom:
secretKeyRef:
name: wandb-api-key
name: wandb-api-key-{{ .Release.Name }}
key: password
- name: WANDB_LAUNCH_SERVICE_ACCOUNT_NAME
valueFrom:
Expand All @@ -49,7 +49,7 @@ spec:
- name: WANDB_BASE_URL
valueFrom:
configMapKeyRef:
name: wandb-launch-configmap
name: wandb-launch-configmap-{{ .Release.Name }}
key: wandb-base-url
- name: CM_CHECKSUM
value: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
Expand All @@ -70,7 +70,7 @@ spec:
volumes:
- name: wandb-launch-config
configMap:
name: wandb-launch-configmap
name: wandb-launch-configmap-{{ .Release.Name }}
{{ if .Values.gitCreds}}
- name: git-creds
secret:
Expand Down
16 changes: 8 additions & 8 deletions charts/launch-agent/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: wandb-launch-serviceaccount
name: wandb-launch-serviceaccount-{{ .Release.Name }}
namespace: {{ .Values.namespace }}
{{- if .Values.serviceAccount.annotations }}
annotations:
Expand All @@ -13,7 +13,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: {{ .Values.namespace }}
name: wandb-launch-agent
name: wandb-launch-agent-{{ .Release.Name }}
rules:
- apiGroups: [""]
resources: ["pods", "configmaps", "secrets", "pods/log"]
Expand All @@ -26,7 +26,7 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: job-creator-{{ .Release.Name }}
name: wandb-job-creator-{{ .Release.Name }}
rules:
- apiGroups: [""]
resources: ["pods", "pods/log", "secrets"]
Expand All @@ -41,15 +41,15 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: wandb-launch-role-binding
name: wandb-launch-role-binding-{{ .Release.Name }}
namespace: {{ .Values.namespace }}
subjects:
- kind: ServiceAccount
name: wandb-launch-serviceaccount
name: wandb-launch-serviceaccount-{{ .Release.Name }}
namespace: {{ .Values.namespace }}
roleRef:
kind: Role
name: wandb-launch-agent
name: wandb-launch-agent-{{ .Release.Name }}
apiGroup: rbac.authorization.k8s.io
...
{{- define "unique.namespaces" }}
Expand All @@ -64,11 +64,11 @@ metadata:
namespace: {{ $ns }}
subjects:
- kind: ServiceAccount
name: wandb-launch-serviceaccount
name: wandb-launch-serviceaccount-{{ $root.Release.Name }}
namespace: {{ $root.Values.namespace }}
roleRef:
kind: ClusterRole
name: job-creator
name: wandb-job-creator-{{ $root.Release.Name }}
apiGroup: rbac.authorization.k8s.io
...
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/launch-agent/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v1
kind: Secret
metadata:
name: wandb-api-key
name: wandb-api-key-{{ .Release.Name }}
namespace: {{ .Values.namespace }}
type: kubernetes.io/basic-auth
stringData:
Expand Down

0 comments on commit 54cc79b

Please sign in to comment.