rmqsync.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package k8s
  2. var rmqSyncTmeplate = `apiVersion: apps/v1beta2
  3. kind: Deployment
  4. metadata:
  5. name: {{.name}}
  6. namespace: {{.namespace}}
  7. labels:
  8. app: {{.name}}
  9. spec:
  10. replicas: {{.replicas}}
  11. revisionHistoryLimit: {{.revisionHistoryLimit}}
  12. selector:
  13. matchLabels:
  14. app: {{.name}}
  15. template:
  16. metadata:
  17. labels:
  18. app: {{.name}}
  19. spec:{{if .envIsDev}}
  20. terminationGracePeriodSeconds: 60{{end}}
  21. containers:
  22. - name: {{.name}}
  23. image: registry-vpc.cn-hangzhou.aliyuncs.com/{{.namespace}}/
  24. lifecycle:
  25. preStop:
  26. exec:
  27. command: ["sh","-c","sleep 5"]
  28. env:
  29. - name: aliyun_logs_k8slog
  30. value: "stdout"
  31. - name: aliyun_logs_k8slog_tags
  32. value: "stage={{.env}}"
  33. - name: aliyun_logs_k8slog_format
  34. value: "json"
  35. resources:
  36. limits:
  37. cpu: {{.limitCpu}}m
  38. memory: {{.limitMem}}Mi
  39. requests:
  40. cpu: {{.requestCpu}}m
  41. memory: {{.requestMem}}Mi
  42. command:
  43. - ./{{.serviceName}}
  44. - -f
  45. - ./{{.name}}.json
  46. volumeMounts:
  47. - name: timezone
  48. mountPath: /etc/localtime
  49. imagePullSecrets:
  50. - name: {{.namespace}}
  51. volumes:
  52. - name: timezone
  53. hostPath:
  54. path: /usr/share/zoneinfo/Asia/Shanghai{{if .envIsPreOrPro}}
  55. ---
  56. apiVersion: v1
  57. kind: Service
  58. metadata:
  59. name: {{.name}}-svc
  60. namespace: {{.namespace}}
  61. spec:
  62. selector:
  63. app: {{.name}}
  64. sessionAffinity: None
  65. type: ClusterIP
  66. clusterIP: None{{end}}`