From 8fcbca9f611348fe936213defc74e6652357991f Mon Sep 17 00:00:00 2001 From: Taehyun Kim Date: Sat, 4 May 2019 04:43:27 +0900 Subject: [PATCH] refactor services --- elasticsearch/README.md | 3 +++ elasticsearch/templates/service.yaml | 13 ++++++++++--- elasticsearch/values.yaml | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/elasticsearch/README.md b/elasticsearch/README.md index 77d298d03..5ea61e09d 100644 --- a/elasticsearch/README.md +++ b/elasticsearch/README.md @@ -88,6 +88,9 @@ helm install --name elasticsearch elastic/elasticsearch --version 7.0.1-alpha1 - | `protocol` | The protocol that will be used for the readinessProbe. Change this to `https` if you have `xpack.security.http.ssl.enabled` set | `http` | | `httpPort` | The http port that Kubernetes will use for the healthchecks and the service. If you change this you will also need to set [http.port](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#_settings) in `extraEnvs` | `9200` | | `transportPort` | The transport port that Kubernetes will use for the service. If you change this you will also need to set [transport port configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_transport_settings) in `extraEnvs` | `9300` | +| `service.type` | Type of elasticsearch service. [Service Types](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) | `ClusterIP` | +| `service.annotations` | Annotations that Kubernetes will use for the service. This will configure load balancer if `service.type` is `LoadBalancer` (https://kubernetes.io/docs/concepts/services-networking/service/#ssl-support-on-aws) | `{}` | + | `updateStrategy` | The [updateStrategy](https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets) for the statefulset. By default Kubernetes will wait for the cluster to be green after upgrading each pod. Setting this to `OnDelete` will allow you to manually delete each pod during upgrades | `RollingUpdate` | | `maxUnavailable` | The [maxUnavailable](https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget) value for the pod disruption budget. By default this will prevent Kubernetes from having more than 1 unhealthy pod in the node group | `1` | | `fsGroup` | The Group ID (GID) for [securityContext.fsGroup](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) so that the Elasticsearch user can read from the persistent volume | `1000` | diff --git a/elasticsearch/templates/service.yaml b/elasticsearch/templates/service.yaml index 6bef0f90c..f488c49fb 100644 --- a/elasticsearch/templates/service.yaml +++ b/elasticsearch/templates/service.yaml @@ -3,7 +3,15 @@ kind: Service apiVersion: v1 metadata: name: {{ template "uname" . }} + labels: + heritage: {{ .Release.Service | quote }} + release: {{ .Release.Name | quote }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app: "{{ template "uname" . }}" + annotations: +{{ toYaml .Values.service.annotations | indent 4 }} spec: + type: {{ .Values.service.type }} selector: heritage: {{ .Release.Service | quote }} release: {{ .Release.Name | quote }} @@ -26,11 +34,10 @@ metadata: release: {{ .Release.Name | quote }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" app: "{{ template "uname" . }}" - annotations: - # Create endpoints also if the related pod isn't ready - service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" spec: clusterIP: None # This is needed for statefulset hostnames like elasticsearch-0 to resolve + # Create endpoints also if the related pod isn't ready + publishNotReadyAddresses: true selector: app: "{{ template "uname" . }}" ports: diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 8a9caf010..55229838b 100755 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -113,6 +113,10 @@ protocol: http httpPort: 9200 transportPort: 9300 +service: + annotations: {} + type: ClusterIP + updateStrategy: RollingUpdate # This is the max unavailable setting for the pod disruption budget