Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Commit

Permalink
Seperate apply step out
Browse files Browse the repository at this point in the history
  • Loading branch information
liztio committed Jul 15, 2019
1 parent d39da20 commit 4265d22
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/capdctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ func main() {
case "setup":
setup.Parse(os.Args[2:])
makeManagementCluster(*managementClusterName, *version, *capdImage, *capiImage)
case "apply":
applyControlPlane(*managementClusterName, *version, *capiImage, *capdImage)
case "control-plane":
controlPlane.Parse(os.Args[2:])
fmt.Fprintf(os.Stdout, machineYAML(controlPlaneOpts))
Expand Down Expand Up @@ -185,6 +187,10 @@ func makeManagementCluster(clusterName, capiVersion, capdImage, capiImageOverrid
panic(err)
}

applyControlPlane(clusterName, capiVersion, capiImage, capdImage)
}

func applyControlPlane(clusterName, capiVersion, capiImage, capdImage string) {
fmt.Println("Downloading the latest CRDs for CAPI version", capiVersion)
objects, err := objects.GetManegementCluster(capiVersion, capiImage, capdImage)
if err != nil {
Expand Down Expand Up @@ -246,7 +252,7 @@ func (a *APIHelper) Create(obj runtime.Object) error {
return errors.Wrapf(err, "failed to retrieve mapping for %s %s", gvk.String(), accessor.GetName())
}

fmt.Printf("Creating %s %s\n", gvk.String(), accessor.GetName())
fmt.Printf("Creating %s %s in %s\n", gvk.String(), accessor.GetName(), accessor.GetNamespace())

_, err = resource.NewHelper(a.client, mapping).Create(accessor.GetNamespace(), true, obj, nil)
return errors.Wrapf(err, "failed to create object %q", accessor.GetName())
Expand Down

0 comments on commit 4265d22

Please sign in to comment.