config-server
by Helm
config-server for Choerodon
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.enabled | 是否创建service |
| persistence.enabled | 是否启用持久化存储 |
| persistence.existingClaim | 绑定的pvc名称 |
| env.open.EUREKA_CLIENT_SERVICEURL_DEFAULTZONE | 注册服务地址 |
| env.open.SKYWALKING_OPTS | skywalking 代理端配置 |
skywalking 代理端配置参数对照表
| skywalking 代理端配置 | 含义 |
|---|---|
| javaagent | skywalking代理jar包(添加则开启skywalking,删除则关闭) |
| skywalking.agent.application_code | skywalking应用名称 |
| skywalking.agent.sample_n_per_3_secs | skywalking采样率配置 |
| skywalking.agent.namespace | skywalking跨进程链路中的header配置 |
| skywalking.agent.authentication | skywalking认证token配置 |
| skywalking.agent.span_limit_per_segment | skywalking每segment中的最大span数配置 |
| skywalking.agent.ignore_suffix | skywalking需要忽略的调用配置 |
| skywalking.agent.is_open_debugging_class | skywalking是否保存增强后的字节码文件 |
| skywalking.collector.backend_service | oap服务地址和端口配置 |
skywalking 代理端配置示例
env:
open:
SKYWALKING_OPTS: >-
-javaagent:/agent/skywalking-agent.jar
-Dskywalking.agent.application_code=config-server
-Dskywalking.agent.sample_n_per_3_secs=-1
-Dskywalking.collector.backend_service=oap.skywalking:11800
Deploy config-server with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has config-server 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartconfig-server is pinned at v0.17.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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