Skip to content

Commit 59de7ed

Browse files
committed
Merge branch 'main' of github:marimo-team/marimo-operator into dm/qol
2 parents f1ded3d + 2ce47cf commit 59de7ed

5 files changed

Lines changed: 76 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Publish
33
on:
44
push:
55
branches: [main]
6-
tags: ['v*']
6+
tags: ["v*"]
77
workflow_dispatch:
88

99
env:
@@ -20,6 +20,12 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222

23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
2329
- name: Log in to Container Registry
2430
uses: docker/login-action@v3
2531
with:
@@ -42,6 +48,7 @@ jobs:
4248
uses: docker/build-push-action@v5
4349
with:
4450
context: .
51+
platforms: linux/amd64,linux/arm64
4552
push: true
4653
tags: ${{ steps.meta.outputs.tags }}
4754
labels: ${{ steps.meta.outputs.labels }}
@@ -60,6 +67,7 @@ jobs:
6067
uses: docker/build-push-action@v5
6168
with:
6269
context: docker/s3fs
70+
platforms: linux/amd64,linux/arm64
6371
push: true
6472
tags: ${{ steps.s3fs-meta.outputs.tags }}
6573
labels: ${{ steps.s3fs-meta.outputs.labels }}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ A Kubernetes operator for deploying [marimo](https://github.com/marimo-team/mari
1717

1818
## Installation
1919

20+
### Supported Architectures
21+
22+
The operator and s3fs images are built for multiple architectures:
23+
- **linux/amd64** (x86_64)
24+
- **linux/arm64** (aarch64)
25+
26+
Docker will automatically pull the correct image for your platform.
27+
2028
```bash
2129
# Option 1: Install from single manifest
2230
kubectl apply -f https://raw.githubusercontent.com/marimo-team/marimo-operator/main/deploy/install.yaml

pkg/resources/pod.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,25 @@ func applyPodOverrides(base, overrides corev1.PodSpec) corev1.PodSpec {
392392
return base
393393
}
394394

395+
// We diff overrides against an empty PodSpec to produce a patch containing only
396+
// fields the user explicitly set (avoiding null fields from zero-value slices/maps
397+
// that would otherwise wipe out base fields like Containers).
398+
emptyJSON, err := json.Marshal(corev1.PodSpec{})
399+
if err != nil {
400+
return base
401+
}
402+
patch, err := strategicpatch.CreateTwoWayMergePatch(emptyJSON, overridesJSON, corev1.PodSpec{})
403+
if err != nil {
404+
return base
405+
}
406+
395407
patchMeta, err := strategicpatch.NewPatchMetaFromStruct(&corev1.PodSpec{})
396408
if err != nil {
397409
return base
398410
}
399411

400412
merged, err := strategicpatch.StrategicMergePatchUsingLookupPatchMeta(
401-
baseJSON, overridesJSON, patchMeta)
413+
baseJSON, patch, patchMeta)
402414
if err != nil {
403415
return base
404416
}

pkg/resources/pod_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ func TestBuildPod_PodOverrides(t *testing.T) {
310310
if pod.Spec.NodeSelector["gpu"] != "true" {
311311
t.Errorf("expected nodeSelector gpu='true', got '%s'", pod.Spec.NodeSelector["gpu"])
312312
}
313+
if pod.Spec.Containers == nil {
314+
t.Errorf("expected overrides not to touch container")
315+
}
313316
}
314317

315318
func TestBuildPod_CustomPort(t *testing.T) {

test/e2e/e2e_test.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,49 @@ spec:
441441
_, _ = utils.Run(cmd)
442442
})
443443

444+
It("should add volumes from podOverrides", func() {
445+
notebookName := "e2e-pod-overrides"
446+
447+
By("creating a MarimoNotebook with podOverrides volumes")
448+
notebookYAML := fmt.Sprintf(`
449+
apiVersion: marimo.io/v1alpha1
450+
kind: MarimoNotebook
451+
metadata:
452+
name: %s
453+
namespace: %s
454+
spec:
455+
source: "https://github.com/marimo-team/marimo.git"
456+
podOverrides:
457+
volumes:
458+
- name: ssh-pubkey
459+
secret:
460+
secretName: ssh-pubkey
461+
defaultMode: 0600
462+
`, notebookName, testNamespace)
463+
464+
yamlFile := filepath.Join("/tmp", notebookName+".yaml")
465+
err := os.WriteFile(yamlFile, []byte(notebookYAML), 0644)
466+
Expect(err).NotTo(HaveOccurred())
467+
468+
cmd := exec.Command("kubectl", "apply", "-f", yamlFile)
469+
_, err = utils.Run(cmd)
470+
Expect(err).NotTo(HaveOccurred(), "Failed to create MarimoNotebook")
471+
472+
By("verifying Pod has the overridden volume")
473+
verifyVolumePresent := func(g Gomega) {
474+
cmd := exec.Command("kubectl", "get", "pod", notebookName, "-n", testNamespace,
475+
"-o", `jsonpath={.spec.volumes[?(@.name=="ssh-pubkey")].secret.secretName}`)
476+
output, err := utils.Run(cmd)
477+
g.Expect(err).NotTo(HaveOccurred())
478+
g.Expect(output).To(Equal("ssh-pubkey"))
479+
}
480+
Eventually(verifyVolumePresent, 2*time.Minute, time.Second).Should(Succeed())
481+
482+
By("cleaning up")
483+
cmd = exec.Command("kubectl", "delete", "marimo", notebookName, "-n", testNamespace)
484+
_, _ = utils.Run(cmd)
485+
})
486+
444487
It("should create sidecar containers with exposed ports", func() {
445488
notebookName := "e2e-sidecar"
446489

0 commit comments

Comments
 (0)