1
0

deployment-adminservice.yaml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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-adminservice
  18. kind: ConfigMap
  19. apiVersion: v1
  20. metadata:
  21. {{- $adminServiceFullName := include "apollo.adminService.fullName" . }}
  22. name: {{ $adminServiceFullName }}
  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. {{- if .Values.adminService.config.contextPath }}
  29. server.servlet.context-path = {{ .Values.adminService.config.contextPath }}
  30. {{- end }}
  31. ---
  32. kind: Deployment
  33. apiVersion: apps/v1
  34. metadata:
  35. name: {{ $adminServiceFullName }}
  36. labels:
  37. {{- include "apollo.service.labels" . | nindent 4 }}
  38. spec:
  39. replicas: {{ .Values.adminService.replicaCount }}
  40. selector:
  41. matchLabels:
  42. app: {{ $adminServiceFullName }}
  43. {{- with .Values.adminService.strategy }}
  44. strategy:
  45. {{- toYaml . | nindent 4 }}
  46. {{- end }}
  47. template:
  48. metadata:
  49. labels:
  50. app: {{ $adminServiceFullName }}
  51. spec:
  52. {{- with .Values.adminService.imagePullSecrets }}
  53. imagePullSecrets:
  54. {{- toYaml . | nindent 8 }}
  55. {{- end }}
  56. volumes:
  57. - name: volume-configmap-{{ $adminServiceFullName }}
  58. configMap:
  59. name: {{ $adminServiceFullName }}
  60. items:
  61. - key: application-github.properties
  62. path: application-github.properties
  63. defaultMode: 420
  64. containers:
  65. - name: {{ .Values.adminService.name }}
  66. image: "{{ .Values.adminService.image.repository }}:{{ .Values.adminService.image.tag | default .Chart.AppVersion }}"
  67. imagePullPolicy: {{ .Values.adminService.image.pullPolicy }}
  68. ports:
  69. - name: http
  70. containerPort: {{ .Values.adminService.containerPort }}
  71. protocol: TCP
  72. env:
  73. - name: SPRING_PROFILES_ACTIVE
  74. value: {{ .Values.adminService.config.profiles | quote }}
  75. {{- range $key, $value := .Values.adminService.env }}
  76. - name: {{ $key }}
  77. value: {{ $value }}
  78. {{- end }}
  79. volumeMounts:
  80. - name: volume-configmap-{{ $adminServiceFullName }}
  81. mountPath: /apollo-adminservice/config/application-github.properties
  82. subPath: application-github.properties
  83. livenessProbe:
  84. tcpSocket:
  85. port: {{ .Values.adminService.containerPort }}
  86. initialDelaySeconds: {{ .Values.adminService.liveness.initialDelaySeconds }}
  87. periodSeconds: {{ .Values.adminService.liveness.periodSeconds }}
  88. readinessProbe:
  89. httpGet:
  90. path: {{ .Values.adminService.config.contextPath }}/health
  91. port: {{ .Values.adminService.containerPort }}
  92. initialDelaySeconds: {{ .Values.adminService.readiness.initialDelaySeconds }}
  93. periodSeconds: {{ .Values.adminService.readiness.periodSeconds }}
  94. resources:
  95. {{- toYaml .Values.adminService.resources | nindent 12 }}
  96. {{- with .Values.adminService.nodeSelector }}
  97. nodeSelector:
  98. {{- toYaml . | nindent 8 }}
  99. {{- end }}
  100. {{- with .Values.adminService.affinity }}
  101. affinity:
  102. {{- toYaml . | nindent 8 }}
  103. {{- end }}
  104. {{- with .Values.adminService.tolerations }}
  105. tolerations:
  106. {{- toYaml . | nindent 8 }}
  107. {{- end }}