deploy-canary.yaml 3.0 KB

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