Skip to content

Experimental Rudder implementation - #2079

Merged
technosophos merged 12 commits into
helm:masterfrom
nebril:new-backend
May 5, 2017
Merged

technosophos merged 12 commits into
helm:masterfrom
nebril:new-backend

Conversation

@nebril

@nebril nebril commented Mar 8, 2017 •

Copy link
Copy Markdown
Contributor

This change introduces the concept of Rudders - pluggable modules that
Tiller communicates with via grpc, which allow to decouple orchestration
logic from Tiller into separate service.

This commit consists of simple Rudder implementation which does exactly
the same thing as built in Tiller orchestrator - it creates all k8s
objects from provided manifest without orchestrating them.

--experimental-release flag is introduced to enable this behaviour.

This change allows to use the service and tiller outside of the cluster.
Following commits will add Rudder to helm deployment.

It is the first PR in effort to implement #1924

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 8, 2017
@nebril

nebril commented Mar 8, 2017

Copy link
Copy Markdown
Contributor Author

@technosophos @adamreese please share your feedback. If the implementation is correct, should this code be merged, or should the part in which Rudder is actually incorporated into helm pod also be part of this PR?

Checking out CI issues now.

// regular manifests
b := bytes.NewBufferString(r.Manifest)
if err := s.env.KubeClient.Create(r.Namespace, b, req.Timeout, req.Wait); err != nil {
if err := s.ReleaseModule.Create(r, req, s.env); err != nil {

@technosophos technosophos Mar 8, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me happy. It is a very clean integration.

Comment thread cmd/tiller/tiller.go
p.StringVarP(&grpcAddr, "listen", "l", ":44134", "address:port to listen on")
p.StringVar(&store, "storage", storageConfigMap, "storage driver to use. One of 'configmap' or 'memory'")
p.BoolVar(&enableTracing, "trace", false, "enable rpc tracing")
p.BoolVar(&remoteReleaseModules, "experimental-release", false, "enable experimental release modules")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you implemented it this way.

Comment thread cmd/rudder/rudder.go

"k8s.io/helm/pkg/kube"
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/rudder"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to have not been checked in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Sorry about that! I thought there was an issue with CI building against older version of Helm :D.

@technosophos

Copy link
Copy Markdown
Member

@nebril Looking good! I'm pleased to see that the interface is looking really clean. I was worried that there might be a major release server refactor lurking. But it looks good.

Which version of protoc are you using? I'm trying to track down the origin of some of the regeneration changes that I am seeing on lots of PRs.

@nebril

nebril commented Mar 9, 2017

Copy link
Copy Markdown
Contributor Author

@technosophos I am using libprotoc 3.2.0 . I don't have a lot of experience with protobuffs, so I am not sure what caused all of these binary changes there.

@technosophos

Copy link
Copy Markdown
Member

Okay, I just read through all of the code, and it is exactly on track. It feels like a very clean separation of concerns.

I think you can just keep on going with the upgrade/delete/rollback logic.

I'll add @adamreese and I as reviewers on the issue. I'm also going to cc @fibonacci1729, who's the resident expert on gRPC.

@technosophos technosophos added this to the 2.3.0 milestone Mar 9, 2017
Comment thread cmd/rudder/rudder.go Outdated
if err != nil {
grpclog.Printf("error when creating release: %s", err)
}
return &release.InstallReleaseResponse{}, err

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why response is empty?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An oversight on my part.

Comment thread cmd/rudder/rudder.go
func (r *ReleaseModuleServiceServer) InstallRelease(ctx context.Context, in *release.InstallReleaseRequest) (*release.InstallReleaseResponse, error) {
grpclog.Print("install")
b := bytes.NewBufferString(in.Release.Manifest)
err := kubeClient.Create(in.Release.Namespace, b, 500, false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure that we shouldn't wait here? because 500 seconds of timeout without waiting is meaningless

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This timeout should be derived from the request, I did not include passing parameteres from InstallReleaseRequest sent to tiller to rudder yet.

Comment thread cmd/rudder/rudder.go

grpclog.Print("Server starting")
grpcServer.Serve(lis)
grpclog.Print("Server started")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is unreachable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed.

@thomastaylor312 thomastaylor312 changed the title Experimental Rudder implementation WIP: Experimental Rudder implementation Mar 17, 2017
@thomastaylor312

Copy link
Copy Markdown
Contributor

Per the new developer workflow guidelines, I have removed the wip label and have prefaced the issue with "WIP." Please remove the "WIP" preface when it is ready for review.

@nebril nebril changed the title WIP: Experimental Rudder implementation Experimental Rudder implementation Mar 23, 2017

syntax = "proto3";

package hapi.services.rudder;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

services there looks like reminder from some refactors, right?

@nebril nebril changed the title Experimental Rudder implementation WIP Experimental Rudder implementation Mar 23, 2017
Comment thread cmd/rudder/rudder.go Outdated
limitations under the License.
*/

package main // import "k8s.io/helm/cmd/rudder"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With other packages such comment have a sense, but with main?

Comment thread cmd/rudder/rudder.go Outdated
return &rudderAPI.InstallReleaseResponse{}, err
}

// DeleteRelease is not implemented

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be implemented in this PR?

Comment thread cmd/rudder/rudder.go Outdated
return nil, nil
}

// RollbackRelease is not implemented

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like implemented ;)

Comment thread cmd/rudder/rudder.go Outdated
// ReleaseModuleServiceServer provides implementation for rudderAPI.ReleaseModuleServiceServer
type ReleaseModuleServiceServer struct{}

// Version is not yet implemented

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like implemented to me :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to fix this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return env.KubeClient.Update(target.Namespace, c, t, req.Recreate, req.Timeout, req.Wait)
}

func (m *LocalReleaseModule) Status(r *release.Release, req *services.GetReleaseStatusRequest, env *environment.Environment) (string, error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docstring for exported func.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return env.KubeClient.Create(r.Namespace, b, req.Timeout, req.Wait)
}

func (m *LocalReleaseModule) Update(current, target *release.Release, req *services.UpdateReleaseRequest, env *environment.Environment) error {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docstring for exported func.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return env.KubeClient.Update(target.Namespace, c, t, req.Recreate, req.Timeout, req.Wait)
}

func (m *LocalReleaseModule) Rollback(current, target *release.Release, req *services.RollbackReleaseRequest, env *environment.Environment) error {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docstring for exported func.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return err
}

func (m *RemoteReleaseModule) Status(r *release.Release, req *services.GetReleaseStatusRequest, env *environment.Environment) (string, error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docstring for exported func.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@technosophos technosophos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the most recent batch of changes, and I think we are good to merge. I will double-check with @adamreese today.

Comment thread cmd/rudder/rudder.go
type ReleaseModuleServiceServer struct{}

// Version returns Rudder version based on helm version
func (r *ReleaseModuleServiceServer) Version(ctx context.Context, in *rudderAPI.VersionReleaseRequest) (*rudderAPI.VersionReleaseResponse, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this get called anywhere?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is required by the proto, but we haven't added a call for it anywhere. The intention was to make this available for (a) logging, and (b) the future toggle switch that allows choosing which rudder to run for a given release.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matts comment is correct, I have nothing further to add.

Comment thread Makefile Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to a different target so CI won't need to build it.

Comment thread rootfs/Dockerfile.experimental Outdated

ENV HOME /tmp

COPY . /

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should only copy the tiller binary to cut the image size in half.

Comment thread rootfs/Dockerfile.rudder Outdated

ENV HOME /tmp

COPY . /

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should only copy the rudder binary to cut the image size in half. feels deja vu

@technosophos

Copy link
Copy Markdown
Member

Bumping to 2.5 to clear off for today's release.

nebril and others added 11 commits May 5, 2017 13:02
This change introduces the concept of Rudders - pluggable modules that
Tiller communicates with via grpc, which allow to decouple orchestration
logic from Tiller into separate service.

This commit consists of simple Rudder implementation which does exactly
the same thing as built in Tiller orchestrator - it creates all k8s
objects from provided manifest without orchestrating them.

--experimental-release flag is introduced to enable this behaviour.

This change allows to use the service and tiller outside of the cluster.
Following commits will add Rudder to helm deployment.
Added dockerfiles for rudder service and tiller run with
--experimental-release flag
Both local and remote Release module implement release status check.
Extracted delete specific code from ReleaseServer to external function
which is called from both Local and Remote ReleaseModules.

Made getVersionSet function from tiller package exported.
Added make target
Lowered docker image sizes
Updated ruder.pb.go
@nebril

nebril commented May 5, 2017

Copy link
Copy Markdown
Contributor Author

@adamreese fixed the stuff you mentioned, please review :)

@technosophos

Copy link
Copy Markdown
Member

Re-reviewed and it looks good still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants