| ... | ... |
@@ -5,8 +5,8 @@ import ( |
| 5 | 5 |
"fmt" |
| 6 | 6 |
) |
| 7 | 7 |
|
| 8 |
-// ErrNoMatch is an error returned to new-app users when no match |
|
| 9 |
-// is found for a given component |
|
| 8 |
+// ErrNoMatch is the error returned by new-app when no match is found for a |
|
| 9 |
+// given component. |
|
| 10 | 10 |
type ErrNoMatch struct {
|
| 11 | 11 |
value string |
| 12 | 12 |
qualifier string |
| ... | ... |
@@ -19,20 +19,13 @@ func (e ErrNoMatch) Error() string {
|
| 19 | 19 |
return fmt.Sprintf("no image or template matched %q, specify --allow-missing-images to use this image name.", e.value)
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 |
-// UsageError is the usage error message returned when no match is found |
|
| 22 |
+// UsageError is the usage error message returned when no match is found. |
|
| 23 | 23 |
func (e ErrNoMatch) UsageError(commandName string) string {
|
| 24 | 24 |
return fmt.Sprintf("%[3]s - does a Docker image with that name exist?", e.value, commandName, e.Error())
|
| 25 |
- |
|
| 26 |
- /*` |
|
| 27 |
- %[3]s - you can try to search for images or templates that may match this name with: |
|
| 28 |
- |
|
| 29 |
- $ %[2]s -S %[1]q |
|
| 30 |
- |
|
| 31 |
- `*/ |
|
| 32 | 25 |
} |
| 33 | 26 |
|
| 34 |
-// ErrMultipleMatches is an error returned to new-app users when multiple |
|
| 35 |
-// matches are found for a given component |
|
| 27 |
+// ErrMultipleMatches is the error returned to new-app users when multiple |
|
| 28 |
+// matches are found for a given component. |
|
| 36 | 29 |
type ErrMultipleMatches struct {
|
| 37 | 30 |
Image string |
| 38 | 31 |
Matches []*ComponentMatch |
| ... | ... |
@@ -42,7 +35,8 @@ func (e ErrMultipleMatches) Error() string {
|
| 42 | 42 |
return fmt.Sprintf("multiple images or templates matched %q: %d", e.Image, len(e.Matches))
|
| 43 | 43 |
} |
| 44 | 44 |
|
| 45 |
-// UsageError is the usage error message returned when multiple matches are found |
|
| 45 |
+// UsageError is the usage error message returned when multiple matches are |
|
| 46 |
+// found. |
|
| 46 | 47 |
func (e ErrMultipleMatches) UsageError(commandName string) string {
|
| 47 | 48 |
buf := &bytes.Buffer{}
|
| 48 | 49 |
for _, match := range e.Matches {
|
| ... | ... |
@@ -18,7 +18,7 @@ import ( |
| 18 | 18 |
route "github.com/openshift/origin/pkg/route/api" |
| 19 | 19 |
) |
| 20 | 20 |
|
| 21 |
-// Pipeline holds components |
|
| 21 |
+// Pipeline holds components. |
|
| 22 | 22 |
type Pipeline struct {
|
| 23 | 23 |
From string |
| 24 | 24 |
|
| ... | ... |
@@ -29,8 +29,8 @@ type Pipeline struct {
|
| 29 | 29 |
Labels map[string]string |
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 |
-// NewImagePipeline creates a new pipeline with components that are not |
|
| 33 |
-// expected to be built |
|
| 32 |
+// NewImagePipeline creates a new pipeline with components that are not expected |
|
| 33 |
+// to be built. |
|
| 34 | 34 |
func NewImagePipeline(from string, image *ImageRef) (*Pipeline, error) {
|
| 35 | 35 |
return &Pipeline{
|
| 36 | 36 |
From: from, |
| ... | ... |
@@ -38,8 +38,8 @@ func NewImagePipeline(from string, image *ImageRef) (*Pipeline, error) {
|
| 38 | 38 |
}, nil |
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 |
-// NewBuildPipeline creates a new pipeline with components that are |
|
| 42 |
-// expected to be built |
|
| 41 |
+// NewBuildPipeline creates a new pipeline with components that are expected to |
|
| 42 |
+// be built. |
|
| 43 | 43 |
func NewBuildPipeline(from string, input *ImageRef, outputDocker bool, strategy *BuildStrategyRef, env Environment, source *SourceRef) (*Pipeline, error) {
|
| 44 | 44 |
name, ok := NameSuggestions{source, input}.SuggestName()
|
| 45 | 45 |
if !ok {
|
| ... | ... |
@@ -77,7 +77,7 @@ func NewBuildPipeline(from string, input *ImageRef, outputDocker bool, strategy |
| 77 | 77 |
}, nil |
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 |
-// NeedsDeployment sets the pipeline for deployment |
|
| 80 |
+// NeedsDeployment sets the pipeline for deployment. |
|
| 81 | 81 |
func (p *Pipeline) NeedsDeployment(env Environment, labels map[string]string, name string) error {
|
| 82 | 82 |
if p.Deployment != nil {
|
| 83 | 83 |
return nil |
| ... | ... |
@@ -93,7 +93,7 @@ func (p *Pipeline) NeedsDeployment(env Environment, labels map[string]string, na |
| 93 | 93 |
return nil |
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 |
-// Objects converts all the components in the pipeline into runtime objects |
|
| 96 |
+// Objects converts all the components in the pipeline into runtime objects. |
|
| 97 | 97 |
func (p *Pipeline) Objects(accept, objectAccept Acceptor) (Objects, error) {
|
| 98 | 98 |
objects := Objects{}
|
| 99 | 99 |
if p.InputImage != nil && p.InputImage.AsImageStream && accept.Accept(p.InputImage) {
|
| ... | ... |
@@ -135,10 +135,10 @@ func (p *Pipeline) Objects(accept, objectAccept Acceptor) (Objects, error) {
|
| 135 | 135 |
return objects, nil |
| 136 | 136 |
} |
| 137 | 137 |
|
| 138 |
-// PipelineGroup is a group of Pipelines |
|
| 138 |
+// PipelineGroup is a group of Pipelines. |
|
| 139 | 139 |
type PipelineGroup []*Pipeline |
| 140 | 140 |
|
| 141 |
-// Reduce squashes all common components from the pipelines |
|
| 141 |
+// Reduce squashes all common components from the pipelines. |
|
| 142 | 142 |
func (g PipelineGroup) Reduce() error {
|
| 143 | 143 |
var deployment *DeploymentConfigRef |
| 144 | 144 |
for _, p := range g {
|
| ... | ... |
@@ -194,7 +194,8 @@ func (s sortablePorts) Swap(i, j int) {
|
| 194 | 194 |
s[j] = p |
| 195 | 195 |
} |
| 196 | 196 |
|
| 197 |
-// portName returns a unique key for the given port and protocol which can be used as a service port name |
|
| 197 |
+// portName returns a unique key for the given port and protocol which can be |
|
| 198 |
+// used as a service port name. |
|
| 198 | 199 |
func portName(port int, protocol kapi.Protocol) string {
|
| 199 | 200 |
if protocol == "" {
|
| 200 | 201 |
protocol = kapi.ProtocolTCP |
| ... | ... |
@@ -202,7 +203,7 @@ func portName(port int, protocol kapi.Protocol) string {
|
| 202 | 202 |
return strings.ToLower(fmt.Sprintf("%d-%s", port, protocol))
|
| 203 | 203 |
} |
| 204 | 204 |
|
| 205 |
-// AddServices sets up services for the provided objects |
|
| 205 |
+// AddServices sets up services for the provided objects. |
|
| 206 | 206 |
func AddServices(objects Objects, firstPortOnly bool) Objects {
|
| 207 | 207 |
svcs := []runtime.Object{}
|
| 208 | 208 |
for _, o := range objects {
|
| ... | ... |
@@ -252,7 +253,7 @@ func AddServices(objects Objects, firstPortOnly bool) Objects {
|
| 252 | 252 |
return append(objects, svcs...) |
| 253 | 253 |
} |
| 254 | 254 |
|
| 255 |
-// AddRoutes sets up routes for the provided objects |
|
| 255 |
+// AddRoutes sets up routes for the provided objects. |
|
| 256 | 256 |
func AddRoutes(objects Objects) Objects {
|
| 257 | 257 |
routes := []runtime.Object{}
|
| 258 | 258 |
for _, o := range objects {
|
| ... | ... |
@@ -279,7 +280,7 @@ type acceptNew struct{}
|
| 279 | 279 |
// AcceptNew only accepts runtime.Objects with an empty resource version. |
| 280 | 280 |
var AcceptNew Acceptor = acceptNew{}
|
| 281 | 281 |
|
| 282 |
-// Accept accepts any kind of object |
|
| 282 |
+// Accept accepts any kind of object. |
|
| 283 | 283 |
func (acceptNew) Accept(from interface{}) bool {
|
| 284 | 284 |
_, meta, err := objectMetaData(from) |
| 285 | 285 |
if err != nil {
|
| ... | ... |
@@ -296,7 +297,7 @@ type acceptUnique struct {
|
| 296 | 296 |
objects map[string]struct{}
|
| 297 | 297 |
} |
| 298 | 298 |
|
| 299 |
-// Accept accepts any kind of object it hasn't accepted before |
|
| 299 |
+// Accept accepts any kind of object it hasn't accepted before. |
|
| 300 | 300 |
func (a *acceptUnique) Accept(from interface{}) bool {
|
| 301 | 301 |
obj, meta, err := objectMetaData(from) |
| 302 | 302 |
if err != nil {
|
| ... | ... |
@@ -315,8 +316,8 @@ func (a *acceptUnique) Accept(from interface{}) bool {
|
| 315 | 315 |
return true |
| 316 | 316 |
} |
| 317 | 317 |
|
| 318 |
-// NewAcceptUnique creates an acceptor that only accepts unique objects |
|
| 319 |
-// by kind and name |
|
| 318 |
+// NewAcceptUnique creates an acceptor that only accepts unique objects by kind |
|
| 319 |
+// and name. |
|
| 320 | 320 |
func NewAcceptUnique(typer runtime.ObjectTyper) Acceptor {
|
| 321 | 321 |
return &acceptUnique{
|
| 322 | 322 |
typer: typer, |
| ... | ... |
@@ -340,7 +341,7 @@ type acceptBuildConfigs struct {
|
| 340 | 340 |
typer runtime.ObjectTyper |
| 341 | 341 |
} |
| 342 | 342 |
|
| 343 |
-// Accept accepts BuildConfigs and ImageStreams |
|
| 343 |
+// Accept accepts BuildConfigs and ImageStreams. |
|
| 344 | 344 |
func (a *acceptBuildConfigs) Accept(from interface{}) bool {
|
| 345 | 345 |
obj, _, err := objectMetaData(from) |
| 346 | 346 |
if err != nil {
|
| ... | ... |
@@ -366,7 +367,7 @@ func NewAcceptBuildConfigs(typer runtime.ObjectTyper) Acceptor {
|
| 366 | 366 |
type Acceptors []Acceptor |
| 367 | 367 |
|
| 368 | 368 |
// Accept iterates through all acceptors and determines whether the object |
| 369 |
-// should be accepted |
|
| 369 |
+// should be accepted. |
|
| 370 | 370 |
func (aa Acceptors) Accept(from interface{}) bool {
|
| 371 | 371 |
for _, a := range aa {
|
| 372 | 372 |
if !a.Accept(from) {
|
| ... | ... |
@@ -378,18 +379,18 @@ func (aa Acceptors) Accept(from interface{}) bool {
|
| 378 | 378 |
|
| 379 | 379 |
type acceptAll struct{}
|
| 380 | 380 |
|
| 381 |
-// AcceptAll accepts all objects |
|
| 381 |
+// AcceptAll accepts all objects. |
|
| 382 | 382 |
var AcceptAll Acceptor = acceptAll{}
|
| 383 | 383 |
|
| 384 |
-// Accept accepts everything |
|
| 384 |
+// Accept accepts everything. |
|
| 385 | 385 |
func (acceptAll) Accept(_ interface{}) bool {
|
| 386 | 386 |
return true |
| 387 | 387 |
} |
| 388 | 388 |
|
| 389 |
-// Objects is a set of runtime objects |
|
| 389 |
+// Objects is a set of runtime objects. |
|
| 390 | 390 |
type Objects []runtime.Object |
| 391 | 391 |
|
| 392 |
-// Acceptor is an interface for accepting objects |
|
| 392 |
+// Acceptor is an interface for accepting objects. |
|
| 393 | 393 |
type Acceptor interface {
|
| 394 | 394 |
Accept(from interface{}) bool
|
| 395 | 395 |
} |
| ... | ... |
@@ -398,12 +399,12 @@ type acceptFirst struct {
|
| 398 | 398 |
handled map[interface{}]struct{}
|
| 399 | 399 |
} |
| 400 | 400 |
|
| 401 |
-// NewAcceptFirst returns a new Acceptor |
|
| 401 |
+// NewAcceptFirst returns a new Acceptor. |
|
| 402 | 402 |
func NewAcceptFirst() Acceptor {
|
| 403 | 403 |
return &acceptFirst{make(map[interface{}]struct{})}
|
| 404 | 404 |
} |
| 405 | 405 |
|
| 406 |
-// Accept accepts any object it hasn't accepted before |
|
| 406 |
+// Accept accepts any object it hasn't accepted before. |
|
| 407 | 407 |
func (s *acceptFirst) Accept(from interface{}) bool {
|
| 408 | 408 |
if _, ok := s.handled[from]; ok {
|
| 409 | 409 |
return false |