Skip to content

Commit

Permalink
merge data and master
Browse files Browse the repository at this point in the history
Signed-off-by: dehaocheng <[email protected]>
  • Loading branch information
wenchajun committed Dec 15, 2023
1 parent 5bb0531 commit a751376
Show file tree
Hide file tree
Showing 16 changed files with 2,222 additions and 1,093 deletions.
49 changes: 49 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion charts/opensearch/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2.17.0
version: 2.17.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
16 changes: 11 additions & 5 deletions charts/opensearch/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{- define "opensearch.endpoints" -}}
{{- $replicas := int (toString (.Values.replicas)) }}
{{- $uname := (include "opensearch.uname" .) }}
{{- $replicas := int (toString (.Values.master.replicas)) }}
{{- $uname := .Values.master.name }}
{{- range $i, $e := untilStep 0 $replicas 1 -}}
{{ $uname }}-{{ $i }},
{{- end -}}
Expand All @@ -98,7 +98,7 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.majorVersion }}
{{- .Values.majorVersion }}
{{- else }}
{{- $version := semver (coalesce .Values.image.tag .Chart.AppVersion "1") }}
{{- $version := semver (coalesce .Values.master.image.tag .Chart.AppVersion "1") }}
{{- $version.Major }}
{{- end }}
{{- end }}
Expand All @@ -111,8 +111,14 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{- end -}}

{{- define "opensearch.roles" -}}
{{- range $.Values.roles -}}
{{- define "opensearch.master.roles" -}}
{{- range $.Values.master.roles -}}
{{ . }},
{{- end -}}
{{- end -}}

{{- define "opensearch.data.roles" -}}
{{- range $.Values.data.roles -}}
{{ . }},
{{- end -}}
{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{{- $root := . }}
{{- if .Values.config }}
{{- if .Values.data.config }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "opensearch.uname" . }}-config
name: {{ .Values.data.name }}-config
labels:
{{- include "opensearch.labels" . | nindent 4 }}
{{- with .Values.data.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
data:
{{- range $configName, $configYaml := .Values.config }}
{{- range $configName, $configYaml := .Values.data.config }}
{{ $configName }}: |
{{- if (eq (kindOf $configYaml) "map")}}
{{- tpl (toYaml $configYaml) $root | nindent 4 }}
Expand Down
21 changes: 21 additions & 0 deletions charts/opensearch/templates/dataPoddisruptionbudget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.data.maxUnavailable }}
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: policy/v1
{{- else -}}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget
metadata:
name: "{{ .Values.data.name }}-pdb"
labels:
{{- with .Values.data.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
maxUnavailable: {{ .Values.data.maxUnavailable }}
selector:
matchLabels:
{{- with .Values.data.selectorLabels }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
80 changes: 80 additions & 0 deletions charts/opensearch/templates/dataService.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
kind: Service
apiVersion: v1
metadata:
name: {{ .Values.data.serviceName }}
labels:
{{- with .Values.data.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.data.service.labels }}
{{ toYaml .Values.data.service.labels | indent 4 }}
{{- end }}
annotations:
{{ toYaml .Values.data.service.annotations | indent 4 }}
spec:
type: {{ .Values.data.service.type }}
{{- if (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) }}
{{- if .Values.data.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ .Values.data.service.ipFamilyPolicy }}
{{- end }}
{{- if .Values.data.service.ipFamilies }}
ipFamilies: {{ .Values.data.service.ipFamilies }}
{{- end }}
{{- end }}
selector:
{{- with .Values.data.selectorLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
ports:
- name: {{ .Values.data.service.httpPortName | default "http" }}
protocol: TCP
port: {{ .Values.data.httpPort }}
{{- if .Values.data.service.nodePort }}
nodePort: {{ .Values.data.service.nodePort }}
{{- end }}
- name: {{ .Values.data.service.transportPortName | default "transport" }}
protocol: TCP
port: {{ .Values.data.transportPort }}
{{- if .Values.data.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.data.service.loadBalancerIP }}
{{- end }}
{{- with .Values.data.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ toYaml . | indent 4 }}
{{- end }}
{{- if .Values.data.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.data.service.externalTrafficPolicy }}
{{- end }}
---
kind: Service
apiVersion: v1
metadata:
name: {{ .Values.data.serviceName }}-headless
labels:
{{- with .Values.data.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.data.service.labelsHeadless }}
{{ toYaml .Values.data.service.labelsHeadless | indent 4 }}
{{- end }}
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
{{- if .Values.data.service.headless.annotations }}
{{ toYaml .Values.data.service.headless.annotations | indent 4 }}
{{- end }}
spec:
clusterIP: None # This is needed for statefulset hostnames like opensearch-0 to resolve
# Create endpoints also if the related pod isn't ready
publishNotReadyAddresses: true
selector:
{{- with .Values.data.selectorLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
ports:
- name: {{ .Values.data.service.httpPortName | default "http" }}
port: {{ .Values.data.httpPort }}
- name: {{ .Values.data.service.transportPortName | default "transport" }}
port: {{ .Values.data.transportPort }}
- name: {{ .Values.data.service.metricsPortName | default "metrics" }}
port: {{ .Values.data.metricsPort }}
Loading

0 comments on commit a751376

Please sign in to comment.