deployment-portal.yaml 3.5 KB

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