forked from redhat-cop/containers-quickstarts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yml
166 lines (166 loc) · 4.71 KB
/
template.yml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
apiVersion: template.openshift.io/v1
kind: Template
labels:
template: rabbitmq
metadata:
annotations:
description: RabbitMQ Deployment and Runtime Components
iconClass: icon-erlang
tags: erlang,rabbitmq
name: rabbitmq
objects:
- apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
application: "${APPLICATION_NAME}"
name: view
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: default
- apiVersion: v1
kind: Service
metadata:
labels:
application: "${APPLICATION_NAME}"
name: "${APPLICATION_NAME}"
spec:
clusterIP: None
ports:
- name: http
protocol: TCP
port: 15672
targetPort: 15672
- name: amqp
protocol: TCP
port: 5672
targetPort: 5672
selector:
application: "${APPLICATION_NAME}"
sessionAffinity: None
type: ClusterIP
- apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
application: "${APPLICATION_NAME}"
name: "${APPLICATION_NAME}"
spec:
replicas: 3
selector:
matchLabels:
application: "${APPLICATION_NAME}"
serviceName: "${APPLICATION_NAME}"
template:
metadata:
labels:
application: "${APPLICATION_NAME}"
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: statefulset
operator: In
values:
- patronitheq
topologyKey: kubernetes.io/hostname
containers:
- env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: K8S_SERVICE_NAME
value: "${APPLICATION_NAME}"
- name: K8S_HOSTNAME_SUFFIX
value: .$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local
- name: RABBITMQ_ERLANG_COOKIE
value: sup3rS3cr1+
- name: RABBITMQ_NODENAME
value: rabbit@$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE).svc.cluster.local
- name: RABBITMQ_USE_LONGNAME
value: "true"
image: "${APPLICATION_NAME}:${RABBITMQ_VERSION}"
imagePullPolicy: Always
livenessProbe:
exec:
# Learn more at https://www.rabbitmq.com/monitoring.html#health-checks.
command: ["rabbitmq-diagnostics", "status"]
initialDelaySeconds: 60
# See https://www.rabbitmq.com/monitoring.html for monitoring frequency recommendations.
periodSeconds: 60
timeoutSeconds: 15
name: "${APPLICATION_NAME}"
ports:
- name: http
protocol: TCP
containerPort: 15672
- name: amqp
protocol: TCP
containerPort: 5672
readinessProbe:
exec:
# Learn more at https://www.rabbitmq.com/monitoring.html#health-checks.
command: ["rabbitmq-diagnostics", "check_port_connectivity"]
initialDelaySeconds: 20
periodSeconds: 60
timeoutSeconds: 10
resources:
limits:
cpu: '1'
memory: 2Gi
requests:
cpu: 300m
memory: 1Gi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- name: config-volume
mountPath: /etc/rabbitmq
- name: mnesia
mountPath: /var/lib/rabbitmq/mnesia
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 10
volumes:
- name: config-volume
configMap:
name: rabbitmq-config
items:
- key: rabbitmq.conf
path: rabbitmq.conf
- key: enabled_plugins
path: enabled_plugins
- key: policy.json
path: policy.json
volumeClaimTemplates:
- metadata:
name: mnesia
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
parameters:
- description: The name for the application.
name: APPLICATION_NAME
required: true
value: rabbitmq
- description: RabbitMQ version to build
name: RABBITMQ_VERSION
required: true
value: 3.8.3