root 2 rokov pred
rodič
commit
24a04fe13d
3 zmenil súbory, kde vykonal 132 pridanie a 11 odobranie
  1. 15 10
      .drone.yml
  2. 117 0
      deploy-canary.yaml
  3. 0 1
      deploy.yaml

+ 15 - 10
.drone.yml

@@ -19,19 +19,19 @@ steps:
    pull: always
    environment:
      JNLP_ENV: book-webview
-     JNLP_REPLICAS: 2
-     JNLP_TAG: v3.0.0
+     #JNLP_REPLICAS: 2
+     #JNLP_TAG: v3.0.0
      JNLP_VERSION: v1  # default v1, v2 for canary
      DEPLOY_ENV: k8s-1 # 可以选择把应用部署到集群:k8s-1(阿里云) or k8s-2(IDC机房)
-     JNLP_REPO: hub.evbj.easou.com
-     JNLP_CONTAINER_PORT: 8080
-     JNLP_INGRESS: nginx
-     JNLP_SVC_MODE: http
-     JNLP_STORAGE_CLASS: rbd   #k8s-2的STORAGE_CLASS为: rbd; k8s-1的STORAGE_CLASS为: ceph-block
+     #JNLP_REPO: hub.evbj.easou.com
+     #JNLP_CONTAINER_PORT: 8080
+     #JNLP_INGRESS: nginx
+     #JNLP_SVC_MODE: http
+     #JNLP_STORAGE_CLASS: rbd   #k8s-2的STORAGE_CLASS为: rbd; k8s-1的STORAGE_CLASS为: ceph-block
      JNLP_DOMAIN: .ieasou.cn
      JNLP_CONTROL: StatefulSet
-     JNLP_STORAGE_CAPACITY: 200Gi
-     JNLP_MOUNT_PATH: /data
+     #JNLP_STORAGE_CAPACITY: 200Gi
+     #JNLP_MOUNT_PATH: /data
      JNLP_LIVENESS_INIT: 45
      JNLP_LIVENESS_PER: 15
      JNLP_READINESS_INIT: 45
@@ -43,7 +43,12 @@ steps:
      # 生成配置YAML文件
      # - python3 /root/tools.py -b
      # 部署服务到kubernetes上
-     - python3 /root/tools.py -a
+     # - python3 /root/tools.py -a
+     - pwd && ls -l
+     # apply for prod
+     #- kubectl apply -f deploy.yaml --record
+     # apply for canary
+     - kubectl apply -f deploy-canary.yaml --record
      # 检查服务部署状态
      # - python3 /root/tools.py -c
      # 添加dns解析记录,生成访问域名

+ 117 - 0
deploy-canary.yaml

@@ -0,0 +1,117 @@
+---
+apiVersion: apps.kruise.io/v1beta1
+#apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: book-webview-canary
+  namespace: book-webview
+  labels:
+    app: book-webview
+spec:
+  serviceName: book-webview-canary
+  replicas: 1
+  selector:
+    matchLabels:
+      app: book-webview-canary
+  template:
+    metadata:
+      labels:
+        app: book-webview-canary
+    spec:
+      readinessGates:
+      - conditionType: InPlaceUpdateReady
+      terminationGracePeriodSeconds: 180
+      dnsPolicy: ClusterFirstWithHostNet
+      dnsConfig:
+        nameservers:
+          - 10.26.22.50
+          - 223.5.5.5
+      initContainers:
+        - name: init
+          image: hub.evbj.easou.com/dev/busybox
+          command: ['sh', "-c", 'chmod 777 -R /data && mkdir -p /data/project &&  mkdir -p /data/log']
+          imagePullPolicy: IfNotPresent
+          volumeMounts:
+          - name: volume
+            mountPath: /data
+        - name: init-package
+          image: hub.evbj.easou.com/dev/busybox
+          command: ['sh', '-c', 'rm -rf /data/project/* && wget http://10.26.22.190/release/app-web/prod-64/esbookweb/1.5.416/esbookweb_1.5.416_changeSearchEnv_T1.5.413-180117_1.5.416_20220829-163114_RBL/ROOT.war -O /data/project/ROOT.war']
+          imagePullPolicy: IfNotPresent
+          volumeMounts:
+          - name: volume
+            mountPath: /data
+      containers:
+      - name: book-webview-canary
+        image: hub.evbj.easou.com/dev/book-webview:v3.1base
+        imagePullPolicy: Always
+        ports:
+        - containerPort: 8080
+          name: port
+        volumeMounts:
+        - name: volume
+          mountPath: /data
+        livenessProbe:
+          tcpSocket:
+            port: 8080
+          initialDelaySeconds: 45
+          periodSeconds: 15
+        readinessProbe:
+          tcpSocket:
+            port: 8080
+          initialDelaySeconds: 45
+          periodSeconds: 15
+  updateStrategy:
+    type: RollingUpdate
+    rollingUpdate:
+      podUpdatePolicy: InPlaceIfPossible
+      inPlaceUpdateStrategy:
+        gracePeriodSeconds: 10
+  volumeClaimTemplates:
+  - metadata:
+      name: volume
+    spec:
+      accessModes: ["ReadWriteOnce"]
+      storageClassName: ceph-block
+      resources:
+        requests:
+          storage: 200Gi
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: book-webview-canary-svc
+  namespace: book-webview
+  labels:
+    app: book-webview-canary-svc
+spec:
+  type: NodePort
+  ports:
+  - port: 8080
+    targetPort: 8080
+    nodePort: 30101
+  selector:
+    app: book-webview-canary
+---
+#apiVersion: networking.k8s.io/v1
+#kind: Ingress
+#metadata:
+#  name: book-webview-ingress
+#  namespace: book-webview
+#spec:
+  #tls:
+  #  - hosts:
+  #      - dev-book-webview.ieasou.cn
+  #    secretName: ieasou.cn
+#  rules:
+#  - host: book-webview-book-webview.ieasou.cn
+#    http:
+#      paths:
+#      - path: /
+#        pathType: Prefix
+#        backend:
+#          service:
+#            name: book-webview-svc
+#            port:
+#              number: 8080
+#  ingressClassName: nginx

+ 0 - 1
deploy.yaml

@@ -26,7 +26,6 @@ spec:
         nameservers:
           - 10.26.22.50
           - 223.5.5.5
-          - 114.114.114.114
       initContainers:
         - name: init
           image: hub.evbj.easou.com/dev/busybox