capactio / capact

Simple way to manage applications and infrastructure.
https://capact.io
Apache License 2.0
80 stars 19 forks source link

Add an option to update backend for already existing TypeInstance #636

Open mszostok opened 2 years ago

mszostok commented 2 years ago

Description

Make the backend.id mutable. Currently, it's saved on the root of the TypeInstance (same as typeRef) and cannot be changed via GraphQL mutation. This should be change from immutable to become mutable.

We don't need to change mutation GraphQL syntax:

mutation CreateTypeInstances {
  createTypeInstances(
    in: {
     typeInstances: [
      {
        alias: "helm-release"
        typeRef: { path: "cap.type.helm.chart.release", revision: "0.1.0" }
        value: {
          key: "test" # same as it was
        }
        backend: {
          id: "123" # it's like that already.
          context: { # new property of type `Any!`
            name: "release-name",
            namespace: "release-namespace",
          }
        }
      }
    ]
  }
  ) {
    id
    alias
  }
}

but we need to change how it is handled by Local Hub and save it under TypeInstanceRevision.

Acceptance Criteria

Related issues

See epic #604 for reason and use cases.

mszostok commented 2 years ago

If implemented we need to ensure that delegated storage backends will work properly, see discussion in: https://github.com/capactio/capact/pull/644#discussion_r814720864