使用choerodon更新应用后,部署总览里的最新版本不会更新

  • Choerodon平台版本:0.16.0

  • 运行环境(如localhost或k8s):k8s

  • 遇到问题时的前置条件:

  • 问题描述:

    请尽量详细的描述您遇到的问题,以便我们能更快速的提供解决办法。

    如:在Choerodon中使用流水线部署应用,最近的变动提交后,流水线执行成功

但是部署总览中的应用最新版本不会变动

通过kubectl get deployment查看详情发现镜像的为2019.5.22-075429-dev,与部署总览里的最新版本一致。

[root@dongfang-his ~]# kubectl get deployments -n dev his-gateway-267b4 -o yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "5"
  creationTimestamp: "2019-05-22T02:41:28Z"
  generation: 5
  labels:
    choerodon.io: 0.16.0
    choerodon.io/application: his-gateway
    choerodon.io/logs-parser: spring-boot
    choerodon.io/release: his-gateway-267b4
    choerodon.io/version: 2019.5.22-075429-dev
  name: his-gateway-267b4
  namespace: dev
  resourceVersion: "2760736"
  selfLink: /apis/extensions/v1beta1/namespaces/dev/deployments/his-gateway-267b4
  uid: 19bae4ef-7c3b-11e9-8298-20040ff6e100
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      choerodon.io/release: his-gateway-267b4
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        choerodon.io/metrics-group: spring-boot
        choerodon.io/metrics-path: /prometheus
      creationTimestamp: null
      labels:
        choerodon.io: 0.16.0
        choerodon.io/application: his-gateway
        choerodon.io/metrics-port: "18081"
        choerodon.io/release: his-gateway-267b4
        choerodon.io/service: his-gateway
        choerodon.io/version: 2019.5.22-075429-dev
    spec:
      containers:
      - env:
        - name: MY_NODE_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: spec.nodeName
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: MY_POD_UID
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.uid
        - name: MY_POD_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: MY_POD_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.podIP
        - name: HOST_IP
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: status.hostIP
        - name: MY_POD_SERVICE_ACCOUNT
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: spec.serviceAccountName
        image: registry.dongfang.cn/operation-dongfang/his-gateway:2019.5.22-075429-dev
        imagePullPolicy: Always
        name: his-gateway-267b4
        ports:
        - containerPort: 8080
          name: http
          protocol: TCP
        resources:
          limits:
            memory: 2Gi
          requests:
            memory: 1Gi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /opt/logs
          name: logs-volume
        - mountPath: /etc/localtime
          name: host-time
          readOnly: true
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: myregistrykey
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - hostPath:
          path: /opt/logs/dev/his-gateway
          type: ""
        name: logs-volume
      - hostPath:
          path: /etc/localtime
          type: ""
        name: host-time
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2019-05-22T06:01:09Z"
    lastUpdateTime: "2019-05-22T06:01:09Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2019-05-22T02:41:28Z"
    lastUpdateTime: "2019-05-22T07:57:36Z"
    message: ReplicaSet "his-gateway-267b4-777b467566" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 5
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1

通过helm list查看应用的部署版本也是2019.5.22-075429-dedev

[root@dongfang-his ~]# helm list --all | grep his-gateway
his-gateway-267b4                       	5       	Wed May 22 15:57:32 2019	DEPLOYED	his-gateway-2019.5.22-075429-dev	2019.5.22-075429-dedev        

  • 原因分析:

    通过流水线执行汇总,可以发现最近的更新都是成功执行的,实例页面也没有任何报错

我从正常运行的pod中将java程序的jar包拷贝出来,发现jar里的改动是最新的,说明应用更新是正常的,但是choerodon的页面显示最新的版本数据是不对的,不管是helm查看还是kubectl查看获取的应用镜像版本都不对。

  • 疑问:

    这样就存在一个问题,choerodon如何确认一个应用的发布是正常的?还是说我的配置哪里有错误导致获取应用的最新版本出错?

您好,在choerodon这边,如果界面上实例的版本和 Helm get xxx 出来的版本,以及kubectl get deployment xxx出来的版本是一致的,那么该应用实例版本就是部署成功的。

你可以看下ci里面生成版本的commit是不是你最新的commit.保证你的最新的commit触发的gitlab-ci已经正常生成了版本

gitlab-ci是没有问题的,每次提交都能触发构建新的版本。

但是choerodon上实例页面显示的版本有些问题,但是pod里的jar包是对的,我拷贝jar包出来核对过修改的地方。