Memcached: Update chart to reflect OpenStack-Helm convention

This PS spring cleans the memcached chart to reflect the advances
in OSH style. It also updates the image used to the current
supported version.

Change-Id: Iaeb14e9dd169f009916e64b0c91f2581e64afbca
This commit is contained in:
portdirect 2018-02-17 18:08:45 -05:00
parent 96ca93521d
commit 80bf8863ad
5 changed files with 136 additions and 60 deletions

View File

@ -0,0 +1,26 @@
#!/bin/sh
{{/*
Copyright 2017 The Openstack-Helm Authors.
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.
*/}}
set -ex
memcached --version
exec memcached -v \
-p ${MEMCACHED_PORT} \
-U 0 \
-c ${MEMCACHED_MAX_CONNECTIONS} \
-m ${MEMCACHED_MEMORY}

View File

@ -0,0 +1,28 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
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.
*/}}
{{- if .Values.manifests.configmap_bin }}
{{- $envAll := . }}
{{- $configMapBinName := printf "%s-%s" $envAll.Release.Name "memcached-bin" }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $configMapBinName }}
data:
memcached.sh: |
{{ tuple "bin/_memcached.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}

View File

@ -14,10 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.deployment }}
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.memcached }}
{{- $rcControllerName := printf "%s-%s" $envAll.Release.Name "memcached" }}
{{- $configMapBinName := printf "%s-%s" $envAll.Release.Name "memcached-bin" }}
{{ tuple $envAll $dependencies $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: apps/v1beta1
@ -44,16 +47,28 @@ spec:
image: {{ .Values.images.tags.memcached }}
imagePullPolicy: {{ .Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
command: ["sh", "-xec"]
args:
- |
exec memcached -v \
-p {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} \
-U 0 \
-c {{ .Values.memcached.max_connections }} \
-m {{ .Values.memcached.memory }};
env:
- name: MEMCACHED_PORT
value: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
- name: MEMCACHED_MAX_CONNECTIONS
value: {{ .Values.conf.memcached.max_connections | quote }}
- name: MEMCACHED_MEMORY
value: {{ .Values.conf.memcached.memory | quote }}
command:
- /tmp/memcached.sh
ports:
- containerPort: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe:
tcpSocket:
port: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
volumeMounts:
- name: memcached-bin
mountPath: /tmp/memcached.sh
subPath: memcached.sh
readOnly: true
volumes:
- name: memcached-bin
configMap:
name: {{ $configMapBinName | quote }}
defaultMode: 0555
{{- end }}

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.service }}
{{- $envAll := . }}
---
apiVersion: v1
@ -26,3 +27,4 @@ spec:
- port: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
selector:
{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{- end }}

View File

@ -17,62 +17,67 @@
# Declare name/value pairs to be passed into your templates.
# name: value
images:
tags:
memcached: docker.io/memcached:1.4
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.2.1
pull_policy: "IfNotPresent"
conf:
memcached:
max_connections: 8192
#NOTE(pordirect): this should match the value in
# `pod.resources.memcached.memory`
memory: 1024
pod:
affinity:
anti:
type:
default: preferredDuringSchedulingIgnoredDuringExecution
topologyKey:
default: kubernetes.io/hostname
replicas:
server: 1
lifecycle:
upgrades:
deployments:
revision_history: 3
pod_replacement_strategy: RollingUpdate
rolling_update:
max_unavailable: 1
max_surge: 3
resources:
enabled: false
server:
limits:
memory: "128Mi"
cpu: "500m"
requests:
memory: "128Mi"
cpu: "500m"
dependencies:
memcached:
jobs: null
endpoints:
cluster_domain_suffix: cluster.local
oslo_cache:
host_fqdn_override:
default: null
hosts:
default: memcached
namespace: null
port:
memcache:
default: 11211
images:
pull_policy: IfNotPresent
tags:
dep_check: 'quay.io/stackanetes/kubernetes-entrypoint:v0.2.1'
memcached: 'docker.io/memcached:1.5.5'
labels:
node_selector_key: openstack-control-plane
node_selector_value: enabled
# typically overriden by environmental
# values, but should include all endpoints
# required by this chart
endpoints:
cluster_domain_suffix: cluster.local
oslo_cache:
namespace: null
hosts:
default: memcached
host_fqdn_override:
default: null
port:
memcache:
default: 11211
manifests:
configmap_bin: true
deployment: true
service: true
memcached:
memory: 1024
max_connections: 8192
dependencies:
memcached:
jobs: null
pod:
affinity:
anti:
topologyKey:
default: kubernetes.io/hostname
type:
default: preferredDuringSchedulingIgnoredDuringExecution
lifecycle:
upgrades:
deployments:
pod_replacement_strategy: RollingUpdate
revision_history: 3
rolling_update:
max_surge: 3
max_unavailable: 1
replicas:
server: 1
resources:
enabled: false
memcached:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 500m
memory: 128Mi