Memcached: permit multiple deployments within a single namespace

This PS updates the Memcached chart to permit multiple deployments
within a single namespace.

Change-Id: I282d73fdbb03c29ef063537a03d4ace026083930
This commit is contained in:
portdirect 2018-01-17 12:39:22 -05:00 committed by Pete Birley
parent 5f26fcd91e
commit ea4c7b7ac8
3 changed files with 24 additions and 11 deletions

View File

@ -17,13 +17,13 @@ limitations under the License.
{{- $envAll := . }} {{- $envAll := . }}
{{- $dependencies := .Values.dependencies.memcached }} {{- $dependencies := .Values.dependencies.memcached }}
{{- $serviceAccountName := "memcached" }} {{- $rcControllerName := printf "%s-%s" $envAll.Release.Name "memcached" }}
{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} {{ tuple $envAll $dependencies $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
--- ---
apiVersion: apps/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: memcached name: {{ $rcControllerName | quote }}
spec: spec:
replicas: {{ .Values.pod.replicas.server }} replicas: {{ .Values.pod.replicas.server }}
{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
@ -32,7 +32,7 @@ spec:
labels: labels:
{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} {{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec: spec:
serviceAccountName: {{ $serviceAccountName }} serviceAccountName: {{ $rcControllerName | quote }}
affinity: affinity:
{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} {{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector: nodeSelector:
@ -48,12 +48,12 @@ spec:
args: args:
- | - |
exec memcached -v \ exec memcached -v \
-p {{ .Values.network.port }} \ -p {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} \
-U 0 \ -U 0 \
-c {{ .Values.memcached.max_connections }} \ -c {{ .Values.memcached.max_connections }} \
-m {{ .Values.memcached.memory }}; -m {{ .Values.memcached.memory }};
ports: ports:
- containerPort: {{ .Values.network.port }} - containerPort: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe: readinessProbe:
tcpSocket: tcpSocket:
port: {{ .Values.network.port }} port: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}

View File

@ -13,15 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/}} */}}
{{- $envAll := . }} {{- $envAll := . }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: memcached name: {{ tuple "oslo_cache" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec: spec:
sessionAffinity: ClientIP sessionAffinity: ClientIP
ports: ports:
- port: {{ .Values.network.port }} - port: {{ tuple "oslo_cache" "internal" "memcache" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
selector: selector:
{{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ tuple $envAll "memcached" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}

View File

@ -54,8 +54,20 @@ labels:
node_selector_key: openstack-control-plane node_selector_key: openstack-control-plane
node_selector_value: enabled node_selector_value: enabled
network: # typically overriden by environmental
port: 11211 # 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
memcached: memcached:
memory: 1024 memory: 1024