示例#1
0
func (c *AddonsCreateCmd) Run(args []string) error {
	k, err := addonsCmd.buildClusterAddons()
	if err != nil {
		return err
	}

	addonFiles := make(map[string][]vfs.Path)

	for _, path := range args {
		vfsPath := vfs.NewFSPath(path)

		files, err := vfsPath.ReadDir()
		if err != nil {
			return fmt.Errorf("error listing path %s: %v", vfsPath, err)
		}

		key := vfsPath.Base()
		addonFiles[key] = files
	}

	for key, files := range addonFiles {
		glog.Infof("Creating addon %q", key)
		err := k.CreateAddon(key, files)
		if err != nil {
			return fmt.Errorf("error creating addon %q: %v", key, err)
		}
	}

	return nil
}
示例#2
0
func buildDefaultCreateCluster() *CreateClusterCmd {
	var err error

	c := &CreateClusterCmd{}

	c.ClusterConfig = &cloudup.CloudConfig{}
	c.ClusterConfig.ClusterName = "testcluster.mydomain.com"
	c.ClusterConfig.NodeZones = []string{"us-east-1a", "us-east-1b", "us-east-1c"}
	c.ClusterConfig.MasterZones = c.ClusterConfig.NodeZones
	c.SSHPublicKey = "~/.ssh/id_rsa.pub"

	c.ClusterConfig.CloudProvider = "aws"

	dryrun := false
	c.StateStore, err = fi.NewVFSStateStore(vfs.NewFSPath("test-state"), dryrun)
	if err != nil {
		glog.Fatalf("error building state store: %v", err)
	}

	return c
}