Add maintenance toleration for caas-registry
[ta/caas-registry.git] / ansible / roles / swift / templates / update / swift_update.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-update
21   namespace: kube-system
22 spec:
23   selector:
24     matchLabels:
25       name: swift-update
26   template:
27     metadata:
28       labels:
29         name: swift-update
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-update
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               memory: "4Gi"
54             requests:
55               cpu: "200m"
56               memory: "1Gi"
57           env:
58             - name: "SWIFT_PART_POWER"
59               value: "7"
60             - name: "SWIFT_PART_HOUR"
61               value: "0"
62             - name: "SWIFT_DISK"
63               value: "swift"
64             - name: "SWIFT_REPLICAS"
65               value: "1"
66             - name: "SWIFT_OAM1_IP"
67               value: "{{ hostvars[groups.caas_master[0]]['networking']['infra_internal']['ip'] }}"
68             - name: "SWIFT_URL"
69               value: "{{ caas.swift }}"
70           volumeMounts:
71             - name: config
72               mountPath: /etc/swift/
73             - name: store
74               mountPath: /srv/node/swift
75       volumes:
76         - name: config
77           hostPath:
78             path: /etc/swift/update/
79         - name: store
80           hostPath:
81             path: /srv/node/swift-update