turbonomic / orm

Operator Resource Mapping
Apache License 2.0
5 stars 13 forks source link

Support predefined variable to retrieve string value from owned resource #38

Closed kuanf closed 1 year ago

kuanf commented 1 year ago

In first release, we only support {{owned.name}} to retrieve metadata.name of owned resource to be used in patterns. But in some cases, the information we need lives in a label (or somewhere else) rather than the name. So we want to allow orm composer to be able to provide a path to retrieve the string value anywhere inside the owned resource.

example:

    - ownerPath: .spec.settings.deployment.serverBundles[?(@.name=="{{.owned.metadata.labels.xxx/yyy}}")].replica
      owned:
        apiVersion: apps/v1
        kind: Deployment
        selector: serverBundle_component
        path: .spec.replicas

If the path does not point to a string value, an error should be reported.