Skip to content

Entity Abstraction/Composition #10

Description

@Exeteres

Let's take a loot at the "Reduced Access Cluster" component that is designed to provide a new cluster entity but with access only to resources passed as entities via inputs:

Image

The main problem here is that it has to define all possible inputs for all possible entities (resources) because now the Highstate's "type system" requires entities to have exactly the same types to be passed via inputs. These is no something like interfaces or inheritance.

I consider the following solution:

  1. any entity can "embed" any other entities as its fields;
  2. the name of each field equals to the type of embedded entity;
  3. such parent entity can be passed to any input accepting one of its child entities: child data will be automatically extracted from corresponding field.

So, for the "Reduced Access Cluster" component the inputs would be:

Image

Where each resource is entity of type k8s.scoped-resource.v1.

And any other resource can "implement" it by embedding it as field:

{
  "type": "service",
  "spec": { },

  // here we embed child entity
  "k8s.scoped-resource.v1": {
    "metadata": { }
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions