30

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

David Maze
  • 130,717
  • 29
  • 175
  • 215
pcampana
  • 2,413
  • 2
  • 21
  • 39

4 Answers4

43

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

pcampana
  • 2,413
  • 2
  • 21
  • 39
2

I had the same error but no duplicate variables. Reordering the env vars alphabetically worked for me :-(

LiorH
  • 18,524
  • 17
  • 70
  • 98
0

I had the same error, but no duplicate env variable. I forced the update by doing:

helm upgrade [RELEASE] [CHART] --force
h q
  • 1,168
  • 2
  • 10
  • 23
  • In my case it was because the same environment variable was being set via Helm chart template value interpolation. – Coder Guy Oct 05 '21 at 16:15
0

I got the same error fixed via remove duplicated variable.

Sanchelz
  • 103
  • 10