Skip to content

Instantly share code, notes, and snippets.

@aaronjwood
Last active July 25, 2021 08:25
Show Gist options
  • Save aaronjwood/cccef38490e14e5eadfa8ed1c769c851 to your computer and use it in GitHub Desktop.
Save aaronjwood/cccef38490e14e5eadfa8ed1c769c851 to your computer and use it in GitHub Desktop.
Stitching it together
func DiscoverParseApply(ctx context.Context, client kubernetes.Interface, dynamicClient dynamic.Interface, manifest string) error {
groupResources, err := restmapper.GetAPIGroupResources(client.Discovery())
if err != nil {
return err
}
var resources []*Resource
docs := ParseDocuments(manifest)
for _, doc := range docs {
resource, err := ParseSearchConstruct(groupResources, dynamicClient, doc)
if err != nil {
return err
}
resources = append(resources, resource)
}
return Apply(ctx, resources...)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment