Skip to content

Commit

Permalink
Helm Chart changes for #579 (#582)
Browse files Browse the repository at this point in the history
* [patch] divide gateway for future architecture

Signed-off-by: kpango <[email protected]>

* 🔥 clean

Signed-off-by: Rintaro Okamura <[email protected]>

* 🔧 fix type signature

Signed-off-by: Rintaro Okamura <[email protected]>

* ♻️ hierarchical structure values for manager components

Signed-off-by: Rintaro Okamura <[email protected]>

* ♻️ use variable for root object: agent

Signed-off-by: Rintaro Okamura <[email protected]>

* ♻️ use variable for root object: discoverer

Signed-off-by: Rintaro Okamura <[email protected]>

* ♻️ use variable for root object: gateway

Signed-off-by: Rintaro Okamura <[email protected]>

* ♻️ use variable for root object: meta

Signed-off-by: Rintaro Okamura <[email protected]>

* ♻️ move gateway to gateway.vald

Signed-off-by: Rintaro Okamura <[email protected]>

* 🚚 update existing values structure

Signed-off-by: Rintaro Okamura <[email protected]>

* ✨ add gateways

Signed-off-by: Rintaro Okamura <[email protected]>

* 🚧 add templates for gateways

Signed-off-by: Rintaro Okamura <[email protected]>

* 🔧 add gateway configs

Signed-off-by: Rintaro Okamura <[email protected]>

* ✨ add initContainer templates for wait-for-gateway-*

Signed-off-by: Rintaro Okamura <[email protected]>

* 🔧 add gateway client addrs

Signed-off-by: Rintaro Okamura <[email protected]>

Co-authored-by: kpango <[email protected]>
  • Loading branch information
rinx and kpango authored Jul 30, 2020
1 parent df7e5b6 commit 01191a9
Show file tree
Hide file tree
Showing 98 changed files with 3,947 additions and 2,942 deletions.
5 changes: 4 additions & 1 deletion charts/vald/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Release {{ .Release.Name }} is created.

Ingress: {{ .Values.gateway.ingress.host }}
{{- $gateway := .Values.gateway.vald -}}
{{- if and $gateway.enabled $gateway.ingress.enabled }}
Ingress: {{ $gateway.ingress.host }}
{{- end }}
24 changes: 20 additions & 4 deletions charts/vald/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -691,9 +691,9 @@ initContainers
- -c
- |
{{- if eq .target "compressor" }}
{{- $compressorReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.compressor.server_config.healths.readiness.port }}
{{- $compressorReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.manager.compressor.server_config.healths.readiness.port }}
{{- $compressorReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.compressor.name }}.{{ $.namespace }}.svc.cluster.local:{{ $compressorReadinessPort }}{{ $compressorReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.manager.compressor.name }}.{{ $.namespace }}.svc.cluster.local:{{ $compressorReadinessPort }}{{ $compressorReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if eq .target "meta" }}
{{- $metaReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.meta.server_config.healths.readiness.port }}
{{- $metaReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
Expand All @@ -707,9 +707,25 @@ initContainers
{{- $agentReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.agent.name }}.{{ $.namespace }}.svc.cluster.local:{{ $agentReadinessPort }}{{ $agentReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if eq .target "manager-backup" }}
{{- $backupManagerReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.backupManager.server_config.healths.readiness.port }}
{{- $backupManagerReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.manager.backup.server_config.healths.readiness.port }}
{{- $backupManagerReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.backupManager.name }}.{{ $.namespace }}.svc.cluster.local:{{ $backupManagerReadinessPort }}{{ $backupManagerReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.manager.backup.name }}.{{ $.namespace }}.svc.cluster.local:{{ $backupManagerReadinessPort }}{{ $backupManagerReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if eq .target "gateway-backup" }}
{{- $backupGatewayReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.gateway.backup.server_config.healths.readiness.port }}
{{- $backupGatewayReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.gateway.backup.name }}.{{ $.namespace }}.svc.cluster.local:{{ $backupGatewayReadinessPort }}{{ $backupGatewayReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if eq .target "gateway-filter" }}
{{- $filterGatewayReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.gateway.filter.server_config.healths.readiness.port }}
{{- $filterGatewayReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.gateway.filter.name }}.{{ $.namespace }}.svc.cluster.local:{{ $filterGatewayReadinessPort }}{{ $filterGatewayReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if eq .target "gateway-lb" }}
{{- $lbGatewayReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.gateway.lb.server_config.healths.readiness.port }}
{{- $lbGatewayReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.gateway.lb.name }}.{{ $.namespace }}.svc.cluster.local:{{ $lbGatewayReadinessPort }}{{ $lbGatewayReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if eq .target "gateway-meta" }}
{{- $metaGatewayReadinessPort := default $.Values.defaults.server_config.healths.readiness.port $.Values.gateway.meta.server_config.healths.readiness.port }}
{{- $metaGatewayReadinessPath := default $.Values.defaults.server_config.healths.readiness.readinessProbe.httpGet.path .readinessPath }}
until [ "$(wget --server-response --spider --quiet http://{{ $.Values.gateway.meta.name }}.{{ $.namespace }}.svc.cluster.local:{{ $metaGatewayReadinessPort }}{{ $metaGatewayReadinessPath }} 2>&1 | awk 'NR==1{print $2}')" == "200" ]; do
{{- else if .untilCondition }}
until [ {{ .untilCondition }} ]; do
{{- else if .whileCondition }}
Expand Down
17 changes: 9 additions & 8 deletions charts/vald/templates/agent/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
{{- if .Values.agent.enabled }}
{{- $agent := .Values.agent -}}
{{- if $agent.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.agent.name }}-config
name: {{ $agent.name }}-config
labels:
app.kubernetes.io/name: {{ include "vald.name" . }}
helm.sh/chart: {{ include "vald.chart" . }}
Expand All @@ -28,17 +29,17 @@ metadata:
data:
config.yaml: |
---
version: {{ .Values.agent.version }}
time_zone: {{ default .Values.defaults.time_zone .Values.agent.time_zone }}
version: {{ $agent.version }}
time_zone: {{ default .Values.defaults.time_zone $agent.time_zone }}
logging:
{{- $logging := dict "Values" .Values.agent.logging "default" .Values.defaults.logging }}
{{- $logging := dict "Values" $agent.logging "default" .Values.defaults.logging }}
{{- include "vald.logging" $logging | nindent 6 }}
server_config:
{{- $servers := dict "Values" .Values.agent.server_config "default" .Values.defaults.server_config }}
{{- $servers := dict "Values" $agent.server_config "default" .Values.defaults.server_config }}
{{- include "vald.servers" $servers | nindent 6 }}
observability:
{{- $observability := dict "Values" .Values.agent.observability "default" .Values.defaults.observability }}
{{- $observability := dict "Values" $agent.observability "default" .Values.defaults.observability }}
{{- include "vald.observability" $observability | nindent 6 }}
ngt:
{{- toYaml .Values.agent.ngt | nindent 6 }}
{{- toYaml $agent.ngt | nindent 6 }}
{{- end }}
133 changes: 67 additions & 66 deletions charts/vald/templates/agent/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,159 +13,160 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
{{- if and .Values.agent.enabled (eq .Values.agent.kind "DaemonSet") }}
{{- $agent := .Values.agent -}}
{{- if and $agent.enabled (eq $agent.kind "DaemonSet") }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ .Values.agent.name }}
name: {{ $agent.name }}
labels:
app: {{ .Values.agent.name }}
app: {{ $agent.name }}
app.kubernetes.io/name: {{ include "vald.name" . }}
helm.sh/chart: {{ include "vald.chart" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.Version }}
app.kubernetes.io/component: agent
{{- if .Values.agent.annotations }}
{{- if $agent.annotations }}
annotations:
{{- toYaml .Values.agent.annotations | nindent 4 }}
{{- toYaml $agent.annotations | nindent 4 }}
{{- end }}
spec:
revisionHistoryLimit: {{ .Values.agent.revisionHistoryLimit }}
revisionHistoryLimit: {{ $agent.revisionHistoryLimit }}
selector:
matchLabels:
app: {{ .Values.agent.name }}
app: {{ $agent.name }}
updateStrategy:
rollingUpdate:
maxUnavailable: {{ .Values.agent.rollingUpdate.maxUnavailable }}
maxUnavailable: {{ $agent.rollingUpdate.maxUnavailable }}
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: {{ .Values.agent.name }}
app: {{ $agent.name }}
app.kubernetes.io/name: {{ include "vald.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: agent
{{- if .Values.agent.podAnnotations }}
{{- if $agent.podAnnotations }}
annotations:
{{- toYaml .Values.agent.podAnnotations | nindent 8 }}
{{- toYaml $agent.podAnnotations | nindent 8 }}
{{- end }}
# annotations:
# checksum/configmap: {{ include (print $.Template.BasePath "/agent/configmap.yaml") . | sha256sum }}
spec:
{{- if or .Values.agent.initContainers (and .Values.agent.sidecar.enabled .Values.agent.sidecar.initContainerEnabled) }}
{{- if or $agent.initContainers (and $agent.sidecar.enabled $agent.sidecar.initContainerEnabled) }}
initContainers:
{{- if .Values.agent.initContainers }}
{{- $initContainers := dict "initContainers" .Values.agent.initContainers "Values" .Values "namespace" .Release.Namespace -}}
{{- if $agent.initContainers }}
{{- $initContainers := dict "initContainers" $agent.initContainers "Values" .Values "namespace" .Release.Namespace -}}
{{- include "vald.initContainers" $initContainers | trim | nindent 8 }}
{{- end }}
{{- if and .Values.agent.sidecar.enabled .Values.agent.sidecar.initContainerEnabled }}
- name: {{ .Values.agent.sidecar.name }}-init
image: "{{ .Values.agent.sidecar.image.repository }}:{{ default .Values.defaults.image.tag .Values.agent.sidecar.image.tag }}"
imagePullPolicy: {{ .Values.agent.sidecar.image.pullPolicy }}
{{- $servers := dict "Values" .Values.agent.sidecar.server_config "default" .Values.defaults.server_config -}}
{{- if and $agent.sidecar.enabled $agent.sidecar.initContainerEnabled }}
- name: {{ $agent.sidecar.name }}-init
image: "{{ $agent.sidecar.image.repository }}:{{ default .Values.defaults.image.tag $agent.sidecar.image.tag }}"
imagePullPolicy: {{ $agent.sidecar.image.pullPolicy }}
{{- $servers := dict "Values" $agent.sidecar.server_config "default" .Values.defaults.server_config -}}
{{- include "vald.containerPorts" $servers | trim | nindent 10 }}
resources:
{{- toYaml .Values.agent.sidecar.resources | nindent 12 }}
{{- toYaml $agent.sidecar.resources | nindent 12 }}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
env:
- name: VALD_AGENT_SIDECAR_MODE
value: "initcontainer"
{{- if .Values.agent.sidecar.env }}
{{- toYaml .Values.agent.sidecar.env | nindent 12 }}
{{- if $agent.sidecar.env }}
{{- toYaml $agent.sidecar.env | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ .Values.agent.sidecar.name }}-config
- name: {{ $agent.sidecar.name }}-config
mountPath: /etc/server/
{{- if .Values.agent.volumeMounts }}
{{- toYaml .Values.agent.volumeMounts | nindent 12 }}
{{- if $agent.volumeMounts }}
{{- toYaml $agent.volumeMounts | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}
affinity:
{{- include "vald.affinity" .Values.agent.affinity | nindent 8 }}
{{- if .Values.agent.topologySpreadConstraints }}
{{- include "vald.affinity" $agent.affinity | nindent 8 }}
{{- if $agent.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml .Values.agent.topologySpreadConstraints | nindent 8 }}
{{- toYaml $agent.topologySpreadConstraints | nindent 8 }}
{{- end }}
containers:
- name: {{ .Values.agent.name }}
image: "{{ .Values.agent.image.repository }}:{{ default .Values.defaults.image.tag .Values.agent.image.tag }}"
imagePullPolicy: {{ .Values.agent.image.pullPolicy }}
{{- $servers := dict "Values" .Values.agent.server_config "default" .Values.defaults.server_config -}}
- name: {{ $agent.name }}
image: "{{ $agent.image.repository }}:{{ default .Values.defaults.image.tag $agent.image.tag }}"
imagePullPolicy: {{ $agent.image.pullPolicy }}
{{- $servers := dict "Values" $agent.server_config "default" .Values.defaults.server_config -}}
{{- include "vald.containerPorts" $servers | trim | nindent 10 }}
resources:
{{- toYaml .Values.agent.resources | nindent 12 }}
{{- toYaml $agent.resources | nindent 12 }}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
{{- if .Values.agent.env }}
{{- if $agent.env }}
env:
{{- toYaml .Values.agent.env | nindent 12 }}
{{- toYaml $agent.env | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ .Values.agent.name }}-config
- name: {{ $agent.name }}-config
mountPath: /etc/server/
{{- if .Values.agent.volumeMounts }}
{{- toYaml .Values.agent.volumeMounts | nindent 12 }}
{{- if $agent.volumeMounts }}
{{- toYaml $agent.volumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.agent.sidecar.enabled }}
- name: {{ .Values.agent.sidecar.name }}
image: "{{ .Values.agent.sidecar.image.repository }}:{{ default .Values.defaults.image.tag .Values.agent.sidecar.image.tag }}"
imagePullPolicy: {{ .Values.agent.sidecar.image.pullPolicy }}
{{- $servers := dict "Values" .Values.agent.sidecar.server_config "default" .Values.defaults.server_config -}}
{{- if $agent.sidecar.enabled }}
- name: {{ $agent.sidecar.name }}
image: "{{ $agent.sidecar.image.repository }}:{{ default .Values.defaults.image.tag $agent.sidecar.image.tag }}"
imagePullPolicy: {{ $agent.sidecar.image.pullPolicy }}
{{- $servers := dict "Values" $agent.sidecar.server_config "default" .Values.defaults.server_config -}}
{{- include "vald.containerPorts" $servers | trim | nindent 10 }}
resources:
{{- toYaml .Values.agent.sidecar.resources | nindent 12 }}
{{- toYaml $agent.sidecar.resources | nindent 12 }}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
env:
- name: VALD_AGENT_SIDECAR_MODE
value: "sidecar"
{{- if .Values.agent.sidecar.env }}
{{- toYaml .Values.agent.sidecar.env | nindent 12 }}
{{- if $agent.sidecar.env }}
{{- toYaml $agent.sidecar.env | nindent 12 }}
{{- end }}
volumeMounts:
- name: {{ .Values.agent.sidecar.name }}-config
- name: {{ $agent.sidecar.name }}-config
mountPath: /etc/server/
{{- if .Values.agent.volumeMounts }}
{{- toYaml .Values.agent.volumeMounts | nindent 12 }}
{{- if $agent.volumeMounts }}
{{- toYaml $agent.volumeMounts | nindent 12 }}
{{- end }}
{{- end }}
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: {{ .Values.agent.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ $agent.terminationGracePeriodSeconds }}
volumes:
- name: {{ .Values.agent.name }}-config
- name: {{ $agent.name }}-config
configMap:
defaultMode: 420
name: {{ .Values.agent.name }}-config
{{- if .Values.agent.sidecar.enabled }}
- name: {{ .Values.agent.sidecar.name }}-config
name: {{ $agent.name }}-config
{{- if $agent.sidecar.enabled }}
- name: {{ $agent.sidecar.name }}-config
configMap:
defaultMode: 420
name: {{ .Values.agent.sidecar.name }}-config
name: {{ $agent.sidecar.name }}-config
{{- end }}
{{- if .Values.agent.volumes }}
{{- toYaml .Values.agent.volumes | nindent 8 }}
{{- if $agent.volumes }}
{{- toYaml $agent.volumes | nindent 8 }}
{{- end }}
{{- if .Values.agent.nodeName }}
nodeName: {{ .Values.agent.nodeName }}
{{- if $agent.nodeName }}
nodeName: {{ $agent.nodeName }}
{{- end }}
{{- if .Values.agent.nodeSelector }}
{{- if $agent.nodeSelector }}
nodeSelector:
{{- toYaml .Values.agent.nodeSelector | nindent 8 }}
{{- toYaml $agent.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Values.agent.tolerations }}
{{- if $agent.tolerations }}
tolerations:
{{- toYaml .Values.agent.tolerations | nindent 8 }}
{{- toYaml $agent.tolerations | nindent 8 }}
{{- end }}
{{- if .Values.agent.podPriority }}
{{- if .Values.agent.podPriority.enabled }}
priorityClassName: {{ .Values.agent.name }}-priority
{{- if $agent.podPriority }}
{{- if $agent.podPriority.enabled }}
priorityClassName: {{ $agent.name }}-priority
{{- end }}
{{- end }}
status:
Expand Down
Loading

0 comments on commit 01191a9

Please sign in to comment.