deploy-canary.yaml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. ---
  2. apiVersion: apps.kruise.io/v1beta1
  3. #apiVersion: apps/v1
  4. kind: StatefulSet
  5. metadata:
  6. name: book-api-canary
  7. namespace: book-api
  8. labels:
  9. app: book-api
  10. spec:
  11. serviceName: book-api-canary
  12. replicas: 1
  13. selector:
  14. matchLabels:
  15. app: book-api-canary
  16. template:
  17. metadata:
  18. labels:
  19. app: book-api-canary
  20. spec:
  21. hostNetwork: true
  22. readinessGates:
  23. - conditionType: InPlaceUpdateReady
  24. terminationGracePeriodSeconds: 30
  25. dnsPolicy: ClusterFirstWithHostNet
  26. dnsConfig:
  27. nameservers:
  28. - 223.5.5.5
  29. - 10.26.22.50
  30. initContainers:
  31. - name: init
  32. image: hub.evbj.easou.com/dev/busybox
  33. command: ['sh', "-c", 'chmod 777 -R /data && mkdir -p /data/project && mkdir -p /data/log']
  34. imagePullPolicy: IfNotPresent
  35. volumeMounts:
  36. - name: volume
  37. mountPath: /data
  38. - name: init-package
  39. image: hub.evbj.easou.com/dev/busybox
  40. command: ['sh', '-c', 'rm -rf /data/project/* && wget http://10.26.22.190/release/app-web/prod-64/novelapi/3.1.280/novelapi_3.1.280_consumeLibChange_T3.1.279-181268_3.1.280_20221021-200016_RBL/ROOT.war -O /data/project/ROOT.war && md5sum /data/project/ROOT.war']
  41. imagePullPolicy: IfNotPresent
  42. volumeMounts:
  43. - name: volume
  44. mountPath: /data
  45. containers:
  46. - name: book-api-canary
  47. image: hub.evbj.easou.com/dev/book-api:v3.1base
  48. imagePullPolicy: Always
  49. ports:
  50. - containerPort: 8080
  51. name: port
  52. lifecycle:
  53. preStop:
  54. exec:
  55. command: ["/bin/sh","-c","supervisorctl stop all"]
  56. volumeMounts:
  57. - name: volume
  58. mountPath: /data
  59. livenessProbe:
  60. tcpSocket:
  61. port: 8080
  62. initialDelaySeconds: 45
  63. periodSeconds: 15
  64. readinessProbe:
  65. tcpSocket:
  66. port: 8080
  67. initialDelaySeconds: 45
  68. periodSeconds: 15
  69. updateStrategy:
  70. type: RollingUpdate
  71. rollingUpdate:
  72. podUpdatePolicy: InPlaceIfPossible
  73. inPlaceUpdateStrategy:
  74. gracePeriodSeconds: 10
  75. volumeClaimTemplates:
  76. - metadata:
  77. name: volume
  78. spec:
  79. accessModes: ["ReadWriteOnce"]
  80. storageClassName: rbd
  81. resources:
  82. requests:
  83. storage: 200Gi
  84. ---
  85. apiVersion: v1
  86. kind: Service
  87. metadata:
  88. name: book-api-canary-svc
  89. namespace: book-api
  90. labels:
  91. app: book-api--canary-svc
  92. spec:
  93. type: NodePort
  94. ports:
  95. - port: 8080
  96. targetPort: 8080
  97. nodePort: 30540
  98. selector:
  99. app: book-api-canary
  100. ---
  101. #apiVersion: networking.k8s.io/v1
  102. #kind: Ingress
  103. #metadata:
  104. # name: book-api-ingress
  105. # namespace: book-api
  106. #spec:
  107. # rules:
  108. # - host: book-api-book-api.ieasou.cn
  109. # http:
  110. # paths:
  111. # - path: /
  112. # pathType: Prefix
  113. # backend:
  114. # service:
  115. # name: book-api-svc
  116. # port:
  117. # number: 8080
  118. # ingressClassName: nginx