--- # Copyright 2020 VEXXHOST, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. apiVersion: apps/v1 kind: StatefulSet metadata: name: memcached-{{ name }} labels: {{ labels("memcached", name) | indent(4) }} spec: replicas: 2 serviceName: memcached-{{ name }} selector: matchLabels: {{ labels("memcached", name) | indent(6) }} template: metadata: labels: {{ labels("memcached", name) | indent(8) }} spec: containers: - name: memcached image: vexxhost/memcached:latest args: ["-m", "{{ (spec.megabytes / 2) | int }}"] imagePullPolicy: Always ports: - name: memcached protocol: TCP containerPort: 11211 livenessProbe: tcpSocket: port: memcached readinessProbe: tcpSocket: port: memcached resources: limits: cpu: 50m ephemeral-storage: 50M memory: {{ (spec.megabytes / 2) | int + 64 }}M requests: cpu: 10m ephemeral-storage: 50M memory: {{ (spec.megabytes / 2) | int }}M securityContext: runAsUser: 1001 - name: exporter image: vexxhost/memcached_exporter:latest imagePullPolicy: Always ports: - name: metrics protocol: TCP containerPort: 9150 livenessProbe: httpGet: path: / port: metrics readinessProbe: httpGet: path: / port: metrics resources: limits: cpu: 100m ephemeral-storage: 10M memory: 64Mi requests: cpu: 50m ephemeral-storage: 10M memory: 32Mi securityContext: runAsUser: 1001 {% if 'nodeSelector' in spec %} nodeSelector: {{ spec.nodeSelector | to_yaml | indent(8) }} {% endif %} {% if 'tolerations' in spec %} tolerations: {{ spec.tolerations | to_yaml | indent(8) }} {% endif %}