Skip to content

Commit

Permalink
doc/migration: Tweak client examples, add unstructured (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
Casey Callendrello authored and hasbro17 committed Nov 5, 2018
1 parent ee6eee6 commit c627d62
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doc/migration/v0.1.0-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,20 @@ See the examples below and the controller-runtime [client API doc][client-api-do
```Go
// Create
dep := &appsv1.Deployment{...}
err := sdk.Create(dep)
// v0.0.1
err := sdk.Create(dep)
// v0.1.0
err := r.client.Create(context.TODO(), dep)
// Update
// v0.1.0
err := sdk.Update(dep)
// v0.0.1
// v0.1.0
err := r.client.Update(context.TODO(), dep)
// Delete
err := sdk.Delete(dep)
// v0.0.1
// v0.1.0
err := r.client.Delete(context.TODO(), dep)
// List
Expand All @@ -237,6 +239,10 @@ err := sdk.Get(dep)
// v0.1.0
dep := &appsv1.Deployment{}
err = r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: namespace}, dep)
// v0.1.0 with unstructured
dep := &unstructured.Unstructured{}
dep.SetGroupVersionKind(schema.GroupVersionKind{Group:"apps", Version: "v1", Kind:"Deployment"})
err = r.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: namespace}, dep)
```
Lastly copy and initialize any other fields that you may have had in your `Handler` struct into the `Reconcile<Kind>` struct:
Expand Down

0 comments on commit c627d62

Please sign in to comment.