Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 763
pcampana Avatar asked Mar 17 '20 17:03

pcampana


People also ask

What happens with Helm upgrade?

This command upgrades a release to a new version of a chart. The upgrade arguments must be a release and chart. The chart argument can be either: a chart reference('example/mariadb'), a path to a chart directory, a packaged chart, or a fully qualified URL.

Does helm upgrade install?

Unchecked deployment There are two ways to install Helm charts using the Helm CLI: helm install and helm upgrade --install . The install sub-command always installs a brand new chart, while the upgrade sub-command can upgrade an existing chart and install a new one, if the chart hasn't been installed before.

Does helm upgrade recreate pods?

Use helm to deploy and manage k8s files is very convenience. But helm upgrade will not recreate pods automatically. Someone will add “ --recreate-pods ” to force pods recreate.


1 Answers

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

like image 176
pcampana Avatar answered Sep 16 '22 14:09

pcampana