Ejemplo n.º 1
0
// Install uses kubernetes client to install tiller
//
// Returns the string output received from the operation, and an error if the
// command failed.
//
// If verbose is true, this will print the manifest to stdout.
func Install(client unversioned.DeploymentsNamespacer, namespace, image string, canary, verbose bool) error {
	switch {
	case canary:
		image = defaultImage + ":canary"
	case image == "":
		image = fmt.Sprintf("%s:%s", defaultImage, version.Version)
	}
	obj := generateDeployment(image)
	_, err := client.Deployments(namespace).Create(obj)
	return err
}
// GetDeploymentListChannel returns a pair of channels to a Deployment list and errors
// that both must be read numReads times.
func GetDeploymentListChannel(client client.DeploymentsNamespacer,
	nsQuery *NamespaceQuery, numReads int) DeploymentListChannel {

	channel := DeploymentListChannel{
		List:  make(chan *extensions.DeploymentList, numReads),
		Error: make(chan error, numReads),
	}

	go func() {
		list, err := client.Deployments(nsQuery.ToRequestParam()).List(listEverything)
		var filteredItems []extensions.Deployment
		for _, item := range list.Items {
			if nsQuery.Matches(item.ObjectMeta.Namespace) {
				filteredItems = append(filteredItems, item)
			}
		}
		list.Items = filteredItems
		for i := 0; i < numReads; i++ {
			channel.List <- list
			channel.Error <- err
		}
	}()

	return channel
}
Ejemplo n.º 3
0
// Install uses kubernetes client to install tiller
//
// Returns the string output received from the operation, and an error if the
// command failed.
//
// If verbose is true, this will print the manifest to stdout.
func Install(client unversioned.DeploymentsNamespacer, namespace, image string, canary, verbose bool) error {
	obj := deployment(image, canary)
	_, err := client.Deployments(namespace).Create(obj)
	return err
}