Commit 3cba189f authored by Dmitry Shulyak's avatar Dmitry Shulyak Committed by Maciej Kwiek

Define both rudder port and rudder address for different needs

parent bd47b844
...@@ -34,7 +34,7 @@ import ( ...@@ -34,7 +34,7 @@ import (
var kubeClient = kube.New(nil) var kubeClient = kube.New(nil)
func main() { func main() {
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", rudder.GrpcAddr)) lis, err := net.Listen("tcp", fmt.Sprintf(":%d", rudder.GrpcPort))
if err != nil { if err != nil {
grpclog.Fatalf("failed to listen: %v", err) grpclog.Fatalf("failed to listen: %v", err)
} }
......
...@@ -17,19 +17,25 @@ limitations under the License. ...@@ -17,19 +17,25 @@ limitations under the License.
package rudder // import "k8s.io/helm/pkg/rudder" package rudder // import "k8s.io/helm/pkg/rudder"
import ( import (
"fmt"
"golang.org/x/net/context" "golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
"k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/release"
) )
// GrpcAddr is an address that should be used to access Rudder service // GrpcPort specifies port on which rudder will spawn a server
const GrpcAddr = "127.0.0.1:10001" const (
GrpcPort = 10001
)
var grpcAddr = fmt.Sprintf("127.0.0.1:%d", GrpcPort)
// InstallRelease calls Rudder InstallRelease method which should create provided release // InstallRelease calls Rudder InstallRelease method which should create provided release
func InstallRelease(rel *release.InstallReleaseRequest) (*release.InstallReleaseResponse, error) { func InstallRelease(rel *release.InstallReleaseRequest) (*release.InstallReleaseResponse, error) {
//TODO(mkwiek): parametrize this //TODO(mkwiek): parametrize this
conn, err := grpc.Dial(GrpcAddr, grpc.WithInsecure()) conn, err := grpc.Dial(grpcAddr, grpc.WithInsecure())
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -41,7 +47,7 @@ func InstallRelease(rel *release.InstallReleaseRequest) (*release.InstallRelease ...@@ -41,7 +47,7 @@ func InstallRelease(rel *release.InstallReleaseRequest) (*release.InstallRelease
// UpgradeRelease calls Rudder UpgradeRelease method which should perform update // UpgradeRelease calls Rudder UpgradeRelease method which should perform update
func UpgradeRelease(req *release.UpgradeReleaseRequest) (*release.UpgradeReleaseResponse, error) { func UpgradeRelease(req *release.UpgradeReleaseRequest) (*release.UpgradeReleaseResponse, error) {
conn, err := grpc.Dial(GrpcAddr, grpc.WithInsecure()) conn, err := grpc.Dial(grpcAddr, grpc.WithInsecure())
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -52,7 +58,7 @@ func UpgradeRelease(req *release.UpgradeReleaseRequest) (*release.UpgradeRelease ...@@ -52,7 +58,7 @@ func UpgradeRelease(req *release.UpgradeReleaseRequest) (*release.UpgradeRelease
// RollbackRelease calls Rudder RollbackRelease method which should perform update // RollbackRelease calls Rudder RollbackRelease method which should perform update
func RollbackRelease(req *release.RollbackReleaseRequest) (*release.RollbackReleaseResponse, error) { func RollbackRelease(req *release.RollbackReleaseRequest) (*release.RollbackReleaseResponse, error) {
conn, err := grpc.Dial(GrpcAddr, grpc.WithInsecure()) conn, err := grpc.Dial(grpcAddr, grpc.WithInsecure())
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment