Skip to content

Commit

Permalink
YT-21893: create helm chart for excel integration
Browse files Browse the repository at this point in the history
a163847fc344a435282031280567d10c91ad9c83
  • Loading branch information
kozubaeff committed Jun 21, 2024
1 parent 40185ed commit ae3bfa4
Show file tree
Hide file tree
Showing 10 changed files with 459 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
"CONTRIBUTING.md":"yt/opensource/repos/ytsaurus-excel-integration/github_toplevel/CONTRIBUTING.md",
"LICENSE":"yt/opensource/repos/ytsaurus-excel-integration/github_toplevel/LICENSE",
"README.md":"yt/microservices/excel/README.md",
"deployments/ytsaurus-excel-chart/.helmignore":"yt/microservices/excel/deployments/ytsaurus-excel-chart/.helmignore",
"deployments/ytsaurus-excel-chart/Chart.yaml":"yt/microservices/excel/deployments/ytsaurus-excel-chart/Chart.yaml",
"deployments/ytsaurus-excel-chart/templates/_helpers.tpl":"yt/microservices/excel/deployments/ytsaurus-excel-chart/templates/_helpers.tpl",
"deployments/ytsaurus-excel-chart/templates/config-map.yaml":"yt/microservices/excel/deployments/ytsaurus-excel-chart/templates/config-map.yaml",
"deployments/ytsaurus-excel-chart/templates/exporter-service.yaml":"yt/microservices/excel/deployments/ytsaurus-excel-chart/templates/exporter-service.yaml",
"deployments/ytsaurus-excel-chart/templates/exporter-statefulset.yaml":"yt/microservices/excel/deployments/ytsaurus-excel-chart/templates/exporter-statefulset.yaml",
"deployments/ytsaurus-excel-chart/templates/uploader-service.yaml":"yt/microservices/excel/deployments/ytsaurus-excel-chart/templates/uploader-service.yaml",
"deployments/ytsaurus-excel-chart/templates/uploader-statefulset.yaml":"yt/microservices/excel/deployments/ytsaurus-excel-chart/templates/uploader-statefulset.yaml",
"deployments/ytsaurus-excel-chart/values.yaml":"yt/microservices/excel/deployments/ytsaurus-excel-chart/values.yaml",
"exporter/README.md":"yt/microservices/excel/exporter/README.md",
"exporter/build/docker/Dockerfile":"yt/microservices/excel/exporter/build/docker/Dockerfile",
"exporter/build/docker/build.sh":"yt/microservices/excel/exporter/build/docker/build.sh",
Expand Down
25 changes: 25 additions & 0 deletions deployments/ytsaurus-excel-chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

ya.make
6 changes: 6 additions & 0 deletions deployments/ytsaurus-excel-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: ytsaurus-excel-chart
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "0.0.1"
78 changes: 78 additions & 0 deletions deployments/ytsaurus-excel-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ytsaurus-excel-chart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ytsaurus-excel-chart.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ytsaurus-excel-chart.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}

{{- define "ytsaurus-excel-chart.commonLabels" -}}
helm.sh/chart: {{ include "ytsaurus-excel-chart.chart" . }}
{{ include "ytsaurus-excel-chart.commonSelectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}





{{- define "ytsaurus-excel-chart.exporterLabels" -}}
{{ include "ytsaurus-excel-chart.exporterSelectorLabels" . }}
{{ include "ytsaurus-excel-chart.commonLabels" .}}
{{- end }}

{{- define "ytsaurus-excel-chart.uploaderLabels" -}}
{{ include "ytsaurus-excel-chart.uploaderSelectorLabels" . }}
{{ include "ytsaurus-excel-chart.commonLabels" .}}
{{- end }}

{{/*
Selector labels
*/}}

{{- define "ytsaurus-excel-chart.commonSelectorLabels" -}}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "ytsaurus-excel-chart.exporterSelectorLabels" -}}
app.kubernetes.io/name: "ytsaurus-excel-exporter"
{{ include "ytsaurus-excel-chart.commonSelectorLabels" . }}
{{- end }}

{{- define "ytsaurus-excel-chart.uploaderSelectorLabels" -}}
app.kubernetes.io/name: "ytsaurus-excel-uploader"
{{ include "ytsaurus-excel-chart.commonSelectorLabels" . }}
{{- end }}


27 changes: 27 additions & 0 deletions deployments/ytsaurus-excel-chart/templates/config-map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: ytsaurus-excel-cm
namespace: {{ .Release.Namespace }}
labels:
{{- include "ytsaurus-excel-chart.commonLabels" . | nindent 4 }}
data:
uploader-config.yaml: |
cors: {{ .Values.settings.cors | toYaml | nindent 8 }}
http_addr: ":{{- .Values.settings.uploader.http_port -}}"
debug_http_addr: ":{{- .Values.settings.uploader.debug_http_port -}}"
http_handler_timeout: {{ .Values.settings.uploader.http_handler_timeout }}
max_excel_file_size_bytes: {{ .Values.settings.uploader.max_excel_file_size_bytes | int64 }}
auth_cookie_name: {{ .Values.settings.uploader.auth_cookie_name | quote }}
clusters: {{ .Values.settings.uploader.clusters | toYaml | nindent 4 }}
exporter-config.yaml: |
cors: {{ .Values.settings.cors | toYaml | nindent 8 }}
http_addr: ":{{- .Values.settings.exporter.http_port -}}"
debug_http_addr: ":{{- .Values.settings.exporter.debug_http_port -}}"
http_handler_timeout: {{ .Values.settings.exporter.http_handler_timeout }}
max_excel_file_size_bytes: {{ .Values.settings.exporter.max_excel_file_size_bytes | int64 }}
auth_cookie_name: {{ .Values.settings.exporter.auth_cookie_name | quote }}
clusters: {{ .Values.settings.exporter.clusters | toYaml | nindent 4 }}
19 changes: 19 additions & 0 deletions deployments/ytsaurus-excel-chart/templates/exporter-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: "ytsaurus-excel-exporter-svc"
labels:
{{- include "ytsaurus-excel-chart.exporterLabels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
- port: {{ .Values.service.metricsPort }}
targetPort: metrics
protocol: TCP
name: mertics
selector:
{{- include "ytsaurus-excel-chart.exporterSelectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: "ytsaurus-excel-exporter"
labels:
{{- include "ytsaurus-excel-chart.exporterLabels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "ytsaurus-excel-chart.exporterSelectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ytsaurus-excel-chart.exporterLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
command: ["/usr/bin/excel-exporter", "-config", "/etc/config.yaml"]
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.exporter.repository }}:{{ .Values.image.exporter.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.exporter.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.settings.exporter.http_port }}
protocol: TCP
- name: metrics
containerPort: {{ .Values.settings.exporter.debug_http_port }}
protocol: TCP
livenessProbe:
httpGet:
{{- with (first .Values.settings.exporter.clusters) }}
path: /{{- .api_endpoint_name -}}/api/ready
{{- end }}
port: {{ .Values.settings.exporter.http_port }}

readinessProbe:
httpGet:
{{- with (first .Values.settings.exporter.clusters) }}
path: /{{- .api_endpoint_name -}}/api/ready
{{- end }}
port: {{ .Values.settings.exporter.http_port }}
volumeMounts:
- mountPath: /etc/config.yaml
name: config
readOnly: true
subPath: exporter-config.yaml
- name: exporter-logs
mountPath: /tmp
volumes:
- configMap:
defaultMode: 420
name: "ytsaurus-excel-cm"
name: config


{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: exporter-logs
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 5Gi
19 changes: 19 additions & 0 deletions deployments/ytsaurus-excel-chart/templates/uploader-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: "ytsaurus-excel-uploader-svc"
labels:
{{- include "ytsaurus-excel-chart.uploaderLabels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
- port: {{ .Values.service.metricsPort }}
targetPort: metrics
protocol: TCP
name: mertics
selector:
{{- include "ytsaurus-excel-chart.uploaderSelectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: "ytsaurus-excel-uploader"
labels:
{{- include "ytsaurus-excel-chart.uploaderLabels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "ytsaurus-excel-chart.uploaderSelectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ytsaurus-excel-chart.uploaderLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
command: ["/usr/bin/excel-uploader", "-config", "/etc/config.yaml"]
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.uploader.repository }}:{{ .Values.image.uploader.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.uploader.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.settings.uploader.http_port }}
protocol: TCP
- name: metrics
containerPort: {{ .Values.settings.uploader.debug_http_port }}
protocol: TCP
livenessProbe:
httpGet:
{{- with (first .Values.settings.uploader.clusters) }}
path: /{{- .api_endpoint_name -}}/api/ready
{{- end }}
port: {{ .Values.settings.uploader.http_port }}

readinessProbe:
httpGet:
{{- with (first .Values.settings.uploader.clusters) }}
path: /{{- .api_endpoint_name -}}/api/ready
{{- end }}
port: {{ .Values.settings.uploader.http_port }}
volumeMounts:
- mountPath: /etc/config.yaml
name: config
readOnly: true
subPath: uploader-config.yaml
- name: uploader-logs
mountPath: /tmp
volumes:
- configMap:
defaultMode: 420
name: "ytsaurus-excel-cm"
name: config

{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}

volumeClaimTemplates:
- metadata:
name: uploader-logs
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 5Gi
Loading

0 comments on commit ae3bfa4

Please sign in to comment.