title: Parse byte array for yaml value - kubebuilder
body: <p>We are using <a href="https://github.com/kubernetes-sigs/kubebuilder" rel="nofollow noreferrer">kubebuilder</a> to build our custom controller, the problem is we are not able to parse <strong>raw data</strong> as it comes empty when you apply the file.</p>
  <p>I’ve created very minimal example which describe the issue.</p>
  <p>apiVersion: mygroup.test.com/v1alpha1</p>
  <pre><code>kind: Rawtest
  metadata:
    name: rawtest-sample
  spec:
    system:
      type: test
      provider:
        type: aws
        infrastructureConfig:
          kind: InfrastructureConfig
          apiVersion: v1alpha1
          networks:
            vpc:
              cidr: aaa
            zones:
              - name: abc
                internal: 123
        workers:
          - name: myworker
            machine:
              type: &quot;mt&quot;
              image:
                name: name1
                version: &quot;2&quot;
            maximum: 2
            minimum: 1
            maxUnavailable: 0
            volume:
              type: a1
              size: 20Gi
            zones:
              - zone1
  </code></pre>
  <p>In runtime I was able to get the the <code>spec.system.type</code> value=test and <code>spec.system.provider.type</code> value=&quot;aws&quot;, however I wasn’t able to get all the data under the <code>infrastructureConfig:</code> (line 10)  any idea how can I overcome this ?</p>
  <p>I’ve created this very simple project to demonstrate the issue ,
  See the api/type folder,  after getting the reconcile object (after apply the config/sample/ file ,you see that the <code>infrastructureconfig</code> and all related data are</p>
  <p><a href="https://github.com/JennyMet/" rel="nofollow noreferrer">https://github.com/JennyMet/</a></p>
  <p>Here is the code which is trying to read the raw value
  <a href="https://github.com/JennyMet/kuberaw/blob/master/controllers/rawtest_controller.go#L57" rel="nofollow noreferrer">https://github.com/JennyMet/kuberaw/blob/master/controllers/rawtest_controller.go#L57</a></p>
  <p><code> &amp;rawtest</code> should contain all the data</p>
  <p>please see the type
  <a href="https://github.com/JennyMet/kuberaw/blob/master/api/v1alpha1/rawtest_types.go#L32" rel="nofollow noreferrer">https://github.com/JennyMet/kuberaw/blob/master/api/v1alpha1/rawtest_types.go#L32</a></p>
  <p><strong>raw type</strong>
  <a href="https://github.com/gardener/gardener/blob/bf32324d9d1a366d8a0a7514956dc39c2f22f7b7/pkg/apis/core/v1beta1/types_shoot.go#L945" rel="nofollow noreferrer">https://github.com/gardener/gardener/blob/bf32324d9d1a366d8a0a7514956dc39c2f22f7b7/pkg/apis/core/v1beta1/types_shoot.go#L945</a></p>
  <p><a href="https://github.com/gardener/gardener/blob/bf32324d9d1a366d8a0a7514956dc39c2f22f7b7/pkg/apis/core/types_shoot.go#L774" rel="nofollow noreferrer">https://github.com/gardener/gardener/blob/bf32324d9d1a366d8a0a7514956dc39c2f22f7b7/pkg/apis/core/types_shoot.go#L774</a></p>
  <p><a href="https://github.com/gardener/gardener/blob/bf32324d9d1a366d8a0a7514956dc39c2f22f7b7/vendor/k8s.io/apimachinery/pkg/runtime/types.go#L94:6" rel="nofollow noreferrer">https://github.com/gardener/gardener/blob/bf32324d9d1a366d8a0a7514956dc39c2f22f7b7/vendor/k8s.io/apimachinery/pkg/runtime/types.go#L94:6</a></p>
  <p>I need a way to make it work in the kubebuilder, as while I apply the file I dont get the values in debug ...</p>
  <p>debug pic</p>
  <p><a href="https://i.stack.imgur.com/1lijb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1lijb.png" alt="enter image description here" /></a></p>
  <p>if something is missing please let me know.</p>