apiVersion: karpenter-ibm.sh/v1alpha1
kind: IBMNodeClass
metadata:
  name: multizone-nodeclass
spec:
  apiServerEndpoint: https://10.243.65.4:6443
  bootstrapMode: cloud-init
  image: r010-17a6c2b3-c93b-4018-87ca-f078ef21e02b
  instanceProfile: bx2-2x8
  region: eu-de
  resourceGroup: 88427352321742ef8cfac50b0ee6cc26
  securityGroups:
  - r010-36f045e2-86a1-4af8-917e-b17a41f8abe3
  sshKeys:
  - r010-82091c89-68e4-4b3f-bd2b-4e63ca2f67da
  vpc: r010-2b1c3cdc-a678-4eda-86af-731130de1c0a
  # Zone is omitted to allow automatic zone selection
  # Subnet is omitted to allow automatic subnet selection across zones
  placementStrategy:
    zoneBalance: Balanced  # Distribute nodes evenly across zones
    subnetSelection:
      minimumAvailableIPs: 10  # Only use subnets with at least 10 available IPs
      # Can also add requiredTags if needed:
      # requiredTags:
      #   karpenter: "enabled"
---
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
  name: multizone-nodepool
spec:
  template:
    metadata:
      labels:
        # Add a label to identify nodes from this pool
        nodepool: multizone
    spec:
      requirements:
        - key: karpenter.sh/capacity-type
          operator: In
          values: ["on-demand"]
        - key: kubernetes.io/arch
          operator: In
          values: ["amd64"]
        # Allow nodes in multiple zones
        - key: topology.kubernetes.io/zone
          operator: In
          values: ["eu-de-1", "eu-de-2", "eu-de-3"]
      nodeClassRef:
        group: karpenter-ibm.sh
        kind: IBMNodeClass
        name: multizone-nodeclass
      taints:
        - key: multizone-test
          value: "true"
          effect: NoSchedule
  disruption:
    consolidationPolicy: WhenEmpty
    consolidateAfter: 30s
  limits:
    cpu: "100"
    memory: 100Gi