Search code examples
kuberneteskubernetes-helm

helm error when updating: UPGRADE FAILED: The order in patch list


I have a problem with helm deployment. It has happend after I have added a new environment variable to the deployment.

When I execute: helm upgrade [RELEASE] [CHART]

I get the following error:

Error: The order in patch list:
[
    map[name:APP_ENV value:prod]
    map[name:MAILER_URL value:...] 
    map[name:APP_VERSION value:v0-0-3] 
    map[name:APP_COMMIT_SHA value:...]
]
 doesn't match $setElementOrder list:
[
    map[name:APP_ENV] 
    map[name:COMPOSER_HOME] 
    map[name:PHP_XDEBUG_ENABLED] 
    map[name:DATABASE_DRIVER] 
    map[name:DATABASE_HOST] 
    map[name:DATABASE_NAME] 
    map[name:DATABASE_USER] 
    map[name:SECRET] 
    map[name:INDEX_HOSTS]
    map[name:MAILER_FROM_ADDRESS] 
    map[name:MAILER_FROM_NAME] 
    map[name:UPLOAD_DIR] 
    map[name:ARCHIVE_DIR] 
    map[name:CATALOG_STORAGE_DIR] 
    map[name:ASSET_STORAGE_DIR] 
    map[name:TMP_STORAGE_DIR] 
    map[name:UPLOAD_TMP_DIR] 
    map[name:APP_VERSION] 
    map[name:APP_COMMIT_SHA] 
    map[name:APP_CRON] 
    map[name:DATABASE_PASSWORD] 
    map[name:MAILER_URL]
    ...
]

However, if I execute the same command with the flag --dry-run, I do not get any error ( helm upgrade [RELEASE] [CHART] --dry-run)

I don't know the reason of this problem or how to solve it


Solution

  • I've found that the reason of this problem was that I had some envVars duplicated. In my deployment I had:

    ...
    spec:
      template:
        spec:
          container:
            env:
            - name:  ENV_VAR_NAME
              value: "test"
            - name:  ENV_VAR_NAME
              value: "test"
    ...
    

    After removing the duplicated variable:

    ...
    spec:
      template:
        spec:
          container:
            env:
            - name:  ENV_VAR_NAME
              value: "test"
    ...
    

    The helm upgrade [RELEASE] [CHART] worked fine