Add maintenance toleration for caas-registry
[ta/caas-registry.git] / ansible / roles / swift / templates / main / swift_main.yml
1 {#
2 Copyright 2019 Nokia
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8     http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 #}
16 ---
17 apiVersion: apps/v1
18 kind: DaemonSet
19 metadata:
20   name: swift
21   namespace: kube-system
22 spec:
23   selector:
24     matchLabels:
25       name: swift
26   template:
27     metadata:
28       labels:
29         name: swift
30     spec:
31       priorityClassName: "system-cluster-critical"
32       hostNetwork: true
33       dnsPolicy: ClusterFirstWithHostNet
34       nodeSelector:
35         nodetype: caas_master
36       tolerations:
37       - key: "node-maintenancemode"
38         value: "enabled"
39         operator: "Equal"
40         effect: "NoExecute"
41       securityContext:
42         runAsUser: {{ caas.uid.swift }}
43       containers:
44         - name: swift
45           image: {{ container_image_names | select('search', '/swift') | list | last }}
46           securityContext:
47             capabilities:
48               add: ["NET_BIND_SERVICE", "SETGID", "SETUID"]
49           args:
50             - BACKEND
51           resources:
52             limits:
53               cpu: "1"
54               memory: "4Gi"
55             requests:
56               cpu: "200m"
57               memory: "1Gi"
58           env:
59             - name: "SWIFT_USER"
60               value: "{{ caas.swift_credential.user }}"
61             - name: "SWIFT_TENANT"
62               value: "{{ caas.swift_credential.tenant }}"
63             - name: "SWIFT_PASS"
64               value: "{{ caas.swift_credential.password }}"
65             - name: "SWIFT_PART_POWER"
66               value: "7"
67             - name: "SWIFT_PART_HOUR"
68               value: "0"
69             - name: "SWIFT_DISK"
70               value: "swift"
71             - name: "SWIFT_REPLICAS"
72               value: "{{groups['caas_master']|length|int}}"
73 {% for host in groups['caas_master']%}
74             - name: "SWIFT_OAM{{loop.index}}_IP"
75               value: "{{ hostvars[host]['networking']['infra_internal']['ip'] }}"
76 {% endfor %}
77             - name: "SWIFT_URL"
78               value: "{{ caas.swift }}"
79           volumeMounts:
80             - name: config
81               mountPath: /etc/swift/
82             - name: store
83               mountPath: /srv/node/swift
84           livenessProbe:
85             exec:
86               command:
87                 - /bin/bash
88                 - /usr/bin/healthchecker.sh
89             initialDelaySeconds: 60
90             periodSeconds: 10
91             failureThreshold: 5
92             timeoutSeconds: 3
93       volumes:
94         - name: config
95           hostPath:
96             path: /etc/swift/main/
97         - name: store
98           hostPath:
99             path: /srv/node/swift