1
0

deployment-configservice.yaml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #
  2. # Copyright 2021 Apollo Authors
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. ---
  17. # configmap for apollo-configservice
  18. kind: ConfigMap
  19. apiVersion: v1
  20. metadata:
  21. {{- $configServiceFullName := include "apollo.configService.fullName" . }}
  22. name: {{ $configServiceFullName }}
  23. data:
  24. application-github.properties: |
  25. spring.datasource.url = jdbc:mysql://{{include "apollo.configdb.serviceName" .}}:{{include "apollo.configdb.servicePort" .}}/{{ .Values.configdb.dbName }}{{ if .Values.configdb.connectionStringProperties }}?{{ .Values.configdb.connectionStringProperties }}{{ end }}
  26. spring.datasource.username = {{ required "configdb.userName is required!" .Values.configdb.userName }}
  27. spring.datasource.password = {{ required "configdb.password is required!" .Values.configdb.password }}
  28. apollo.config-service.url = {{ include "apollo.configService.serviceUrl" .}}
  29. apollo.admin-service.url = {{ include "apollo.adminService.serviceUrl" .}}
  30. {{- if .Values.configService.config.contextPath }}
  31. server.servlet.context-path = {{ .Values.configService.config.contextPath }}
  32. {{- end }}
  33. ---
  34. kind: Deployment
  35. apiVersion: apps/v1
  36. metadata:
  37. name: {{ $configServiceFullName }}
  38. labels:
  39. {{- include "apollo.service.labels" . | nindent 4 }}
  40. spec:
  41. replicas: {{ .Values.configService.replicaCount }}
  42. selector:
  43. matchLabels:
  44. app: {{ $configServiceFullName }}
  45. {{- with .Values.configService.strategy }}
  46. strategy:
  47. {{- toYaml . | nindent 4 }}
  48. {{- end }}
  49. template:
  50. metadata:
  51. labels:
  52. app: {{ $configServiceFullName }}
  53. spec:
  54. {{- with .Values.configService.imagePullSecrets }}
  55. imagePullSecrets:
  56. {{- toYaml . | nindent 8 }}
  57. {{- end }}
  58. volumes:
  59. - name: volume-configmap-{{ $configServiceFullName }}
  60. configMap:
  61. name: {{ $configServiceFullName }}
  62. items:
  63. - key: application-github.properties
  64. path: application-github.properties
  65. defaultMode: 420
  66. containers:
  67. - name: {{ .Values.configService.name }}
  68. image: "{{ .Values.configService.image.repository }}:{{ .Values.configService.image.tag | default .Chart.AppVersion }}"
  69. imagePullPolicy: {{ .Values.configService.image.pullPolicy }}
  70. ports:
  71. - name: http
  72. containerPort: {{ .Values.configService.containerPort }}
  73. protocol: TCP
  74. env:
  75. - name: SPRING_PROFILES_ACTIVE
  76. value: {{ .Values.configService.config.profiles | quote }}
  77. {{- range $key, $value := .Values.configService.env }}
  78. - name: {{ $key }}
  79. value: {{ $value }}
  80. {{- end }}
  81. volumeMounts:
  82. - name: volume-configmap-{{ $configServiceFullName }}
  83. mountPath: /apollo-configservice/config/application-github.properties
  84. subPath: application-github.properties
  85. livenessProbe:
  86. tcpSocket:
  87. port: {{ .Values.configService.containerPort }}
  88. initialDelaySeconds: {{ .Values.configService.liveness.initialDelaySeconds }}
  89. periodSeconds: {{ .Values.configService.liveness.periodSeconds }}
  90. readinessProbe:
  91. httpGet:
  92. path: {{ .Values.configService.config.contextPath }}/health
  93. port: {{ .Values.configService.containerPort }}
  94. initialDelaySeconds: {{ .Values.configService.readiness.initialDelaySeconds }}
  95. periodSeconds: {{ .Values.configService.readiness.periodSeconds }}
  96. resources:
  97. {{- toYaml .Values.configService.resources | nindent 12 }}
  98. {{- with .Values.configService.nodeSelector }}
  99. nodeSelector:
  100. {{- toYaml . | nindent 8 }}
  101. {{- end }}
  102. {{- with .Values.configService.affinity }}
  103. affinity:
  104. {{- toYaml . | nindent 8 }}
  105. {{- end }}
  106. {{- with .Values.configService.tolerations }}
  107. tolerations:
  108. {{- toYaml . | nindent 8 }}
  109. {{- end }}