Skip to content

Commit

Permalink
refactor to Complete-Validate-Run
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Weil committed Jun 15, 2016
1 parent b095e3a commit abbf350
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 90 deletions.
29 changes: 19 additions & 10 deletions pkg/bootstrap/docker/openshift/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,28 @@ func (h *Helper) InstallRegistry(kubeClient kclient.Interface, f *clientcmd.Fact
}
imageTemplate := variable.NewDefaultImageTemplate()
imageTemplate.Format = images
cfg := &registry.RegistryConfig{
Name: "registry",
Type: "docker-registry",
ImageTemplate: imageTemplate,
Ports: "5000",
Replicas: 1,
Labels: "docker-registry=default",
Volume: "/registry",
ServiceAccount: "registry",
opts := &registry.RegistryOptions{
Config: &registry.RegistryConfig{
Name: "registry",
Type: "docker-registry",
ImageTemplate: imageTemplate,
Ports: "5000",
Replicas: 1,
Labels: "docker-registry=default",
Volume: "/registry",
ServiceAccount: "registry",
},
}
cmd := registry.NewCmdRegistry(f, "", "registry", out)
output := &bytes.Buffer{}
err = registry.RunCmdRegistry(f, cmd, output, cfg, []string{})
err = opts.Complete(f, cmd, output, []string{})
if err != nil {
return errors.NewError("error completing the registry configuration").WithCause(err)
}
err = opts.RunCmdRegistry()
if err != nil {
return errors.NewError("error creating the registry").WithCause(err)
}
glog.V(4).Infof("Registry command output:\n%s", output.String())
if err != nil {
return errors.NewError("cannot install registry").WithCause(err).WithDetails(h.OriginLog())
Expand Down
Loading

0 comments on commit abbf350

Please sign in to comment.