mirror of https://github.com/helm/helm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
952 B
44 lines
952 B
package helm
|
|
|
|
import (
|
|
"golang.org/x/net/context"
|
|
"google.golang.org/grpc"
|
|
|
|
"k8s.io/helm/pkg/proto/hapi/services"
|
|
)
|
|
|
|
type client struct {
|
|
cfg *config
|
|
conn *grpc.ClientConn
|
|
impl services.ReleaseServiceClient
|
|
}
|
|
|
|
func (c *client) dial() (err error) {
|
|
c.conn, err = grpc.Dial(c.cfg.ServAddr, c.cfg.DialOpts()...)
|
|
c.impl = services.NewReleaseServiceClient(c.conn)
|
|
return
|
|
}
|
|
|
|
func (c *client) install(req *services.InstallReleaseRequest) (res *services.InstallReleaseResponse, err error) {
|
|
if err = c.dial(); err != nil {
|
|
return
|
|
}
|
|
|
|
defer c.Close()
|
|
|
|
return c.impl.InstallRelease(context.TODO(), req, c.cfg.CallOpts()...)
|
|
}
|
|
|
|
func (c *client) uninstall(req *services.UninstallReleaseRequest) (*services.UninstallReleaseResponse, error) {
|
|
if err := c.dial(); err != nil {
|
|
return nil, err
|
|
}
|
|
defer c.Close()
|
|
|
|
return c.impl.UninstallRelease(context.TODO(), req, c.cfg.CallOpts()...)
|
|
}
|
|
|
|
func (c *client) Close() error {
|
|
return c.conn.Close()
|
|
}
|