<p>Is there documentation on building <strong>k8s jobs</strong> in go-client somewhere? In particular I'm trying to convert a job yaml to go code and for the life of me cannot find reference docs that say how the fields convert</p>

Saloni Goel
<p><a href="https://github.com/kubernetes/api" rel="nofollow noreferrer"><code>k8s.io/api</code></a> is a package of Kubernetes which <code>kubectl</code> and other components use it to implement Kubernetes <code>API</code>s. In this package, there is a struct that implements the <code>Job</code> API and you can use it to convert Job manifests to go structs.</p>
<p>I think this code can help:</p>
<pre><code>package main

import (
    &quot;fmt&quot;
    &quot;io/ioutil&quot;
    &quot;os&quot;

    &quot;gopkg.in/yaml.v2&quot;
    v1 &quot;k8s.io/api/batch/v1&quot;
)

func main() {
    file, err := os.Open(&quot;/path/to/job.yaml&quot;)
    if err != nil {
        panic(err)
    }

    b, err := ioutil.ReadAll(file)
    if err != nil {
        panic(err)
    }

    job := &amp;v1.Job{}
    err = yaml.Unmarshal(b, job)
    if err != nil {
        panic(err)
    }

    fmt.Println(job)
}
</code></pre>
