{% set heapster_memory = "300Mi" -%}
{% if pillar['num_nodes'] is defined -%}
  {% set heapster_memory = (200 + pillar['num_nodes'] * 12)|string + "Mi" -%}
{% endif -%}

apiVersion: v1
kind: ReplicationController
metadata:
  name: heapster-v10
  namespace: kube-system
  labels:
    k8s-app: heapster
    version: v10
    kubernetes.io/cluster-service: "true"
spec:
  replicas: 1
  selector:
    k8s-app: heapster
    version: v10
  template:
    metadata:
      labels:
        k8s-app: heapster
        version: v10
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
        - image: gcr.io/google_containers/heapster:v0.18.2
          name: heapster
          resources:
            limits:
              cpu: 100m
              memory: {{ heapster_memory }}
          command:
            - /heapster
            - --source=kubernetes:''
