Etcd: update chart to match current format

This PS spring cleans the etcd chart to match the current format
used in OSH.

Change-Id: I5f8802b662f7aac9f7a72d91e4d3aa2206099c92
This commit is contained in:
Pete Birley 2018-02-22 18:51:48 -08:00
parent 9f28f49da7
commit 2dcaa1421d
5 changed files with 103 additions and 22 deletions

View File

@ -0,0 +1,23 @@
#!/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
exec etcd \
--listen-client-urls http://0.0.0.0:{{ tuple "etcd" "internal" "client" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} \
--advertise-client-urls {{ tuple "etcd" "internal" "client" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | trimSuffix "/" }}

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 "etcd-bin" }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $configMapBinName }}
data:
etcd.sh: |
{{ tuple "bin/_etcd.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
{{- end }}

View File

@ -12,16 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if .Values.manifests.deployment }}
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.etcd }}
{{- $serviceAccountName := "etcd" }}
{{ tuple $envAll $dependencies $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
{{- $rcControllerName := printf "%s-%s" $envAll.Release.Name "etcd" }}
{{- $configMapBinName := printf "%s-%s" $envAll.Release.Name "etcd-bin" }}
{{ tuple $envAll $dependencies $rcControllerName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: etcd
name: {{ $rcControllerName | quote }}
spec:
replicas: {{ .Values.pod.replicas.etcd }}
{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
@ -30,7 +34,7 @@ spec:
labels:
{{ tuple $envAll "etcd" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
serviceAccountName: {{ $rcControllerName | quote }}
affinity:
{{ tuple $envAll "etcd" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector:
@ -42,13 +46,20 @@ spec:
image: {{ .Values.images.tags.etcd }}
imagePullPolicy: {{ .Values.images.pull_policy }}
command:
- etcd
- --listen-client-urls
- http://0.0.0.0:{{ .Values.network.port }}
- --advertise-client-urls
- http://{{ .Values.network.host }}:{{ .Values.network.port }}
- /tmp/etcd.sh
ports:
- containerPort: {{ .Values.network.port }}
- containerPort: {{ tuple "etcd" "internal" "client" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
readinessProbe:
tcpSocket:
port: {{ .Values.network.port }}
port: {{ tuple "etcd" "internal" "client" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
volumeMounts:
- name: etcd-bin
mountPath: /tmp/etcd.sh
subPath: etcd.sh
readOnly: true
volumes:
- name: etcd-bin
configMap:
name: {{ $configMapBinName | quote }}
defaultMode: 0555
{{- end }}

View File

@ -12,15 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if .Values.manifests.service }}
{{- $envAll := . }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.network.host }}
name: {{ tuple "etcd" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
spec:
sessionAffinity: ClientIP
ports:
- port: {{ .Values.network.port }}
- port: {{ tuple "etcd" "internal" "client" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
selector:
{{ tuple $envAll "etcd" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{- end }}

View File

@ -28,21 +28,17 @@ labels:
node_selector_key: openstack-control-plane
node_selector_value: enabled
network:
host: etcd
port: 2379
dependencies:
etcd:
jobs: null
pod:
affinity:
anti:
type:
default: preferredDuringSchedulingIgnoredDuringExecution
topologyKey:
default: kubernetes.io/hostname
anti:
type:
default: preferredDuringSchedulingIgnoredDuringExecution
topologyKey:
default: kubernetes.io/hostname
replicas:
etcd: 1
lifecycle:
@ -53,3 +49,24 @@ pod:
rolling_update:
max_surge: 3
max_unavailable: 1
endpoints:
cluster_domain_suffix: cluster.local
etcd:
name: etcd
hosts:
default: etcd
host_fqdn_override:
default: null
path:
default: null
scheme:
default: 'http'
port:
client:
default: 2379
manifests:
configmap_bin: true
deployment: true
service: true