deploy-canary.yaml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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: "None"
  26. dnsConfig:
  27. nameservers:
  28. - 223.5.5.5
  29. - 10.26.22.50
  30. searches:
  31. - pro.svc.cluster.local
  32. - svc.cluster.local
  33. - cluster.local
  34. options:
  35. - name: ndots
  36. value: "5"
  37. initContainers:
  38. - name: init
  39. image: hub.evbj.easou.com/dev/busybox
  40. command: ['sh', "-c", 'chmod 777 -R /data && mkdir -p /data/project && mkdir -p /data/log']
  41. imagePullPolicy: IfNotPresent
  42. volumeMounts:
  43. - name: volume
  44. mountPath: /data
  45. - name: init-package
  46. image: hub.evbj.easou.com/dev/busybox
  47. command: ['sh', '-c', 'rm -rf /data/project/* && wget http://10.40.20.61/release/app-web/prod-64/novelapi/3.1.329/novelapi_3.1.329_tempDemand_T3.1.328-194750_3.1.329_20240822-142431_RBL/ROOT.war -O /data/project/ROOT.war && md5sum /data/project/ROOT.war']
  48. imagePullPolicy: IfNotPresent
  49. volumeMounts:
  50. - name: volume
  51. mountPath: /data
  52. containers:
  53. - name: book-api-canary
  54. image: hub.evbj.easou.com/dev/book-api:v3.1base
  55. imagePullPolicy: Always
  56. ports:
  57. - containerPort: 8080
  58. name: port
  59. lifecycle:
  60. preStop:
  61. exec:
  62. command: ["/bin/sh","-c","supervisorctl stop all"]
  63. volumeMounts:
  64. - name: volume
  65. mountPath: /data
  66. livenessProbe:
  67. tcpSocket:
  68. port: 8080
  69. initialDelaySeconds: 45
  70. periodSeconds: 15
  71. readinessProbe:
  72. tcpSocket:
  73. port: 8080
  74. initialDelaySeconds: 45
  75. periodSeconds: 15
  76. updateStrategy:
  77. type: RollingUpdate
  78. rollingUpdate:
  79. podUpdatePolicy: InPlaceIfPossible
  80. inPlaceUpdateStrategy:
  81. gracePeriodSeconds: 10
  82. volumeClaimTemplates:
  83. - metadata:
  84. name: volume
  85. spec:
  86. accessModes: ["ReadWriteOnce"]
  87. storageClassName: rbd
  88. resources:
  89. requests:
  90. storage: 200Gi
  91. ---
  92. apiVersion: v1
  93. kind: Service
  94. metadata:
  95. name: book-api-canary-svc
  96. namespace: book-api
  97. labels:
  98. app: book-api-canary-svc
  99. spec:
  100. type: NodePort
  101. ports:
  102. - port: 8080
  103. targetPort: 8080
  104. nodePort: 30540
  105. selector:
  106. app: book-api-canary
  107. ---
  108. #apiVersion: networking.k8s.io/v1
  109. #kind: Ingress
  110. #metadata:
  111. # name: book-api-ingress
  112. # namespace: book-api
  113. #spec:
  114. # rules:
  115. # - host: book-api-book-api.ieasou.cn
  116. # http:
  117. # paths:
  118. # - path: /
  119. # pathType: Prefix
  120. # backend:
  121. # service:
  122. # name: book-api-svc
  123. # port:
  124. # number: 8080
  125. # ingressClassName: nginx