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:
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:
- any entity can "embed" any other entities as its fields;
- the name of each field equals to the type of embedded entity;
- 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:
Where each resource is entity of type k8s.scoped-resource.v1.
And any other resource can "implement" it by embedding it as field:
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:
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:
So, for the "Reduced Access Cluster" component the inputs would be:
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": { } } }