aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common/elasticsearch/components
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2020-11-19 17:07:26 +0100
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>2020-11-24 16:06:57 +0100
commit829344b4148924c574ab282b8e01c9ac530e71e2 (patch)
tree8d29614b9ac1c1d8b6e6b5c9c1690ef619c75aa6 /kubernetes/common/elasticsearch/components
parent3d2b4077ed695c5fa02252d7504c6723ffc48977 (diff)
[COMMON][ELASTIC] Uses new tpls for repos / images
This commit makes Elasticsearcg template to use the new generator for repositories and images. Issue-ID: OOM-2364 Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com> Change-Id: I20c18632234c864ef2a29e3cfb259c9838a8c4d6
Diffstat (limited to 'kubernetes/common/elasticsearch/components')
-rw-r--r--kubernetes/common/elasticsearch/components/Makefile51
-rw-r--r--kubernetes/common/elasticsearch/components/curator/hooks/job.install.yaml2
-rw-r--r--kubernetes/common/elasticsearch/components/curator/requirements.yaml3
-rw-r--r--kubernetes/common/elasticsearch/components/curator/templates/cronjob.yaml2
-rw-r--r--kubernetes/common/elasticsearch/components/curator/values.yaml2
-rw-r--r--kubernetes/common/elasticsearch/components/data/requirements.yaml3
-rw-r--r--kubernetes/common/elasticsearch/components/data/templates/statefulset.yaml14
-rw-r--r--kubernetes/common/elasticsearch/components/data/values.yaml5
-rw-r--r--kubernetes/common/elasticsearch/components/master/requirements.yaml3
-rw-r--r--kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml14
-rw-r--r--kubernetes/common/elasticsearch/components/master/values.yaml5
11 files changed, 85 insertions, 19 deletions
diff --git a/kubernetes/common/elasticsearch/components/Makefile b/kubernetes/common/elasticsearch/components/Makefile
new file mode 100644
index 0000000000..f2e7a1fb82
--- /dev/null
+++ b/kubernetes/common/elasticsearch/components/Makefile
@@ -0,0 +1,51 @@
+# Copyright © 2020 Samsung Electronics
+#
+# 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.
+
+ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+OUTPUT_DIR := $(ROOT_DIR)/../../dist
+PACKAGE_DIR := $(OUTPUT_DIR)/packages
+SECRET_DIR := $(OUTPUT_DIR)/secrets
+
+EXCLUDES := soHelpers
+HELM_BIN := helm
+HELM_CHARTS := soHelpers $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
+
+.PHONY: $(EXCLUDES) $(HELM_CHARTS)
+
+all: $(HELM_CHARTS)
+
+$(HELM_CHARTS):
+ @echo "\n[$@]"
+ @make package-$@
+
+make-%:
+ @if [ -f $*/Makefile ]; then make -C $*; fi
+
+dep-%: make-%
+ @if [ -f $*/requirements.yaml ]; then $(HELM_BIN) dep up $*; fi
+
+lint-%: dep-%
+ @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) lint $*; fi
+
+package-%: lint-%
+ @mkdir -p $(PACKAGE_DIR)
+ @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) package -d $(PACKAGE_DIR) $*; fi
+ @$(HELM_BIN) repo index $(PACKAGE_DIR)
+
+clean:
+ @rm -f */requirements.lock
+ @rm -f *tgz */charts/*tgz
+ @rm -rf $(PACKAGE_DIR)
+%:
+ @:
diff --git a/kubernetes/common/elasticsearch/components/curator/hooks/job.install.yaml b/kubernetes/common/elasticsearch/components/curator/hooks/job.install.yaml
index 583c2d7429..e1d6cbabbb 100644
--- a/kubernetes/common/elasticsearch/components/curator/hooks/job.install.yaml
+++ b/kubernetes/common/elasticsearch/components/curator/hooks/job.install.yaml
@@ -47,7 +47,7 @@ spec:
{{- end }}
containers:
- name: {{ template "common.fullname" . }}-curator
- image: {{printf "%s/%s" (include "common.repository" .) .Values.image }}
+ image: {{printf "%s/%s" (include "repositoryGenerator.repository" .) .Values.image }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
volumeMounts:
- name: config-volume
diff --git a/kubernetes/common/elasticsearch/components/curator/requirements.yaml b/kubernetes/common/elasticsearch/components/curator/requirements.yaml
index e9a5a5f61a..fbdf7b8489 100644
--- a/kubernetes/common/elasticsearch/components/curator/requirements.yaml
+++ b/kubernetes/common/elasticsearch/components/curator/requirements.yaml
@@ -16,3 +16,6 @@ dependencies:
- name: common
version: ~6.x-0
repository: 'file://../../../common'
+ - name: repositoryGenerator
+ version: ~6.x-0
+ repository: 'file://../../../repositoryGenerator'
diff --git a/kubernetes/common/elasticsearch/components/curator/templates/cronjob.yaml b/kubernetes/common/elasticsearch/components/curator/templates/cronjob.yaml
index b9e2c05d1a..ff63cf00b1 100644
--- a/kubernetes/common/elasticsearch/components/curator/templates/cronjob.yaml
+++ b/kubernetes/common/elasticsearch/components/curator/templates/cronjob.yaml
@@ -76,7 +76,7 @@ spec:
{{- end }}
containers:
- name: {{ template "common.fullname" . }}-curator
- image: {{printf "%s/%s" (include "common.repository" .) .Values.image }}
+ image: {{printf "%s/%s" (include "repositoryGenerator.repository" .) .Values.image }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
volumeMounts:
- name: config-volume
diff --git a/kubernetes/common/elasticsearch/components/curator/values.yaml b/kubernetes/common/elasticsearch/components/curator/values.yaml
index addd52867e..62964ff973 100644
--- a/kubernetes/common/elasticsearch/components/curator/values.yaml
+++ b/kubernetes/common/elasticsearch/components/curator/values.yaml
@@ -22,7 +22,7 @@ global:
mountPath: /dockerdata-nfs/backup
storageClass:
clusterName: cluster.local
-repositoryOverride: docker.io
+
#################################################################
# Application configuration defaults.
#################################################################
diff --git a/kubernetes/common/elasticsearch/components/data/requirements.yaml b/kubernetes/common/elasticsearch/components/data/requirements.yaml
index a1f72ffc60..ba64f9630e 100644
--- a/kubernetes/common/elasticsearch/components/data/requirements.yaml
+++ b/kubernetes/common/elasticsearch/components/data/requirements.yaml
@@ -16,3 +16,6 @@ dependencies:
- name: common
version: ~6.x-0
repository: 'file://../../../common'
+ - name: repositoryGenerator
+ version: ~6.x-0
+ repository: 'file://../../../repositoryGenerator'
diff --git a/kubernetes/common/elasticsearch/components/data/templates/statefulset.yaml b/kubernetes/common/elasticsearch/components/data/templates/statefulset.yaml
index 98d533d4e2..ea805c1813 100644
--- a/kubernetes/common/elasticsearch/components/data/templates/statefulset.yaml
+++ b/kubernetes/common/elasticsearch/components/data/templates/statefulset.yaml
@@ -17,7 +17,7 @@ apiVersion: apps/v1
kind: StatefulSet
{{ $role := "data" -}}
{{ $suffix := $role -}}
-{{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}}
+{{ $labels := (dict "role" $role "discovery" .Values.cluster_name) -}}
metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
spec:
updateStrategy:
@@ -34,7 +34,8 @@ spec:
template:
metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }}
spec:
-{{- include "elasticsearch.imagePullSecrets" . | nindent 6 }}
+ imagePullSecrets:
+ - name: "{{ include "common.namespace" . }}-docker-registry-key"
{{- if .Values.affinity }}
affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
{{- end }}
@@ -44,7 +45,6 @@ spec:
{{- if .Values.tolerations }}
tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
{{- end }}
- serviceAccountName: {{ template "elasticsearch.data.serviceAccountName" . }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
@@ -54,7 +54,7 @@ spec:
{{- if .Values.sysctlImage.enabled }}
## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
- name: sysctl
- image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+ image: {{ include "repositoryGenerator.image.busybox" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
command:
- /bin/sh
@@ -69,7 +69,7 @@ spec:
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
- name: volume-permissions
- image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+ image: {{ include "repositoryGenerator.image.busybox" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
command:
- /bin/sh
@@ -88,7 +88,7 @@ spec:
{{- end }}
containers:
- name: {{ include "common.name" . }}-data
- image: {{ printf "%s/%s" (include "common.repository" .) .Values.image }}
+ image: {{ printf "%s/%s" (include "repositoryGenerator.dockerHubRepository" .) .Values.image }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
{{- if .Values.securityContext.enabled }}
securityContext:
@@ -98,7 +98,7 @@ spec:
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" .Values.debug | quote }}
- name: ELASTICSEARCH_CLUSTER_NAME
- value: {{include "elasticsearch.clustername" .}}
+ value: {{ .Values.cluster_name }}
- name: ELASTICSEARCH_CLUSTER_HOSTS
value: {{ include "common.name" . }}-discovery
{{- if .Values.plugins }}
diff --git a/kubernetes/common/elasticsearch/components/data/values.yaml b/kubernetes/common/elasticsearch/components/data/values.yaml
index 8b5e687482..1328a20439 100644
--- a/kubernetes/common/elasticsearch/components/data/values.yaml
+++ b/kubernetes/common/elasticsearch/components/data/values.yaml
@@ -22,10 +22,13 @@ global:
backup:
mountPath: /dockerdata-nfs/backup
storageClass:
-repositoryOverride: docker.io
+
#################################################################
# Application configuration defaults.
#################################################################
+
+cluster_name: onap
+
## Init containers parameters:
sysctlImage:
enabled: true
diff --git a/kubernetes/common/elasticsearch/components/master/requirements.yaml b/kubernetes/common/elasticsearch/components/master/requirements.yaml
index a1f72ffc60..ba64f9630e 100644
--- a/kubernetes/common/elasticsearch/components/master/requirements.yaml
+++ b/kubernetes/common/elasticsearch/components/master/requirements.yaml
@@ -16,3 +16,6 @@ dependencies:
- name: common
version: ~6.x-0
repository: 'file://../../../common'
+ - name: repositoryGenerator
+ version: ~6.x-0
+ repository: 'file://../../../repositoryGenerator'
diff --git a/kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml b/kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml
index 6744f75f26..a35b4bf741 100644
--- a/kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml
+++ b/kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml
@@ -18,7 +18,7 @@ apiVersion: apps/v1
kind: StatefulSet
{{ $role := "master" -}}
{{ $suffix := $role -}}
-{{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}}
+{{ $labels := (dict "role" $role "discovery" .Values.cluster_name) -}}
metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
spec:
updateStrategy:
@@ -32,7 +32,8 @@ spec:
template:
metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }}
spec:
-{{- include "elasticsearch.imagePullSecrets" . | nindent 6 }}
+ imagePullSecrets:
+ - name: "{{ include "common.namespace" . }}-docker-registry-key"
{{- if .Values.affinity }}
affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
{{- end }}
@@ -42,7 +43,6 @@ spec:
{{- if .Values.tolerations }}
tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
{{- end }}
- serviceAccountName: {{ template "elasticsearch.serviceAccountName" . }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
@@ -52,7 +52,7 @@ spec:
{{- if .Values.sysctlImage.enabled }}
## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
- name: sysctl
- image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+ image: {{ include "repositoryGenerator.image.busybox" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
command:
- /bin/sh
@@ -67,7 +67,7 @@ spec:
{{- end }}
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
- name: volume-permissions
- image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+ image: {{ include "repositoryGenerator.image.busybox" . }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
command:
- /bin/sh
@@ -86,7 +86,7 @@ spec:
{{- end }}
containers:
- name: {{ include "common.name" . }}-master
- image: {{ printf "%s/%s" (include "common.repository" .) .Values.image }}
+ image: {{ printf "%s/%s" (include "repositoryGenerator.dockerHubRepository" .) .Values.image }}
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
{{- if .Values.securityContext.enabled }}
securityContext:
@@ -96,7 +96,7 @@ spec:
- name: BITNAMI_DEBUG
value: {{ ternary "true" "false" .Values.debug | quote }}
- name: ELASTICSEARCH_CLUSTER_NAME
- value: {{ include "elasticsearch.clustername" . }}
+ value: {{ .Values.cluster_name }}
- name: ELASTICSEARCH_CLUSTER_HOSTS
value: {{ include "common.name" . }}-discovery
- name: ELASTICSEARCH_CLUSTER_MASTER_HOSTS
diff --git a/kubernetes/common/elasticsearch/components/master/values.yaml b/kubernetes/common/elasticsearch/components/master/values.yaml
index 4095bd3d38..33804494e9 100644
--- a/kubernetes/common/elasticsearch/components/master/values.yaml
+++ b/kubernetes/common/elasticsearch/components/master/values.yaml
@@ -22,10 +22,13 @@ global:
backup:
mountPath: /dockerdata-nfs/backup
storageClass:
-repositoryOverride: docker.io
+
#################################################################
# Application configuration defaults.
#################################################################
+
+cluster_name: onap
+
## Init containers parameters:
sysctlImage:
enabled: true