Created
December 26, 2018 18:44
-
-
Save Aagat/934a4a0c4ed05c6bc5f357eacda0ed27 to your computer and use it in GitHub Desktop.
k8s yaml deployment manifest to client-go structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"github.com/ghodss/yaml" | |
"k8s.io/api/apps/v1" | |
) | |
func main() { | |
bytes, err := ioutil.ReadFile("deployment.yml") | |
if err != nil { | |
panic(err.Error()) | |
} | |
var spec v1.Deployment | |
err = yaml.Unmarshal(bytes, &spec) | |
if err != nil { | |
panic(err.Error()) | |
} | |
fmt.Println("%#v", spec) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment