# Copyright 2026 Zyvor · https://zyvor.dev
# SPDX-License-Identifier: Apache-2.0
#
# Machines spread over several Macs. Each Mac runs kairon-node (registers itself as a Node) and FluxVM (`fluxctl serve`).
# NODE_NAME on each Mac sets the Node name used below. Multi-Mac clusters are not yet verified; see docs/macos-cluster.md.
#
#   studio-1  Mac Studio, also serves models (kairon-node --mlx-url ...): gets a gateway VM next to the models
#   mini-1    Mac mini: gets a small CI runner
#   studio-2, studio-3  Mac Studios cabled over Thunderbolt, kairon-node --thunderbolt-fabric=studio-rack
#             --mac-fabric-secret-file=...: two workers on one private network across them (docs/guides/mac-fabric.md)
---
apiVersion: kairon.zyvor.dev/v1
kind: Machine
metadata:
  name: inference-gateway
  namespace: default
spec:
  image:
    path: /Users/you/Library/Application Support/FluxVM/images/debian-13-arm64.raw
  resources:
    cpu: "2"
    memory: 2Gi
  runtime:
    backend: vz
  powerState: Running
  cloudInit:
    hostname: inference-gateway
    user: velora
    sshAuthorizedKeys:
      - ssh-ed25519 AAAA... you@mac
  placement:
    architecture: arm64
    nodeSelector:
      kairon.zyvor.dev/backend.vz: "true"
      kairon.zyvor.dev/mlx: "true"
    tolerations:
      - key: kairon.zyvor.dev/vm-only
        operator: Exists
        effect: NoSchedule
---
apiVersion: kairon.zyvor.dev/v1
kind: Machine
metadata:
  name: ci-runner
  namespace: default
spec:
  image:
    path: /Users/you/Library/Application Support/FluxVM/images/debian-13-arm64.raw
  resources:
    cpu: "2"
    memory: 3Gi
  runtime:
    backend: vz
  powerState: Running
  cloudInit:
    hostname: ci-runner
    user: velora
    sshAuthorizedKeys:
      - ssh-ed25519 AAAA... you@mac
  placement:
    architecture: arm64
    nodeSelector:
      kairon.zyvor.dev/backend.vz: "true"
      kubernetes.io/hostname: mini-1
    tolerations:
      - key: kairon.zyvor.dev/vm-only
        operator: Exists
        effect: NoSchedule
---
apiVersion: kairon.zyvor.dev/v1
kind: MacNetwork
metadata:
  name: rack-net
  namespace: default
spec:
  fabric: studio-rack
  mtu: 9000
---
apiVersion: kairon.zyvor.dev/v1
kind: Machine
metadata:
  name: worker-0
  namespace: default
  labels:
    app: rack-worker
spec:
  image:
    path: /Users/you/Library/Application Support/FluxVM/images/debian-13-arm64.raw
  resources:
    cpu: "4"
    memory: 16Gi
  runtime:
    backend: vz
  powerState: Running
  cloudInit:
    hostname: worker-0
    user: velora
    sshAuthorizedKeys:
      - ssh-ed25519 AAAA... you@mac
  apple:
    minChipGeneration: 3
    rosetta: true
    networks: [rack-net]
  placement:
    antiAffinity:
      - labelSelector:
          app: rack-worker
        topologyKey: kubernetes.io/hostname
---
apiVersion: kairon.zyvor.dev/v1
kind: Machine
metadata:
  name: worker-1
  namespace: default
  labels:
    app: rack-worker
spec:
  image:
    path: /Users/you/Library/Application Support/FluxVM/images/debian-13-arm64.raw
  resources:
    cpu: "4"
    memory: 16Gi
  runtime:
    backend: vz
  powerState: Running
  cloudInit:
    hostname: worker-1
    user: velora
    sshAuthorizedKeys:
      - ssh-ed25519 AAAA... you@mac
  apple:
    minChipGeneration: 3
    rosetta: true
    networks: [rack-net]
  placement:
    antiAffinity:
      - labelSelector:
          app: rack-worker
        topologyKey: kubernetes.io/hostname
