bcbf9e86730c8185a9fd268a5ebe93201ea4806b
[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/v1beta2
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       hostNetwork: true
32       dnsPolicy: ClusterFirstWithHostNet
33       nodeSelector:
34         nodetype: caas_master
35       securityContext:
36         runAsUser: {{ caas.uid.swift }}
37       containers:
38         - name: swift
39           image: {{ container_image_names | select('search', '/swift') | list | last }}
40           securityContext:
41             capabilities:
42               add: ["NET_BIND_SERVICE"]
43           args:
44             - BACKEND
45           resources:
46             limits:
47               memory: "4Gi"
48             requests:
49               memory: "1Gi"
50           env:
51             - name: "SWIFT_USER"
52               value: "{{ swift_user_for_template.stdout }}"
53             - name: "SWIFT_TENANT"
54               value: "{{ swift_tenant_for_template.stdout }}"
55             - name: "SWIFT_PASS"
56               value: "{{ swift_password_for_template.stdout }}"
57             - name: "SWIFT_PART_POWER"
58               value: "7"
59             - name: "SWIFT_PART_HOUR"
60               value: "0"
61             - name: "SWIFT_DISK"
62               value: "swift"
63             - name: "SWIFT_REPLICAS"
64               value: "{{groups['caas_master']|length|int}}"
65 {% for host in groups['caas_master']%}
66             - name: "SWIFT_OAM{{loop.index}}_IP"
67               value: "{{ hostvars[host]['networking']['infra_internal']['ip'] }}"
68 {% endfor %}
69           volumeMounts:
70             - name: config
71               mountPath: /etc/swift/
72             - name: store
73               mountPath: /srv/node/swift
74           livenessProbe:
75             exec:
76               command:
77                 - /bin/bash
78                 - /usr/bin/healthchecker.sh
79             initialDelaySeconds: 60
80             periodSeconds: 10
81             failureThreshold: 5
82             timeoutSeconds: 3
83       volumes:
84         - name: config
85           hostPath:
86             path: /etc/swift/main/
87         - name: store
88           hostPath:
89             path: /srv/node/swift