Skip to content

Option to deep merge inside naming conflicts #2972

Open
@AnatoleLucet

Description

@AnatoleLucet

Is your feature request related to a problem?

Yes. When inheriting configs using imports, it's hard to override/add specific fields inside a named object.

A very simple example:

# .devspace/shared.yml
dev:
  app:
    imageSelector: ${IMAGE}
    devImage: my-shared-dev-image
      

# apps/my-app/devspace.yml
imports:
  - path: ../../.devspace/shared.yml

vars:
  IMAGE: my-image

dev:
  app:
    ports: # this wont work. i can't add a new custom port or any other field inside `dev.app` without overriding everything
      - port: 8080

Which solution do you suggest?

Maybe adding a new option to the imports object that would allow deep merges to occur within some named objects (or every one)?

Two proposals (one or the other, not both):

imports:
  - path: ../../.devspace/shared.yml
    # 1. deep merge everything
    deepMerge: true
    # 2. deep merge by path
    merge: ["dev.app"] # additional paths of what objects should be merges
    # or `merge: ["*"]` for everything

Which alternative solutions exist?

Using profiles but this is very awkward and hard to read, especially when you need to replace 5 or 10+ fields.

imports:
  - path: ../../.devspace/shared.yml

vars:
  IMAGE: my-image

profiles:
  - name: default
    activation:
      - vars: # always activated
    patches:
      - op: add
        path: dev.app.ports
        value:
          port: 8080

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureNew feature or feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions