cht-core icon indicating copy to clipboard operation
cht-core copied to clipboard

CHT deploy script error: upgrade-service image referenced incorrectly

Open 1yuv opened this issue 9 months ago • 9 comments

Deploying with latest (master) cht-script results in incorrectly tagged pod and the service image is incorrect.

Steps to replicate:

  1. Check out current master

  2. Create values.yaml with this document reference

  3. Apply this with ./cht-deploy script from cht-core/scripts/deploy.

  4. When it completes applying, you get sucessful deployment.

  5. Check the status of pods. upgrade-service is failed at InvalidImageName.

    ➜  deploy git:(master) ✗ k -n yuvraj-dev get po                                       
    NAME                                       READY   STATUS             RESTARTS   AGE
    cht-api-5f99b5684f-5kl44                   1/1     Running            0          9m11s
    cht-couchdb-ffd46779-hlq72                 1/1     Running            0          9m11s
    cht-haproxy-8f66cb488-5vzkx                1/1     Running            0          9m11s
    cht-haproxy-healthcheck-7fbc585b9c-bznrx   1/1     Running            0          9m11s
    cht-sentinel-56f958f5b4-62htm              1/1     Running            0          9m11s
    upgrade-service-8c894c85c-7jbvl            0/1     InvalidImageName   0          9m11s
    
  6. When you inspect the pod, you get detailed error:

     state:
       waiting:
         message: 'Failed to apply default image tag "medicmobile/upgrade-service:medicmobile/upgrade-service:0.32":
           couldn''t parse image reference "medicmobile/upgrade-service:medicmobile/upgrade-service:0.32":
           invalid reference format'
         reason: InvalidImageName
    
  7. The reason for this is image is being referenced incorectly.

    spec:
      containers:
      - env:
        - name: CHT_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: CHT_DEPLOYMENT_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.labels['cht.service']
        - name: UPGRADE_SERVICE_PORT
          value: "5008"
        image: medicmobile/upgrade-service:medicmobile/upgrade-service:0.32
        imagePullPolicy: IfNotPresent
        name: upgrade-service
    

1yuv avatar Apr 30 '24 01:04 1yuv

This could possibly be a bug in medic/helm-charts.

The correct image tag for this deployment's container definition should be:

image: medicmobile/upgrade-service:medicmobile/upgrade-service:0.32

I was able to run upgrade-service after I edited deployment and pointed to correct image tag.

1yuv avatar Apr 30 '24 01:04 1yuv

This PR fixes it. It will be released today.

henokgetachew avatar Apr 30 '24 03:04 henokgetachew

@1yuv Can you please verify that this has been resolved?

dianabarsan avatar May 01 '24 10:05 dianabarsan

This is not fixed yet. I ran helm repo update and applied the changes just as specified here, and the issue is same.

NAME                                       READY   STATUS             RESTARTS   AGE
cht-api-5f99b5684f-4vwx4                   1/1     Running            0          11s
cht-couchdb-ffd46779-9n4z6                 1/1     Running            0          11s
cht-haproxy-8f66cb488-c6nt8                1/1     Running            0          11s
cht-haproxy-healthcheck-7fbc585b9c-p2869   1/1     Running            0          10s
cht-sentinel-56f958f5b4-9b7ts              1/1     Running            0          10s
upgrade-service-8c894c85c-4d4w8            0/1     InvalidImageName   0          11s

1yuv avatar May 01 '24 21:05 1yuv

I had to start an instance to check the CHT release quickly and experienced this exact issue today

latin-panda avatar May 23 '24 05:05 latin-panda

The fix is in the cht-deploy-fixes branch @latin-panda. Can you confirm that works for you?

henokgetachew avatar May 25 '24 04:05 henokgetachew

@henokgetachew I can confirm switching to that branch and deploying from there worked.

Benmuiruri avatar May 31 '24 13:05 Benmuiruri

FYI you can also npx to deploy now. It's been published to npm. Meaning you don't have to do it from the repo. Just run npx @medic/cht-deploy -f <path-from-your-yaml>

henokgetachew avatar May 31 '24 16:05 henokgetachew

I will leave the ticket open until the PR gets merged. I'll leave it assigned to myself until then.

henokgetachew avatar May 31 '24 17:05 henokgetachew

Hi @henokgetachew , associated PR appears to be merged. Based on this, can you close this issue?

1yuv avatar Sep 26 '24 17:09 1yuv