deployment-configservice.yaml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ---
  2. # configmap for apollo-configservice
  3. kind: ConfigMap
  4. apiVersion: v1
  5. metadata:
  6. {{- $configServiceFullName := include "apollo.configService.fullName" . }}
  7. name: {{ $configServiceFullName }}
  8. data:
  9. application-github.properties: |
  10. spring.datasource.url = jdbc:mysql://{{include "apollo.configdb.serviceName" .}}:{{include "apollo.configdb.servicePort" .}}/{{ .Values.configdb.dbName }}{{ if .Values.configdb.connectionStringProperties }}?{{ .Values.configdb.connectionStringProperties }}{{ end }}
  11. spring.datasource.username = {{ required "configdb.userName is required!" .Values.configdb.userName }}
  12. spring.datasource.password = {{ required "configdb.password is required!" .Values.configdb.password }}
  13. apollo.config-service.url = {{ include "apollo.configService.serviceUrl" .}}
  14. apollo.admin-service.url = {{ include "apollo.adminService.serviceUrl" .}}
  15. {{- if .Values.configService.config.contextPath }}
  16. server.servlet.context-path = {{ .Values.configService.config.contextPath }}
  17. {{- end }}
  18. ---
  19. kind: Deployment
  20. apiVersion: apps/v1
  21. metadata:
  22. name: {{ $configServiceFullName }}
  23. labels:
  24. {{- include "apollo.service.labels" . | nindent 4 }}
  25. spec:
  26. replicas: {{ .Values.configService.replicaCount }}
  27. selector:
  28. matchLabels:
  29. app: {{ $configServiceFullName }}
  30. {{- with .Values.configService.strategy }}
  31. strategy:
  32. {{- toYaml . | nindent 4 }}
  33. {{- end }}
  34. template:
  35. metadata:
  36. labels:
  37. app: {{ $configServiceFullName }}
  38. spec:
  39. {{- with .Values.configService.imagePullSecrets }}
  40. imagePullSecrets:
  41. {{- toYaml . | nindent 8 }}
  42. {{- end }}
  43. volumes:
  44. - name: volume-configmap-{{ $configServiceFullName }}
  45. configMap:
  46. name: {{ $configServiceFullName }}
  47. items:
  48. - key: application-github.properties
  49. path: application-github.properties
  50. defaultMode: 420
  51. containers:
  52. - name: {{ .Values.configService.name }}
  53. image: "{{ .Values.configService.image.repository }}:{{ .Values.configService.image.tag | default .Chart.AppVersion }}"
  54. imagePullPolicy: {{ .Values.configService.image.pullPolicy }}
  55. ports:
  56. - name: http
  57. containerPort: {{ .Values.configService.containerPort }}
  58. protocol: TCP
  59. env:
  60. - name: SPRING_PROFILES_ACTIVE
  61. value: {{ .Values.configService.config.profiles | quote }}
  62. {{- range $key, $value := .Values.configService.env }}
  63. - name: {{ $key }}
  64. value: {{ $value }}
  65. {{- end }}
  66. volumeMounts:
  67. - name: volume-configmap-{{ $configServiceFullName }}
  68. mountPath: /apollo-configservice/config/application-github.properties
  69. subPath: application-github.properties
  70. livenessProbe:
  71. tcpSocket:
  72. port: {{ .Values.configService.containerPort }}
  73. initialDelaySeconds: {{ .Values.configService.liveness.initialDelaySeconds }}
  74. periodSeconds: {{ .Values.configService.liveness.periodSeconds }}
  75. readinessProbe:
  76. httpGet:
  77. path: {{ .Values.configService.config.contextPath }}/health
  78. port: {{ .Values.configService.containerPort }}
  79. initialDelaySeconds: {{ .Values.configService.readiness.initialDelaySeconds }}
  80. periodSeconds: {{ .Values.configService.readiness.periodSeconds }}
  81. resources:
  82. {{- toYaml .Values.configService.resources | nindent 12 }}
  83. {{- with .Values.configService.nodeSelector }}
  84. nodeSelector:
  85. {{- toYaml . | nindent 8 }}
  86. {{- end }}
  87. {{- with .Values.configService.affinity }}
  88. affinity:
  89. {{- toYaml . | nindent 8 }}
  90. {{- end }}
  91. {{- with .Values.configService.tolerations }}
  92. tolerations:
  93. {{- toYaml . | nindent 8 }}
  94. {{- end }}