diff --git a/pkg/client/client.go b/pkg/client/client.go index b5c90da40380..4bc7e1e326e3 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -178,6 +178,7 @@ func (c *Client) SubjectAccessReviews(namespace string) SubjectAccessReviewInter return newSubjectAccessReviews(c, namespace) } +// RootSubjectAccessReviews provides a REST client for RootSubjectAccessReviews func (c *Client) RootSubjectAccessReviews() SubjectAccessReviewInterface { return newRootSubjectAccessReviews(c) } diff --git a/pkg/cmd/cli/cmd/buildlogs.go b/pkg/cmd/cli/cmd/buildlogs.go index 95193b59efda..d5c11003d829 100644 --- a/pkg/cmd/cli/cmd/buildlogs.go +++ b/pkg/cmd/cli/cmd/buildlogs.go @@ -21,6 +21,7 @@ Examples: $ %[1]s build-logs 566bed879d2d ` +// NewCmdBuildLogs implements the OpenShift cli build-logs command func NewCmdBuildLogs(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "build-logs ", @@ -34,6 +35,7 @@ func NewCmdBuildLogs(fullName string, f *clientcmd.Factory, out io.Writer) *cobr return cmd } +// RunBuildLogs contains all the necessary functionality for the OpenShift cli build-logs command func RunBuildLogs(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []string) error { if len(args) != 1 { return cmdutil.UsageError(cmd, " is a required argument") diff --git a/pkg/cmd/cli/cmd/cancelbuild.go b/pkg/cmd/cli/cmd/cancelbuild.go index 584e42c9c016..c9343d2d5882 100644 --- a/pkg/cmd/cli/cmd/cancelbuild.go +++ b/pkg/cmd/cli/cmd/cancelbuild.go @@ -29,9 +29,7 @@ Examples: $ %[1]s cancel-build 1da32cvq --restart ` -// NewCmdCancelBuild manages a build cancelling event. -// To cancel a build its name has to be specified, and two options -// are available: displaying logs and restarting. +// NewCmdCancelBuild implements the OpenShift cli cancel-build command func NewCmdCancelBuild(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "cancel-build ", @@ -48,6 +46,7 @@ func NewCmdCancelBuild(fullName string, f *clientcmd.Factory, out io.Writer) *co return cmd } +// RunCancelBuild contains all the necessary functionality for the OpenShift cli cancel-build command func RunCancelBuild(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []string) error { if len(args) == 0 || len(args[0]) == 0 { return cmdutil.UsageError(cmd, "You must specify the name of a build to cancel.") diff --git a/pkg/cmd/cli/cmd/login.go b/pkg/cmd/cli/cmd/login.go index 995d11b1737d..84e7572b19eb 100644 --- a/pkg/cmd/cli/cmd/login.go +++ b/pkg/cmd/cli/cmd/login.go @@ -27,6 +27,7 @@ the server details, can be provided through flags. If not provided, the command prompt for user input as needed. ` +// NewCmdLogin implements the OpenShift cli login command func NewCmdLogin(f *osclientcmd.Factory, reader io.Reader, out io.Writer) *cobra.Command { options := &LoginOptions{ Reader: reader, @@ -74,6 +75,7 @@ func NewCmdLogin(f *osclientcmd.Factory, reader io.Reader, out io.Writer) *cobra return cmds } +// RunLogin contains all the necessary functionality for the OpenShift cli login command func RunLogin(cmd *cobra.Command, options *LoginOptions) error { if certFile := cmdutil.GetFlagString(cmd, "client-certificate"); len(certFile) > 0 { options.CertFile = certFile diff --git a/pkg/cmd/cli/cmd/newapp.go b/pkg/cmd/cli/cmd/newapp.go index af721256e976..284a7993d480 100644 --- a/pkg/cmd/cli/cmd/newapp.go +++ b/pkg/cmd/cli/cmd/newapp.go @@ -57,6 +57,7 @@ application is created. ALPHA: This command is under active development - feedback is appreciated. ` +// NewCmdNewApplication implements the OpenShift cli new-app command func NewCmdNewApplication(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { _, typer := f.Object() config := newcmd.NewAppConfig(typer) @@ -89,6 +90,7 @@ func NewCmdNewApplication(fullName string, f *clientcmd.Factory, out io.Writer) return cmd } +// RunNewApplication contains all the necessary functionality for the OpenShift cli new-app command func RunNewApplication(f *clientcmd.Factory, out io.Writer, c *cobra.Command, args []string, config *newcmd.AppConfig, helper *dockerutil.Helper) error { namespace, err := f.DefaultNamespace() diff --git a/pkg/cmd/cli/cmd/options.go b/pkg/cmd/cli/cmd/options.go index b6c0f4bddfe5..dbcbb46dd37f 100644 --- a/pkg/cmd/cli/cmd/options.go +++ b/pkg/cmd/cli/cmd/options.go @@ -9,6 +9,7 @@ import ( "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) +// NewCmdOptions implements the OpenShift cli options command func NewCmdOptions(f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "options", diff --git a/pkg/cmd/cli/cmd/process.go b/pkg/cmd/cli/cmd/process.go index c6532d62edfe..c716c4dcd7a2 100644 --- a/pkg/cmd/cli/cmd/process.go +++ b/pkg/cmd/cli/cmd/process.go @@ -60,7 +60,7 @@ Examples: $ cat template.json | %[1]s process -f - ` -// NewCmdProcess returns a 'process' command +// NewCmdProcess implements the OpenShift cli process command func NewCmdProcess(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "process -f filename", @@ -81,6 +81,7 @@ func NewCmdProcess(fullName string, f *clientcmd.Factory, out io.Writer) *cobra. return cmd } +// RunProject contains all the necessary functionality for the OpenShift cli process command func RunProcess(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []string) error { storedTemplate := "" if len(args) > 0 { diff --git a/pkg/cmd/cli/cmd/project.go b/pkg/cmd/cli/cmd/project.go index 19c04bbd771e..e8475e993578 100644 --- a/pkg/cmd/cli/cmd/project.go +++ b/pkg/cmd/cli/cmd/project.go @@ -25,6 +25,7 @@ import ( "github.com/spf13/cobra" ) +// NewCmdProject implements the OpenShift cli rollback command func NewCmdProject(f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "project ", @@ -41,6 +42,7 @@ func NewCmdProject(f *clientcmd.Factory, out io.Writer) *cobra.Command { return cmd } +// RunProject contains all the necessary functionality for the OpenShift cli project command func RunProject(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []string) error { argsLength := len(args) diff --git a/pkg/cmd/cli/cmd/rollback.go b/pkg/cmd/cli/cmd/rollback.go index 610183cb2b88..d1e0bf6b04a2 100644 --- a/pkg/cmd/cli/cmd/rollback.go +++ b/pkg/cmd/cli/cmd/rollback.go @@ -42,6 +42,7 @@ Examples: $ %[1]s rollback deployment-1 --output=json | %[1]s update deploymentConfigs deployment -f - ` +// NewCmdRollback implements the OpenShift cli rollback command func NewCmdRollback(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { rollback := &deployapi.DeploymentConfigRollback{ Spec: deployapi.DeploymentConfigRollbackSpec{ @@ -69,6 +70,7 @@ func NewCmdRollback(fullName string, f *clientcmd.Factory, out io.Writer) *cobra return cmd } +// RunRollback contains all the necessary functionality for OpenShift cli rollback command func RunRollback(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []string, rollback *deployapi.DeploymentConfigRollback) error { if len(args) == 0 || len(args[0]) == 0 { return cmdutil.UsageError(cmd, "A deployment name is required.") diff --git a/pkg/cmd/cli/cmd/startbuild.go b/pkg/cmd/cli/cmd/startbuild.go index d1866406c863..62619d4d588c 100644 --- a/pkg/cmd/cli/cmd/startbuild.go +++ b/pkg/cmd/cli/cmd/startbuild.go @@ -31,6 +31,7 @@ Examples: $ %[1]s start-build 3bd2ug53b --follow ` +// NewCmdStartBuild implements the OpenShift cli start-build command func NewCmdStartBuild(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "start-build (|--from-build=)", @@ -46,6 +47,7 @@ func NewCmdStartBuild(fullName string, f *clientcmd.Factory, out io.Writer) *cob return cmd } +// RunStartBuild contains all the necessary functionality for the OpenShift cli start-build command func RunStartBuild(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, args []string) error { buildName := cmdutil.GetFlagString(cmd, "from-build") follow := cmdutil.GetFlagBool(cmd, "follow") diff --git a/pkg/cmd/cli/cmd/status.go b/pkg/cmd/cli/cmd/status.go index e566c6abef6e..f75398231152 100644 --- a/pkg/cmd/cli/cmd/status.go +++ b/pkg/cmd/cli/cmd/status.go @@ -18,6 +18,7 @@ For more information about individual items, use the describe command (e.g. osc osc describe deploymentConfig, osc describe service). ` +// NewCmdStatus implements the OpenShift cli status command func NewCmdStatus(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "status", @@ -31,6 +32,7 @@ func NewCmdStatus(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.C return cmd } +// RunStatus contains all the necessary functionality for the OpenShift cli status command func RunStatus(f *clientcmd.Factory, out io.Writer) error { client, kclient, err := f.Clients() if err != nil { diff --git a/pkg/cmd/cli/cmd/wrappers.go b/pkg/cmd/cli/cmd/wrappers.go index 52c6725b3fdc..f2b0ff40aca1 100644 --- a/pkg/cmd/cli/cmd/wrappers.go +++ b/pkg/cmd/cli/cmd/wrappers.go @@ -11,6 +11,7 @@ import ( "github.com/openshift/origin/pkg/cmd/util/clientcmd" ) +// NewCmdGet is a wrapper for the Kubernetes cli get command func NewCmdGet(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := cmd.NewCmdGet(f.Factory, out) longDesc := `Display one or many resources. @@ -35,6 +36,7 @@ Examples: return cmd } +// NewCmdUpdate is a wrapper for the Kubernetes cli update command func NewCmdUpdate(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := cmd.NewCmdUpdate(f.Factory, out) longDesc := `Update a resource by filename or stdin. @@ -56,6 +58,7 @@ Examples: return cmd } +// NewCmdDelete is a wrapper for the Kubernetes cli delete command func NewCmdDelete(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := cmd.NewCmdDelete(f.Factory, out) longDesc := `Delete a resource by filename, stdin, resource and ID, or by resources and label selector. @@ -90,6 +93,7 @@ Examples: return cmd } +// NewCmdLog is a wrapper for the Kubernetes cli log command func NewCmdLog(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := cmd.NewCmdLog(f.Factory, out) longDesc := `Print the logs for a container in a pod. If the pod has only one container, the container name is optional. @@ -106,6 +110,7 @@ Examples: return cmd } +// NewCmdCreate is a wrapper for the Kubernetes cli create command func NewCmdCreate(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := cmd.NewCmdCreate(f.Factory, out) longDesc := `Create a resource by filename or stdin. @@ -124,6 +129,7 @@ Examples: return cmd } +// NewCmdExec is a wrapper for the Kubernetes cli exec command func NewCmdExec(fullName string, f *clientcmd.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer) *cobra.Command { cmd := cmd.NewCmdExec(f.Factory, cmdIn, cmdOut, cmdErr) longDesc := `Execute a command in a container. @@ -140,6 +146,7 @@ Examples: return cmd } +// NewCmdPortForward is a wrapper for the Kubernetes cli port-forward command func NewCmdPortForward(fullName string, f *clientcmd.Factory) *cobra.Command { cmd := cmd.NewCmdPortForward(f.Factory) longDesc := `Forward 1 or more local ports to a pod. @@ -162,6 +169,7 @@ Examples: return cmd } +// NewCmdDescribe is a wrapper for the Kubernetes cli describe command func NewCmdDescribe(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := cmd.NewCmdDescribe(f.Factory, out) longDesc := `Show details of a specific resource. @@ -181,6 +189,7 @@ Examples: return cmd } +// NewCmdProxy is a wrapper for the Kubernetes cli proxy command func NewCmdProxy(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command { cmd := cmd.NewCmdProxy(f.Factory, out) longDesc := `Run a proxy to the Kubernetes API server. diff --git a/pkg/cmd/cli/config/smart_merge.go b/pkg/cmd/cli/config/smart_merge.go index dd128a64f696..7f33f088ccfe 100644 --- a/pkg/cmd/cli/config/smart_merge.go +++ b/pkg/cmd/cli/config/smart_merge.go @@ -223,7 +223,7 @@ func getUniqueName(basename string, existingNames *util.StringSet) string { return string(util.NewUUID()) } -// Generates the best context identifier possible based on the information it gets. +// GenerateContextIdentifier generates the best context identifier possible based on the information it gets. func GenerateContextIdentifier(namespace string, cluster string, authInfo string, existingContextIdentifiers *util.StringSet) string { ctx := "" diff --git a/pkg/cmd/cli/describe/deployments.go b/pkg/cmd/cli/describe/deployments.go index d34cb0d2c87f..2a3f373ef380 100644 --- a/pkg/cmd/cli/describe/deployments.go +++ b/pkg/cmd/cli/describe/deployments.go @@ -46,6 +46,8 @@ func (c *genericDeploymentDescriberClient) listPods(namespace string, selector l return c.listPodsFunc(namespace, selector) } +// NewDeploymentConfigDescriberForConfig returns a new DeploymentConfigDescriber +// for a DeploymentConfig func NewDeploymentConfigDescriberForConfig(config *deployapi.DeploymentConfig) *DeploymentConfigDescriber { return &DeploymentConfigDescriber{ client: &genericDeploymentDescriberClient{ @@ -62,6 +64,7 @@ func NewDeploymentConfigDescriberForConfig(config *deployapi.DeploymentConfig) * } } +// NewDeploymentConfigDescriber returns a new DeploymentConfigDescriber func NewDeploymentConfigDescriber(client client.Interface, kclient kclient.Interface) *DeploymentConfigDescriber { return &DeploymentConfigDescriber{ client: &genericDeploymentDescriberClient{ @@ -78,6 +81,7 @@ func NewDeploymentConfigDescriber(client client.Interface, kclient kclient.Inter } } +// Describe returns a description of a DeploymentConfigDescriber func (d *DeploymentConfigDescriber) Describe(namespace, name string) (string, error) { deploymentConfig, err := d.client.getDeploymentConfig(namespace, name) if err != nil { @@ -235,6 +239,7 @@ type DeploymentDescriber struct { client.Interface } +// Describe returns a description of a DeploymentDescriber func (d *DeploymentDescriber) Describe(namespace, name string) (string, error) { c := d.Deployments(namespace) deployment, err := c.Get(name) diff --git a/pkg/cmd/cli/describe/describer.go b/pkg/cmd/cli/describe/describer.go index 4a94887e65e2..a412b957794d 100644 --- a/pkg/cmd/cli/describe/describer.go +++ b/pkg/cmd/cli/describe/describer.go @@ -28,6 +28,7 @@ import ( templateapi "github.com/openshift/origin/pkg/template/api" ) +// DescriberFor returns a describer for a given kind of resource func DescriberFor(kind string, c *client.Client, kclient kclient.Interface, host string) (kctl.Describer, bool) { switch kind { case "Build": @@ -77,6 +78,7 @@ type BuildDescriber struct { client.Interface } +// DescribeUser formats the description of a user func (d *BuildDescriber) DescribeUser(out *tabwriter.Writer, label string, u buildapi.SourceControlUser) { if len(u.Name) > 0 && len(u.Email) > 0 { formatString(out, label, fmt.Sprintf("%s <%s>", u.Name, u.Email)) @@ -91,6 +93,7 @@ func (d *BuildDescriber) DescribeUser(out *tabwriter.Writer, label string, u bui } } +// Describe returns the description of a build func (d *BuildDescriber) Describe(namespace, name string) (string, error) { c := d.Builds(namespace) build, err := c.Get(name) @@ -258,6 +261,7 @@ func (s sortableBuilds) Swap(i, j int) { s[j] = t } +// Describe returns the description of a buildConfig func (d *BuildConfigDescriber) Describe(namespace, name string) (string, error) { c := d.BuildConfigs(namespace) buildConfig, err := c.Get(name) @@ -304,6 +308,7 @@ type BuildLogDescriber struct { client.Interface } +// Describe returns the description of a buildLog func (d *BuildLogDescriber) Describe(namespace, name string) (string, error) { return fmt.Sprintf("Name: %s/%s, Labels:", namespace, name), nil } @@ -313,6 +318,7 @@ type ImageDescriber struct { client.Interface } +// Describe returns the description of an image func (d *ImageDescriber) Describe(namespace, name string) (string, error) { c := d.Images() image, err := c.Get(name) @@ -336,6 +342,7 @@ type ImageStreamTagDescriber struct { client.Interface } +// Describe returns the description of an imageStreamTag func (d *ImageStreamTagDescriber) Describe(namespace, name string) (string, error) { c := d.ImageStreamTags(namespace) repo, tag := parsers.ParseRepositoryTag(name) @@ -356,6 +363,7 @@ type ImageStreamImageDescriber struct { client.Interface } +// Describe returns the description of an imageStreamImage func (d *ImageStreamImageDescriber) Describe(namespace, name string) (string, error) { c := d.ImageStreamImages(namespace) repo, id := parsers.ParseRepositoryTag(name) @@ -372,6 +380,7 @@ type ImageStreamDescriber struct { client.Interface } +// Describe returns the description of an imageStream func (d *ImageStreamDescriber) Describe(namespace, name string) (string, error) { c := d.ImageStreams(namespace) imageStream, err := c.Get(name) @@ -392,6 +401,7 @@ type RouteDescriber struct { client.Interface } +// Describe returns the description of a route func (d *RouteDescriber) Describe(namespace, name string) (string, error) { c := d.Routes(namespace) route, err := c.Get(name) @@ -413,6 +423,7 @@ type ProjectDescriber struct { client.Interface } +// Describe returns the description of a project func (d *ProjectDescriber) Describe(namespace, name string) (string, error) { c := d.Projects() project, err := c.Get(name) @@ -433,6 +444,7 @@ type PolicyDescriber struct { client.Interface } +// Describe returns the description of a policy // TODO make something a lot prettier func (d *PolicyDescriber) Describe(namespace, name string) (string, error) { c := d.Policies(namespace) @@ -484,6 +496,7 @@ type RoleDescriber struct { client.Interface } +// Describe returns the description of a role func (d *RoleDescriber) Describe(namespace, name string) (string, error) { c := d.Roles(namespace) role, err := c.Get(name) @@ -509,6 +522,7 @@ type PolicyBindingDescriber struct { client.Interface } +// Describe returns the description of a policyBinding func (d *PolicyBindingDescriber) Describe(namespace, name string) (string, error) { c := d.PolicyBindings(namespace) policyBinding, err := c.Get(name) @@ -539,6 +553,7 @@ type RoleBindingDescriber struct { client.Interface } +// Describe returns the description of a roleBinding func (d *RoleBindingDescriber) Describe(namespace, name string) (string, error) { c := d.RoleBindings(namespace) roleBinding, err := c.Get(name) @@ -599,6 +614,7 @@ type TemplateDescriber struct { DescribeObject func(obj runtime.Object, out *tabwriter.Writer) (bool, error) } +// DescribeParameters prints out information about the parameters of a template func (d *TemplateDescriber) DescribeParameters(params []templateapi.Parameter, out *tabwriter.Writer) { formatString(out, "Parameters", " ") indent := " " @@ -621,6 +637,7 @@ func (d *TemplateDescriber) DescribeParameters(params []templateapi.Parameter, o } } +// DescribeObjects prints out information about the objects of a template func (d *TemplateDescriber) DescribeObjects(objects []runtime.Object, out *tabwriter.Writer) { formatString(out, "Objects", " ") indent := " " @@ -645,6 +662,7 @@ func (d *TemplateDescriber) DescribeObjects(objects []runtime.Object, out *tabwr } } +// Describe returns the description of a template func (d *TemplateDescriber) Describe(namespace, name string) (string, error) { c := d.Templates(namespace) template, err := c.Get(name) @@ -671,6 +689,7 @@ type IdentityDescriber struct { client.Interface } +// Describe returns the description of an identity func (d *IdentityDescriber) Describe(namespace, name string) (string, error) { userClient := d.Users() identityClient := d.Identities() @@ -718,6 +737,7 @@ type UserIdentityMappingDescriber struct { client.Interface } +// Describe returns the description of a userIdentity func (d *UserIdentityMappingDescriber) Describe(namespace, name string) (string, error) { c := d.UserIdentityMappings() @@ -740,6 +760,7 @@ type UserDescriber struct { client.Interface } +// Describe returns the description of a user func (d *UserDescriber) Describe(namespace, name string) (string, error) { userClient := d.Users() identityClient := d.Identities() diff --git a/pkg/cmd/cli/describe/printer.go b/pkg/cmd/cli/describe/printer.go index 14989fb243c2..9cd76e42ab6f 100644 --- a/pkg/cmd/cli/describe/printer.go +++ b/pkg/cmd/cli/describe/printer.go @@ -51,6 +51,7 @@ var ( IsPersonalSubjectAccessReviewColumns = []string{"NAME"} ) +// NewHumanReadablePrinter returns a new HumanReadablePrinter func NewHumanReadablePrinter(noHeaders bool) *kctl.HumanReadablePrinter { p := kctl.NewHumanReadablePrinter(noHeaders) p.Handler(buildColumns, printBuild) diff --git a/pkg/cmd/cli/describe/projectstatus.go b/pkg/cmd/cli/describe/projectstatus.go index 0e82724f8c41..9d8637d343c2 100644 --- a/pkg/cmd/cli/describe/projectstatus.go +++ b/pkg/cmd/cli/describe/projectstatus.go @@ -24,6 +24,7 @@ type ProjectStatusDescriber struct { C client.Interface } +// Describe returns the description of a project func (d *ProjectStatusDescriber) Describe(namespace, name string) (string, error) { project, err := d.C.Projects().Get(namespace) if err != nil { diff --git a/pkg/cmd/experimental/buildchain/buildchain.go b/pkg/cmd/experimental/buildchain/buildchain.go index 423eb8ce5eb4..3a660d0e38d0 100644 --- a/pkg/cmd/experimental/buildchain/buildchain.go +++ b/pkg/cmd/experimental/buildchain/buildchain.go @@ -84,7 +84,7 @@ func NewEdge(fullname, to string) *Edge { } } -// NewCmdBuildChain implements all the necessary functionality for the build-chain module +// NewCmdBuildChain implements the OpenShift experimental build-chain command func NewCmdBuildChain(f *clientcmd.Factory, parentName, name string) *cobra.Command { cmd := &cobra.Command{ Use: fmt.Sprintf("%s [image-repository]:[tag]", name), @@ -102,6 +102,8 @@ func NewCmdBuildChain(f *clientcmd.Factory, parentName, name string) *cobra.Comm return cmd } +// RunBuildChain contains all the necessary functionality for the OpenShift +// experimental build-chain command func RunBuildChain(f *clientcmd.Factory, cmd *cobra.Command, args []string) error { all := cmdutil.GetFlagBool(cmd, "all") allTags := cmdutil.GetFlagBool(cmd, "all-tags") diff --git a/pkg/deploy/api/types.go b/pkg/deploy/api/types.go index 4198907beb7a..213057905fa1 100644 --- a/pkg/deploy/api/types.go +++ b/pkg/deploy/api/types.go @@ -4,7 +4,7 @@ import ( kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" ) -// A deployment represents a single configuration of a pod deployed into the cluster, and may +// Deployment represents a single configuration of a pod deployed into the cluster, and may // represent both a current deployment or a historical deployment. // // DEPRECATED: This type longer drives any system behavior. Deployments are now represented directly @@ -66,7 +66,7 @@ const ( DeploymentStrategyTypeCustom DeploymentStrategyType = "Custom" ) -// CustomParams are the input to the Custom deployment strategy. +// CustomDeploymentStrategyParams are the input to the Custom deployment strategy. type CustomDeploymentStrategyParams struct { // Image specifies a Docker image which can carry out a deployment. Image string `json:"image,omitempty"` @@ -88,7 +88,7 @@ type RecreateDeploymentStrategyParams struct { Post *LifecycleHook `json:"post,omitempty"` } -// Handler defines a specific deployment lifecycle action. +// LifecycleHook defines a specific deployment lifecycle action. type LifecycleHook struct { // FailurePolicy specifies what action to take if the hook fails. FailurePolicy LifecycleHookFailurePolicy `json:"failurePolicy"` @@ -96,7 +96,7 @@ type LifecycleHook struct { ExecNewPod *ExecNewPodHook `json:"execNewPod,omitempty"` } -// HandlerFailurePolicy describes possibles actions to take if a hook fails. +// LifecycleHookFailurePolicy describes possibles actions to take if a hook fails. type LifecycleHookFailurePolicy string const ( @@ -121,7 +121,7 @@ type ExecNewPodHook struct { ContainerName string `json:"containerName"` } -// A DeploymentList is a collection of deployments. +// DeploymentList is a collection of deployments. // DEPRECATED: Like Deployment, this is no longer used. type DeploymentList struct { kapi.TypeMeta `json:",inline"` @@ -177,7 +177,7 @@ type DeploymentConfig struct { // LatestVersion is used to determine whether the current deployment associated with a DeploymentConfig // is out of sync. LatestVersion int `json:"latestVersion,omitempty"` - // The reasons for the update to this deployment config. + // Details are the reasons for the update to this deployment config. // This could be based on a change made by the user or caused by an automatic trigger Details *DeploymentDetails `json:"details,omitempty"` } @@ -243,12 +243,13 @@ type DeploymentDetails struct { // DeploymentCause captures information about a particular cause of a deployment. type DeploymentCause struct { - // The type of the trigger that resulted in the creation of a new deployment + // Type is the type of the trigger that resulted in the creation of a new deployment Type DeploymentTriggerType `json:"type"` - // The image trigger details, if this trigger was fired based on an image change + // ImageTrigger contains the image trigger details, if this trigger was fired based on an image change ImageTrigger *DeploymentCauseImageTrigger `json:"imageTrigger,omitempty"` } +// DeploymentCauseImageTrigger contains information about a deployment caused by an image trigger type DeploymentCauseImageTrigger struct { // RepositoryName is the identifier for a Docker image repository that was updated. RepositoryName string `json:"repositoryName,omitempty"` @@ -256,7 +257,7 @@ type DeploymentCauseImageTrigger struct { Tag string `json:"tag,omitempty"` } -// A DeploymentConfigList is a collection of deployment configs. +// DeploymentConfigList is a collection of deployment configs. type DeploymentConfigList struct { kapi.TypeMeta `json:",inline"` kapi.ListMeta `json:"metadata,omitempty"` diff --git a/pkg/generate/app/cmd/newapp.go b/pkg/generate/app/cmd/newapp.go index 8fe747b1088b..0448bd5d4de2 100644 --- a/pkg/generate/app/cmd/newapp.go +++ b/pkg/generate/app/cmd/newapp.go @@ -22,6 +22,7 @@ import ( imageapi "github.com/openshift/origin/pkg/image/api" ) +// AppConfig contains all the necessary configuration for an application type AppConfig struct { SourceRepositories util.StringList @@ -42,6 +43,7 @@ type AppConfig struct { typer runtime.ObjectTyper } +// UsageError is an interface for printing usage errors type UsageError interface { UsageError(commandName string) string } @@ -51,6 +53,7 @@ type errlist interface { Errors() []error } +// NewAppConfig returns a new AppConfig func NewAppConfig(typer runtime.ObjectTyper) *AppConfig { dockerResolver := app.DockerRegistryResolver{dockerregistry.NewClient()} return &AppConfig{ @@ -64,6 +67,7 @@ func NewAppConfig(typer runtime.ObjectTyper) *AppConfig { } } +// SetDockerClient sets the passed Docker client in the application configuration func (c *AppConfig) SetDockerClient(dockerclient *docker.Client) { c.dockerResolver = app.DockerClientResolver{ Client: dockerclient, @@ -72,6 +76,7 @@ func (c *AppConfig) SetDockerClient(dockerclient *docker.Client) { } } +// SetOpenShiftClient sets the passed OpenShift client in the application configuration func (c *AppConfig) SetOpenShiftClient(osclient client.Interface, originNamespace string) { c.imageStreamResolver = app.ImageStreamResolver{ Client: osclient, @@ -80,7 +85,7 @@ func (c *AppConfig) SetOpenShiftClient(osclient client.Interface, originNamespac } } -// addArguments converts command line arguments into the appropriate bucket based on what they look like +// AddArguments converts command line arguments into the appropriate bucket based on what they look like func (c *AppConfig) AddArguments(args []string) []string { unknown := []string{} for _, s := range args { @@ -319,8 +324,10 @@ func (c *AppConfig) buildPipelines(components app.ComponentReferences, environme return pipelines, nil } +// ErrNoInputs is returned when no inputs are specified var ErrNoInputs = fmt.Errorf("no inputs provided") +// AppResult contains the results of an application type AppResult struct { List *kapi.List @@ -417,6 +424,8 @@ func (s *simpleSearcher) Search(terms []string) ([]*app.ComponentMatch, error) { type mockSearcher struct{} +// Search takes the first term if it exists and tries to match it to one +// of the known builder images. This is a mock function. func (mockSearcher) Search(terms []string) ([]*app.ComponentMatch, error) { for _, term := range terms { term = strings.ToLower(term) diff --git a/pkg/generate/app/componentref.go b/pkg/generate/app/componentref.go index 1aa1a411aedb..61495e93dcbd 100644 --- a/pkg/generate/app/componentref.go +++ b/pkg/generate/app/componentref.go @@ -11,7 +11,7 @@ import ( templateapi "github.com/openshift/origin/pkg/template/api" ) -// isComponentReference returns true if the provided string appears to be a reference to a source repository +// IsComponentReference returns true if the provided string appears to be a reference to a source repository // on disk, at a URL, a docker image name (which might be on a Docker registry or an OpenShift image stream), // or a template. func IsComponentReference(s string) bool { diff --git a/pkg/image/controller/controller.go b/pkg/image/controller/controller.go index cc3ea8ff9ef8..1bf5595c48a5 100644 --- a/pkg/image/controller/controller.go +++ b/pkg/image/controller/controller.go @@ -178,7 +178,7 @@ func (c *ImportController) Next(repo *api.ImageStream) error { return c.done(repo, "") } -// ignore marks the repository as being processed due to an error or failure condition +// done marks the repository as being processed due to an error or failure condition func (c *ImportController) done(repo *api.ImageStream, reason string) error { if len(reason) == 0 { reason = util.Now().UTC().Format(time.RFC3339) diff --git a/pkg/project/controller/controller.go b/pkg/project/controller/controller.go index e98f23ded159..35540754ea16 100644 --- a/pkg/project/controller/controller.go +++ b/pkg/project/controller/controller.go @@ -22,6 +22,7 @@ type NamespaceController struct { // fatalError is an error which can't be retried. type fatalError string +// Error implements the interface for errors func (e fatalError) Error() string { return "fatal error handling namespace: " + string(e) } // Handle processes a namespace and deletes content in origin if its terminating diff --git a/pkg/route/registry/route/rest.go b/pkg/route/registry/route/rest.go index 554811a20fa3..f03f0b98519b 100644 --- a/pkg/route/registry/route/rest.go +++ b/pkg/route/registry/route/rest.go @@ -23,6 +23,7 @@ type REST struct { allocator route.RouteAllocator } +// NewREST returns a RESTStorage object that will work against routes. func NewREST(registry Registry, allocator route.RouteAllocator) *REST { return &REST{ registry: registry, @@ -30,10 +31,12 @@ func NewREST(registry Registry, allocator route.RouteAllocator) *REST { } } +// New returns a new Route func (rs *REST) New() runtime.Object { return &api.Route{} } +// NewList returns a new list of Routes func (*REST) NewList() runtime.Object { return &api.Route{} } diff --git a/pkg/service/environmentresolvercache.go b/pkg/service/environmentresolvercache.go index 3e37af7a620f..72ecfdf90041 100644 --- a/pkg/service/environmentresolvercache.go +++ b/pkg/service/environmentresolvercache.go @@ -10,6 +10,7 @@ import ( "github.com/GoogleCloudPlatform/kubernetes/pkg/api" ) +// ServiceRetriever is an interface for retrieving services type ServiceRetriever interface { Get(name string) (*api.Service, error) } @@ -19,14 +20,17 @@ type serviceEntry struct { port string } +// ResolverCacheFunc is used for resolving names to services type ResolverCacheFunc func(name string) (*api.Service, error) +// ServiceResolverCache is a cache used for resolving names to services type ServiceResolverCache struct { fill ResolverCacheFunc cache map[string]serviceEntry lock sync.RWMutex } +// NewServiceResolverCache returns a new ServiceResolverCache func NewServiceResolverCache(fill ResolverCacheFunc) *ServiceResolverCache { return &ServiceResolverCache{ cache: make(map[string]serviceEntry), diff --git a/pkg/template/registry/rest.go b/pkg/template/registry/rest.go index aa1f3b47d719..b954e2147f39 100644 --- a/pkg/template/registry/rest.go +++ b/pkg/template/registry/rest.go @@ -37,6 +37,7 @@ func (templateStrategy) NamespaceScoped() bool { return true } +// PrepareForUpdate clears fields that are not allowed to be set by end users on update. func (templateStrategy) PrepareForUpdate(obj, old runtime.Object) {} // PrepareForCreate clears fields that are not allowed to be set by end users on creation. @@ -78,10 +79,12 @@ func NewREST() *REST { return &REST{} } +// New returns a new Template func (s *REST) New() runtime.Object { return &api.Template{} } +// Create processes a Template and creates a new list of objects func (s *REST) Create(ctx kapi.Context, obj runtime.Object) (runtime.Object, error) { tpl, ok := obj.(*api.Template) if !ok { diff --git a/plugins/route/allocation/simple/plugin.go b/plugins/route/allocation/simple/plugin.go index 1c39dab5252c..f6384806ac2c 100644 --- a/plugins/route/allocation/simple/plugin.go +++ b/plugins/route/allocation/simple/plugin.go @@ -20,7 +20,7 @@ type SimpleAllocationPlugin struct { DNSSuffix string } -// Creates a new SimpleAllocationPlugin. +// NewSimpleAllocationPlugin creates a new SimpleAllocationPlugin. func NewSimpleAllocationPlugin(suffix string) (*SimpleAllocationPlugin, error) { if len(suffix) == 0 { suffix = defaultDNSSuffix @@ -46,7 +46,7 @@ func (p *SimpleAllocationPlugin) Allocate(route *routeapi.Route) (*routeapi.Rout return &routeapi.RouterShard{ShardName: "global", DNSSuffix: p.DNSSuffix}, nil } -// Generate a host name for a route - using the service name, +// GenerateHostname generates a host name for a route - using the service name, // namespace (if provided) and the router shard dns suffix. func (p *SimpleAllocationPlugin) GenerateHostname(route *routeapi.Route, shard *routeapi.RouterShard) string { diff --git a/plugins/router/template/router.go b/plugins/router/template/router.go index d7ec30f00ad3..58b693d8021f 100644 --- a/plugins/router/template/router.go +++ b/plugins/router/template/router.go @@ -151,7 +151,7 @@ func (r *templateRouter) FindServiceUnit(id string) (v ServiceUnit, ok bool) { return } -// DeleteFrontend deletes the service with the given id. +// DeleteServiceUnit deletes the service with the given id. func (r *templateRouter) DeleteServiceUnit(id string) { delete(r.state, id) }