diff --git a/Makefile b/Makefile index 86d9b76e9..dbe8e0334 100644 --- a/Makefile +++ b/Makefile @@ -61,15 +61,20 @@ docker-binary: BINDIR = ./rootfs docker-binary: GOFLAGS += -a -installsuffix cgo docker-binary: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -o $(BINDIR)/tiller $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/tiller - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -o $(BINDIR)/rudder $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/rudder .PHONY: docker-build docker-build: check-docker docker-binary docker build --rm -t ${IMAGE} rootfs docker tag ${IMAGE} ${MUTABLE_IMAGE} +.PHONY: docker-binary-rudder +docker-binary-rudder: BINDIR = ./rootfs +docker-binary-rudder: GOFLAGS += -a -installsuffix cgo +docker-binary-rudder: + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -o $(BINDIR)/rudder $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/rudder + .PHONY: docker-build-experimental -docker-build-experimental: check-docker docker-binary +docker-build-experimental: check-docker docker-binary docker-binary-rudder docker build --rm -t ${IMAGE} rootfs -f rootfs/Dockerfile.experimental docker tag ${IMAGE} ${MUTABLE_IMAGE} docker build --rm -t ${IMAGE_RUDDER} rootfs -f rootfs/Dockerfile.rudder diff --git a/cmd/rudder/rudder.go b/cmd/rudder/rudder.go index be403c45e..0a5a97bff 100644 --- a/cmd/rudder/rudder.go +++ b/cmd/rudder/rudder.go @@ -59,7 +59,7 @@ func main() { // ReleaseModuleServiceServer provides implementation for rudderAPI.ReleaseModuleServiceServer type ReleaseModuleServiceServer struct{} -// Version is not yet implemented +// Version returns Rudder version based on helm version func (r *ReleaseModuleServiceServer) Version(ctx context.Context, in *rudderAPI.VersionReleaseRequest) (*rudderAPI.VersionReleaseResponse, error) { grpclog.Print("version") return &rudderAPI.VersionReleaseResponse{ @@ -100,8 +100,6 @@ func (r *ReleaseModuleServiceServer) DeleteRelease(ctx context.Context, in *rudd if len(allErrors) > 0 { err = fmt.Errorf(allErrors) - } else { - err = nil } return &rudderAPI.DeleteReleaseResponse{ diff --git a/pkg/proto/hapi/rudder/rudder.pb.go b/pkg/proto/hapi/rudder/rudder.pb.go index e5c9f66b1..af5577678 100644 --- a/pkg/proto/hapi/rudder/rudder.pb.go +++ b/pkg/proto/hapi/rudder/rudder.pb.go @@ -88,6 +88,20 @@ func (m *Result) String() string { return proto.CompactTextString(m) func (*Result) ProtoMessage() {} func (*Result) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *Result) GetInfo() string { + if m != nil { + return m.Info + } + return "" +} + +func (m *Result) GetLog() []string { + if m != nil { + return m.Log + } + return nil +} + type VersionReleaseRequest struct { } @@ -106,6 +120,20 @@ func (m *VersionReleaseResponse) String() string { return proto.Compa func (*VersionReleaseResponse) ProtoMessage() {} func (*VersionReleaseResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *VersionReleaseResponse) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *VersionReleaseResponse) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + type InstallReleaseRequest struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` } @@ -213,6 +241,27 @@ func (m *UpgradeReleaseRequest) GetTarget() *hapi_release5.Release { return nil } +func (m *UpgradeReleaseRequest) GetTimeout() int64 { + if m != nil { + return m.Timeout + } + return 0 +} + +func (m *UpgradeReleaseRequest) GetWait() bool { + if m != nil { + return m.Wait + } + return false +} + +func (m *UpgradeReleaseRequest) GetRecreate() bool { + if m != nil { + return m.Recreate + } + return false +} + type UpgradeReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` Result *Result `protobuf:"bytes,2,opt,name=result" json:"result,omitempty"` @@ -264,6 +313,27 @@ func (m *RollbackReleaseRequest) GetTarget() *hapi_release5.Release { return nil } +func (m *RollbackReleaseRequest) GetTimeout() int64 { + if m != nil { + return m.Timeout + } + return 0 +} + +func (m *RollbackReleaseRequest) GetWait() bool { + if m != nil { + return m.Wait + } + return false +} + +func (m *RollbackReleaseRequest) GetRecreate() bool { + if m != nil { + return m.Recreate + } + return false +} + type RollbackReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` Result *Result `protobuf:"bytes,2,opt,name=result" json:"result,omitempty"` @@ -351,7 +421,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for ReleaseModuleService service @@ -589,14 +659,14 @@ var _ReleaseModuleService_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: fileDescriptor0, + Metadata: "hapi/rudder/rudder.proto", } func init() { proto.RegisterFile("hapi/rudder/rudder.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ // 584 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xd1, 0x8e, 0xd2, 0x40, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xd4, 0x56, 0xd1, 0x8e, 0xd2, 0x40, 0x14, 0xa5, 0xcb, 0x52, 0xe0, 0x92, 0x55, 0x32, 0xd9, 0x42, 0xd3, 0xf8, 0x40, 0xfa, 0x60, 0x88, 0xeb, 0x96, 0x04, 0x7d, 0xf4, 0x45, 0x59, 0xdc, 0xdd, 0x18, 0xd9, 0x64, 0x2a, 0x6e, 0xe2, 0x5b, 0x17, 0x2e, 0x58, 0x2d, 0x6d, 0x9d, 0x4e, 0xf7, 0x51, 0xfd, 0x1a, 0xff, 0x43, 0xbf, 0xcc, 0xb4, diff --git a/pkg/tiller/release_modules.go b/pkg/tiller/release_modules.go index 620ec56dc..e13b26de9 100644 --- a/pkg/tiller/release_modules.go +++ b/pkg/tiller/release_modules.go @@ -55,18 +55,21 @@ func (m *LocalReleaseModule) Create(r *release.Release, req *services.InstallRel return env.KubeClient.Create(r.Namespace, b, req.Timeout, req.Wait) } +// Update performs an update from current to target release func (m *LocalReleaseModule) Update(current, target *release.Release, req *services.UpdateReleaseRequest, env *environment.Environment) error { c := bytes.NewBufferString(current.Manifest) t := bytes.NewBufferString(target.Manifest) return env.KubeClient.Update(target.Namespace, c, t, req.Recreate, req.Timeout, req.Wait) } +// Rollback performs a rollback from current to target release func (m *LocalReleaseModule) Rollback(current, target *release.Release, req *services.RollbackReleaseRequest, env *environment.Environment) error { c := bytes.NewBufferString(current.Manifest) t := bytes.NewBufferString(target.Manifest) return env.KubeClient.Update(target.Namespace, c, t, req.Recreate, req.Timeout, req.Wait) } +// Status returns kubectl-like formatted status of release objects func (m *LocalReleaseModule) Status(r *release.Release, req *services.GetReleaseStatusRequest, env *environment.Environment) (string, error) { return env.KubeClient.Get(r.Namespace, bytes.NewBufferString(r.Manifest)) } @@ -116,6 +119,7 @@ func (m *RemoteReleaseModule) Rollback(current, target *release.Release, req *se return err } +// Status returns status retrieved from rudder.ReleaseStatus func (m *RemoteReleaseModule) Status(r *release.Release, req *services.GetReleaseStatusRequest, env *environment.Environment) (string, error) { statusRequest := &rudderAPI.ReleaseStatusRequest{Release: r} resp, err := rudder.ReleaseStatus(statusRequest) diff --git a/rootfs/Dockerfile.experimental b/rootfs/Dockerfile.experimental index 0528471e6..8f3bce3c0 100644 --- a/rootfs/Dockerfile.experimental +++ b/rootfs/Dockerfile.experimental @@ -16,7 +16,7 @@ FROM alpine:3.3 ENV HOME /tmp -COPY . / +COPY tiller /tiller EXPOSE 44134 diff --git a/rootfs/Dockerfile.rudder b/rootfs/Dockerfile.rudder index d39d0ebdb..7821096c5 100644 --- a/rootfs/Dockerfile.rudder +++ b/rootfs/Dockerfile.rudder @@ -16,7 +16,7 @@ FROM alpine:3.3 ENV HOME /tmp -COPY . / +COPY rudder /rudder EXPOSE 10001