event-store-service

by Helm

Helm chartv0.8.0App 1.0

A Helm chart for Kubernetes

About this chart

部署文件的渲染模板,我们下文将定义一些变量,helm执行时会将变量渲染进模板文件中。

_helpers.tpl

这个文件我们用来进行标签模板的定义,以便在上文提到的位置进行标签渲染。

标签总共分为三个部分: 平台、微服务、监控。

平台标签

deployment 级:

{{- define "service.labels.standard" -}}
choerodon.io/release: {{ .Release.Name | quote }}
{{- end -}}

平台管理实例需要的实例ID。

微服务标签

pod 级:

{{- define "service.microservice.labels" -}}
choerodon.io/version: {{ .Chart.Version | quote }}
choerodon.io/service: {{ .Chart.Name | quote }}
choerodon.io/metrics-port: {{ .Values.deployment.managementPort | quote }}
{{- end -}}

微服务注册中心进行识别时所需要的版本号、项目名称、管理端口。

监控和日志标签

deployment 级:

{{- define "service.logging.deployment.label" -}}
choerodon.io/logs-parser: {{ .Values.logs.parser | quote }}
{{- end -}}

日志管理所需要的应用标签。该标签指定应用程序的日志格式,内置格式有nginx,spring-boot,docker对于spring-boot微服务请使用spring-boot,如果不需要收集日志请移除此段代码,并删除模板文件关于service.logging.deployment.label的引用。

pod 级:

{{- define "service.monitoring.pod.annotations" -}}
choerodon.io/metrics-group: {{ .Values.metrics.group | quote }}
choerodon.io/metrics-path: {{ .Values.metrics.path | quote }}
{{- end -}}

性能指标管理所需要的应用类别以及监控指标路径。其中metrics-group将应用按照某个关键字分组,并在grafana配置实现分组展示。metrics-path指定收集应用的指标数据路径。 如果不需要监控请移除此段代码

values.yaml

这个文件中的键值对,即为我们上文中所引用的变量。

将所以有变量集中在一个文件中,方便部署的时候进行归档以及灵活替换。

同时,helm命令支持使用 --set FOO_BAR=FOOBAR 参数对values 文件中的变量进行赋值,可以进一步简化部署流程。

参数对照表

参数名含义
service.enable是否创建service
persistence.enabled是否启用持久化存储
persistence.existingClaim绑定的pvc名称
preJob.preConfig.mysql初始化配置所需manager_service数据库信息
preJob.preInitDB.mysql初始化数据库所需数据库信息
env.open.SPRING_DATASOURCE_URL数据库链接地址
env.open.SPRING_DATASOURCE_USERNAME数据库用户名
env.open.SPRING_DATASOURCE_PASSWORD数据库密码
env.open.EUREKA_CLIENT_SERVICEURL_DEFAULTZONE注册服务地址
env.open.SPRING_CLOUD_CONFIG_ENABLED启用配置中心
env.open.SPRING_CLOUD_CONFIG_URI配置中心地址
env.open.SPRING_CLOUD_STREAM_KAFKA_BINDER_BROKERSkafka地址
env.open.SPRING_CLOUD_STREAM_KAFKA_BINDER_ZK_NODESzookeeper地址
env.open.SPRING_KAFKA_BOOTSTRAP_SERVERSspring kafka 地址

Deploy event-store-service with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has event-store-service on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartevent-store-service is pinned at v0.8.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply