<p>I want to refer a property of an object created by a CRD.</p>

<p>Here is my example. I create a Cloud SQL instance using the CRD from <a href="https://github.com/GoogleCloudPlatform/k8s-config-connector" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/k8s-config-connector</a>.</p>

<p>This generates an instance with an IP. 
I want to reference the IP address in another resource.</p>

<p>Is there something similar to the downstream API that will allow me to do this?</p>

<p>If I can't do it Natively can I do it with third party templating tools like Helm, Helmfile or Kustomize?</p>

Stefan Thorpe
<p>Nothing in particular, the way we do it is the controller exposes info like the IP or hostname on the Status sub-struct of the subordinate object, and then copy that into the Status of the root object, and then we read from that and inject it into a config file.</p>

<p><a href="https://github.com/Ridecell/ridecell-operator/blob/39344f4318ff3bcb68ce32dd4319b655a60277da/pkg/controller/summon/components/postgres.go#L58-L61" rel="nofollow noreferrer">https://github.com/Ridecell/ridecell-operator/blob/39344f4318ff3bcb68ce32dd4319b655a60277da/pkg/controller/summon/components/postgres.go#L58-L61</a> is an example of the copy-over but it's in our framework so probably not super helpful directly.</p>

<p>Another option we use in other places is making an init container that reads from the CRD status and writes out (or transforms) config files. An example of that is <a href="https://github.com/Ridecell/ridecell-operator/blob/39344f4318ff3bcb68ce32dd4319b655a60277da/cmd/initcontainer/main.go#L181-L203" rel="nofollow noreferrer">https://github.com/Ridecell/ridecell-operator/blob/39344f4318ff3bcb68ce32dd4319b655a60277da/cmd/initcontainer/main.go#L181-L203</a></p>
