kind: DaemonSet
{{- if .Capabilities.APIVersions.Has "apps/v1" }}
apiVersion: apps/v1
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}

metadata:
  name: swift-servers
  labels:
    release: "{{.Release.Name}}"
    on-upgrade: rolling-recreate

spec:
  minReadySeconds: 60 # longer wait here to be extra sure that the new servers are operational
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      component: swift-servers
  template:
    metadata:
      labels:
        component: swift-servers
        from: daemonset
        restart: carefully
      annotations:
        {{- include "swift_conf_annotations" . | indent 8 }}
        {{- include "swift_ring_annotations" . | indent 8 }}
    spec:
      {{- include "swift_daemonset_tolerations" . | indent 6 }}
      hostNetwork: true
      nodeSelector:
        species: {{ .Values.species }}
      volumes: {{ include "swift_daemonset_volumes" . | indent 8 }}
      containers:
        {{- tuple "object"    "object-server"    . | include "swift_standard_container" | indent 8 }}
          ports:
            - name: swift-object
              hostPort: 6000
              containerPort: 6000
        {{- tuple "container" "container-server" . | include "swift_standard_container" | indent 8 }}
          ports:
            - name: swift-container
              hostPort: 6001
              containerPort: 6001
        {{- tuple "account"   "account-server"   . | include "swift_standard_container" | indent 8 }}
          ports:
            - name: swift-account
              hostPort: 6002
              containerPort: 6002
