This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathregistry-ds.yaml
134 lines (132 loc) · 4.35 KB
/
registry-ds.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: registry
namespace: quobyte
spec:
template:
metadata:
labels:
role: registry
version: "2"
spec:
containers:
- name: quobyte-registry
image: quay.io/quobyte/quobyte-server:2
# imagePullPolicy: Always
# resources:
# limits:
# memory: "512Mi"
# cpu: "100m"
# priviliged is required for full device inspector support
securityContext:
privileged: true
env:
- name: QUOBYTE_SERVICE
value: registry
- name: QUOBYTE_REGISTRY
value: registry
- name: QUOBYTE_EXTRA_SERVICE_CONFIG
value: >
constants.automation.manage_registry_replicas=true
- name: MAX_MEM
valueFrom:
configMapKeyRef:
name: quobyte-config
key: registry.max_mem
- name: MIN_MEM
valueFrom:
configMapKeyRef:
name: quobyte-config
key: registry.min_mem
- name: CURRENT_NODE
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: QUOBYTE_BOOTSTRAP_NODE
valueFrom:
configMapKeyRef:
name: quobyte-config
key: registry.bootstrap_node
command:
- /bin/bash
- -xec
- |
if [ "${QUOBYTE_BOOTSTRAP_NODE}" = "${CURRENT_NODE}" ]; then
sed "s/.*MIN_MEM_REGISTRY=.*/MIN_MEM_REGISTRY=${MIN_MEM}/" -i /etc/default/quobyte
sed "s/.*MAX_MEM_REGISTRY=.*/MAX_MEM_REGISTRY=${MAX_MEM}/" -i /etc/default/quobyte
mkdir -p /var/lib/quobyte/devices/registry-bootstrap
if [ ! -f /var/lib/quobyte/devices/registry-bootstrap/QUOBYTE_DEV_SETUP ]; then
mkdir -p /devices/dev1
cat > /var/lib/quobyte/devices/registry-bootstrap/QUOBYTE_DEV_SETUP <<EOF
device.serial=$(uuidgen)
device.model=Kubernetes-hostDir
device.type=DIR_DEVICE
EOF
if [ $(nslookup ${QUOBYTE_REGISTRY} | grep -A10 -m1 -e 'Name:' | wc -l) == 0 ]; then
echo "device.bootstrap=true" >> /var/lib/quobyte/devices/registry-bootstrap/QUOBYTE_DEV_SETUP
fi
fi
if [ ! -f /var/lib/quobyte/devices/registry-bootstrap/UUID ]; then
echo uuid=$(uuidgen) >> /var/lib/quobyte/devices/registry-bootstrap/UUID
fi
cat /var/lib/quobyte/devices/registry-bootstrap/UUID >> /etc/quobyte/$QUOBYTE_SERVICE.cfg
fi
exec /bin/bash -x /opt/main.sh
lifecycle:
preStop:
exec:
command:
- /bin/bash
- -xe
- |
if [ "${QUOBYTE_BOOTSTRAP_NODE}" = "${CURRENT_NODE}" ]; then
qmgmt -u api registry remove $(grep device.id= /var/lib/quobyte/devices/registry-bootstrap/QUOBYTE_DEV_ID | cut -d= -f2)
rm -rf /var/lib/quobyte/devices/registry-bootstrap/
fi
ports:
- name: rpc-tcp
containerPort: 7861
protocol: TCP
- name: rpc-udp
containerPort: 7861
protocol: UDP
- name: http
containerPort: 7871
protocol: TCP
volumeMounts:
- mountPath: /run/udev
name: host-udev
- mountPath: /lib/modules
name: libmodules
- mountPath: /var/lib/quobyte
name: var-lib-quobyte
mountPropagation: Bidirectional
- mountPath: /mnt/quobyte
name: mnt-quobyte
readinessProbe:
timeoutSeconds: 5
httpGet:
port: 7871
path: /
livenessProbe:
initialDelaySeconds: 30
timeoutSeconds: 5
httpGet:
port: 7871
path: /
nodeSelector:
quobyte_registry: "true"
volumes:
- name: host-udev
hostPath:
path: /run/udev
- name: libmodules
hostPath:
path: /lib/modules
- name: mnt-quobyte
hostPath:
path: /mnt/quobyte
- name: var-lib-quobyte
hostPath:
path: /var/lib/quobyte