When defining a child resource with operator-builder, it is often times desirable to take in the input of a parent resource field. The metadata.name field is the one in particular that is NOT accessible to child resources, because it is not defined with a marker, but would be real helpful to be able to use.
Consider the following resource:
---
apiVersion: container.cnrm.cloud.google.com/v1beta1
kind: ContainerCluster
metadata:
# +operator-builder:field:name=clusterName,type=string,description=`
# Name of the GKE cluster to create.`
name: cluster
In the above example, a spec of the following would be used:
The clusterName field must be defined in order for the input to be used, but it may make sense, in this instance to simply use the metadata.name field of the parent resource.
Maybe a marker like this would make sense:
---
apiVersion: container.cnrm.cloud.google.com/v1beta1
kind: ContainerCluster
metadata:
# +operator-builder:field:fromMetadataName,description=`
# Name of the GKE cluster to create.`
name: cluster
When defining a child resource with operator-builder, it is often times desirable to take in the input of a parent resource field. The
metadata.name
field is the one in particular that is NOT accessible to child resources, because it is not defined with a marker, but would be real helpful to be able to use.Consider the following resource:
In the above example, a spec of the following would be used:
The
clusterName
field must be defined in order for the input to be used, but it may make sense, in this instance to simply use themetadata.name
field of the parent resource.Maybe a marker like this would make sense: