Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
f47f1da3
Commit
f47f1da3
authored
Nov 13, 2014
by
Dawn Chen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2345 from yugui/lint/api
Fixes golint errors in pkg/api.
parents
f9979596
864bfb65
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
71 additions
and
55 deletions
+71
-55
validation.go
pkg/api/errors/validation.go
+1
-0
latest.go
pkg/api/latest/latest.go
+2
-2
meta_test.go
pkg/api/meta/meta_test.go
+1
-1
restmapper.go
pkg/api/meta/restmapper.go
+2
-2
ref.go
pkg/api/ref.go
+2
-1
register.go
pkg/api/register.go
+1
-0
serialization_test.go
pkg/api/serialization_test.go
+9
-10
types.go
pkg/api/types.go
+15
-11
types.go
pkg/api/v1beta1/types.go
+13
-10
types.go
pkg/api/v1beta2/types.go
+13
-10
types.go
pkg/api/v1beta3/types.go
+11
-8
validation.go
pkg/api/validation/validation.go
+1
-0
No files found.
pkg/api/errors/validation.go
View file @
f47f1da3
...
@@ -52,6 +52,7 @@ const (
...
@@ -52,6 +52,7 @@ const (
ValidationErrorTypeForbidden
ValidationErrorType
=
"FieldValueForbidden"
ValidationErrorTypeForbidden
ValidationErrorType
=
"FieldValueForbidden"
)
)
// ValueOf converts a ValidationErrorType into its corresponding error message.
func
ValueOf
(
t
ValidationErrorType
)
string
{
func
ValueOf
(
t
ValidationErrorType
)
string
{
switch
t
{
switch
t
{
case
ValidationErrorTypeNotFound
:
case
ValidationErrorTypeNotFound
:
...
...
pkg/api/latest/latest.go
View file @
f47f1da3
...
@@ -52,13 +52,13 @@ var accessor = meta.NewAccessor()
...
@@ -52,13 +52,13 @@ var accessor = meta.NewAccessor()
// ResourceVersioner describes a default versioner that can handle all types
// ResourceVersioner describes a default versioner that can handle all types
// of versioning.
// of versioning.
// TODO: when versioning changes, make this part of each API definition.
// TODO: when versioning changes, make this part of each API definition.
var
ResourceVersioner
runtime
.
ResourceVersioner
=
accessor
var
ResourceVersioner
=
runtime
.
ResourceVersioner
(
accessor
)
// SelfLinker can set or get the SelfLink field of all API types.
// SelfLinker can set or get the SelfLink field of all API types.
// TODO: when versioning changes, make this part of each API definition.
// TODO: when versioning changes, make this part of each API definition.
// TODO(lavalamp): Combine SelfLinker & ResourceVersioner interfaces, force all uses
// TODO(lavalamp): Combine SelfLinker & ResourceVersioner interfaces, force all uses
// to go through the InterfacesFor method below.
// to go through the InterfacesFor method below.
var
SelfLinker
runtime
.
SelfLinker
=
accessor
var
SelfLinker
=
runtime
.
SelfLinker
(
accessor
)
// RESTMapper provides the default mapping between REST paths and the objects declared in api.Scheme and all known
// RESTMapper provides the default mapping between REST paths and the objects declared in api.Scheme and all known
// Kubernetes versions.
// Kubernetes versions.
...
...
pkg/api/meta/meta_test.go
View file @
f47f1da3
...
@@ -471,7 +471,7 @@ func TestTypeMetaSelfLinker(t *testing.T) {
...
@@ -471,7 +471,7 @@ func TestTypeMetaSelfLinker(t *testing.T) {
},
},
}
}
var
linker
runtime
.
SelfLinker
=
NewAccessor
(
)
linker
:=
runtime
.
SelfLinker
(
NewAccessor
()
)
for
name
,
item
:=
range
table
{
for
name
,
item
:=
range
table
{
got
,
err
:=
linker
.
SelfLink
(
item
.
obj
)
got
,
err
:=
linker
.
SelfLink
(
item
.
obj
)
if
e
,
a
:=
item
.
succeed
,
err
==
nil
;
e
!=
a
{
if
e
,
a
:=
item
.
succeed
,
err
==
nil
;
e
!=
a
{
...
...
pkg/api/meta/restmapper.go
View file @
f47f1da3
...
@@ -30,7 +30,7 @@ type typeMeta struct {
...
@@ -30,7 +30,7 @@ type typeMeta struct {
Kind
string
Kind
string
}
}
// RESTMapper exposes mappings between the types defined in a
//
Default
RESTMapper exposes mappings between the types defined in a
// runtime.Scheme. It assumes that all types defined the provided scheme
// runtime.Scheme. It assumes that all types defined the provided scheme
// can be mapped with the provided MetadataAccessor and Codec interfaces.
// can be mapped with the provided MetadataAccessor and Codec interfaces.
//
//
...
@@ -132,7 +132,7 @@ func (m *DefaultRESTMapper) RESTMapping(version, kind string) (*RESTMapping, err
...
@@ -132,7 +132,7 @@ func (m *DefaultRESTMapper) RESTMapping(version, kind string) (*RESTMapping, err
}
}
}
}
if
len
(
version
)
==
0
{
if
len
(
version
)
==
0
{
return
nil
,
fmt
.
Errorf
(
"no object named %q is registered
.
"
,
kind
)
return
nil
,
fmt
.
Errorf
(
"no object named %q is registered"
,
kind
)
}
}
}
}
...
...
pkg/api/ref.go
View file @
f47f1da3
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
)
// ErrNilObject indicates an error that the obj passed to GetReference is nil.
var
ErrNilObject
=
errors
.
New
(
"Can't reference a nil object"
)
var
ErrNilObject
=
errors
.
New
(
"Can't reference a nil object"
)
var
versionFromSelfLink
=
regexp
.
MustCompile
(
"/api/([^/]*)/"
)
var
versionFromSelfLink
=
regexp
.
MustCompile
(
"/api/([^/]*)/"
)
...
@@ -72,6 +73,6 @@ func GetPartialReference(obj runtime.Object, fieldPath string) (*ObjectReference
...
@@ -72,6 +73,6 @@ func GetPartialReference(obj runtime.Object, fieldPath string) (*ObjectReference
return
ref
,
nil
return
ref
,
nil
}
}
//
Allow
clients to preemptively get a reference to an API object and pass it to places that
//
IsAnAPIObject allows
clients to preemptively get a reference to an API object and pass it to places that
// intend only to get a reference to that object. This simplifies the event recording interface.
// intend only to get a reference to that object. This simplifies the event recording interface.
func
(
*
ObjectReference
)
IsAnAPIObject
()
{}
func
(
*
ObjectReference
)
IsAnAPIObject
()
{}
pkg/api/register.go
View file @
f47f1da3
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
)
// Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered.
var
Scheme
=
runtime
.
NewScheme
()
var
Scheme
=
runtime
.
NewScheme
()
func
init
()
{
func
init
()
{
...
...
pkg/api/serialization_test.go
View file @
f47f1da3
...
@@ -160,22 +160,21 @@ func runTest(t *testing.T, codec runtime.Codec, source runtime.Object) {
...
@@ -160,22 +160,21 @@ func runTest(t *testing.T, codec runtime.Codec, source runtime.Object) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"%v: %v"
,
name
,
err
)
t
.
Errorf
(
"%v: %v"
,
name
,
err
)
return
return
}
else
{
if
!
reflect
.
DeepEqual
(
source
,
obj2
)
{
t
.
Errorf
(
"1: %v: diff: %v
\n
Codec: %v
\n
Data: %s
\n
Source: %#v"
,
name
,
util
.
ObjectDiff
(
source
,
obj2
),
codec
,
string
(
data
),
source
)
return
}
}
}
if
!
reflect
.
DeepEqual
(
source
,
obj2
)
{
t
.
Errorf
(
"1: %v: diff: %v
\n
Codec: %v
\n
Data: %s
\n
Source: %#v"
,
name
,
util
.
ObjectDiff
(
source
,
obj2
),
codec
,
string
(
data
),
source
)
return
}
obj3
:=
reflect
.
New
(
reflect
.
TypeOf
(
source
)
.
Elem
())
.
Interface
()
.
(
runtime
.
Object
)
obj3
:=
reflect
.
New
(
reflect
.
TypeOf
(
source
)
.
Elem
())
.
Interface
()
.
(
runtime
.
Object
)
err
=
codec
.
DecodeInto
(
data
,
obj3
)
err
=
codec
.
DecodeInto
(
data
,
obj3
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"2: %v: %v"
,
name
,
err
)
t
.
Errorf
(
"2: %v: %v"
,
name
,
err
)
return
return
}
else
{
}
if
!
reflect
.
DeepEqual
(
source
,
obj3
)
{
if
!
reflect
.
DeepEqual
(
source
,
obj3
)
{
t
.
Errorf
(
"3: %v: diff: %v
\n
Codec: %v"
,
name
,
util
.
ObjectDiff
(
source
,
obj3
),
codec
)
t
.
Errorf
(
"3: %v: diff: %v
\n
Codec: %v"
,
name
,
util
.
ObjectDiff
(
source
,
obj3
),
codec
)
return
return
}
}
}
}
}
...
...
pkg/api/types.go
View file @
f47f1da3
...
@@ -136,8 +136,9 @@ type Volume struct {
...
@@ -136,8 +136,9 @@ type Volume struct {
Source
*
VolumeSource
`json:"source" yaml:"source"`
Source
*
VolumeSource
`json:"source" yaml:"source"`
}
}
// VolumeSource represents the source location of a valume to mount.
// Only one of its members may be specified.
type
VolumeSource
struct
{
type
VolumeSource
struct
{
// Only one of the following sources may be specified
// HostDir represents a pre-existing directory on the host machine that is directly
// HostDir represents a pre-existing directory on the host machine that is directly
// exposed to the container. This is generally used for system agents or other privileged
// exposed to the container. This is generally used for system agents or other privileged
// things that are allowed to see the host machine. Most containers will NOT need this.
// things that are allowed to see the host machine. Most containers will NOT need this.
...
@@ -170,7 +171,8 @@ const (
...
@@ -170,7 +171,8 @@ const (
ProtocolUDP
Protocol
=
"UDP"
ProtocolUDP
Protocol
=
"UDP"
)
)
// GCEPersistent Disk resource.
// GCEPersistentDisk represents a Persistent Disk resource in Google Compute Engine.
//
// A GCE PD must exist and be formatted before mounting to a container.
// A GCE PD must exist and be formatted before mounting to a container.
// The disk must also be in the same GCE project and zone as the kubelet.
// The disk must also be in the same GCE project and zone as the kubelet.
// A GCE PD can only be mounted as read/write once.
// A GCE PD can only be mounted as read/write once.
...
@@ -275,11 +277,11 @@ type LivenessProbe struct {
...
@@ -275,11 +277,11 @@ type LivenessProbe struct {
type
PullPolicy
string
type
PullPolicy
string
const
(
const
(
//
Always attempt
to pull the latest image. Container will fail If the pull fails.
//
PullAlways means that kubelet always attempts
to pull the latest image. Container will fail If the pull fails.
PullAlways
PullPolicy
=
"PullAlways"
PullAlways
PullPolicy
=
"PullAlways"
//
Never pull an image, only use
a local image. Container will fail if the image isn't present
//
PullNever means that kubelet never pulls an image, but only uses
a local image. Container will fail if the image isn't present
PullNever
PullPolicy
=
"PullNever"
PullNever
PullPolicy
=
"PullNever"
// Pull if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.
// Pull
IfNotPresent means that kubelet pulls
if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
)
)
...
@@ -373,9 +375,10 @@ type ContainerStateTerminated struct {
...
@@ -373,9 +375,10 @@ type ContainerStateTerminated struct {
FinishedAt
time
.
Time
`json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
FinishedAt
time
.
Time
`json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
}
}
// ContainerState holds a possible state of container.
// Only one of its members may be specified.
// If none of them is specified, the default one is ContainerStateWaiting.
type
ContainerState
struct
{
type
ContainerState
struct
{
// Only one of the following ContainerState may be specified.
// If none of them is specified, the default one is ContainerStateWaiting.
Waiting
*
ContainerStateWaiting
`json:"waiting,omitempty" yaml:"waiting,omitempty"`
Waiting
*
ContainerStateWaiting
`json:"waiting,omitempty" yaml:"waiting,omitempty"`
Running
*
ContainerStateRunning
`json:"running,omitempty" yaml:"running,omitempty"`
Running
*
ContainerStateRunning
`json:"running,omitempty" yaml:"running,omitempty"`
Termination
*
ContainerStateTerminated
`json:"termination,omitempty" yaml:"termination,omitempty"`
Termination
*
ContainerStateTerminated
`json:"termination,omitempty" yaml:"termination,omitempty"`
...
@@ -406,10 +409,11 @@ type RestartPolicyOnFailure struct{}
...
@@ -406,10 +409,11 @@ type RestartPolicyOnFailure struct{}
type
RestartPolicyNever
struct
{}
type
RestartPolicyNever
struct
{}
// RestartPolicy describes how the container should be restarted.
// Only one of the following restart policies may be specified.
// If none of the following policies is specified, the default one
// is RestartPolicyAlways.
type
RestartPolicy
struct
{
type
RestartPolicy
struct
{
// Only one of the following restart policies may be specified.
// If none of the following policies is specified, the default one
// is RestartPolicyAlways.
Always
*
RestartPolicyAlways
`json:"always,omitempty" yaml:"always,omitempty"`
Always
*
RestartPolicyAlways
`json:"always,omitempty" yaml:"always,omitempty"`
OnFailure
*
RestartPolicyOnFailure
`json:"onFailure,omitempty" yaml:"onFailure,omitempty"`
OnFailure
*
RestartPolicyOnFailure
`json:"onFailure,omitempty" yaml:"onFailure,omitempty"`
Never
*
RestartPolicyNever
`json:"never,omitempty" yaml:"never,omitempty"`
Never
*
RestartPolicyNever
`json:"never,omitempty" yaml:"never,omitempty"`
...
@@ -808,7 +812,7 @@ const (
...
@@ -808,7 +812,7 @@ const (
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// (e.g. looking up an ID).
// (e.g. looking up an ID).
CauseTypeFieldValueNotFound
CauseType
=
"FieldValueNotFound"
CauseTypeFieldValueNotFound
CauseType
=
"FieldValueNotFound"
// CauseTypeFieldValue
Invali
d is used to report required values that are not
// CauseTypeFieldValue
Require
d is used to report required values that are not
// provided (e.g. empty strings, null values, or empty arrays).
// provided (e.g. empty strings, null values, or empty arrays).
CauseTypeFieldValueRequired
CauseType
=
"FieldValueRequired"
CauseTypeFieldValueRequired
CauseType
=
"FieldValueRequired"
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
...
...
pkg/api/v1beta1/types.go
View file @
f47f1da3
...
@@ -80,8 +80,9 @@ type Volume struct {
...
@@ -80,8 +80,9 @@ type Volume struct {
Source
*
VolumeSource
`yaml:"source" json:"source"`
Source
*
VolumeSource
`yaml:"source" json:"source"`
}
}
// VolumeSource represents the source location of a valume to mount.
// Only one of its members may be specified.
type
VolumeSource
struct
{
type
VolumeSource
struct
{
// Only one of the following sources may be specified
// HostDir represents a pre-existing directory on the host machine that is directly
// HostDir represents a pre-existing directory on the host machine that is directly
// exposed to the container. This is generally used for system agents or other privileged
// exposed to the container. This is generally used for system agents or other privileged
// things that are allowed to see the host machine. Most containers will NOT need this.
// things that are allowed to see the host machine. Most containers will NOT need this.
...
@@ -114,9 +115,10 @@ const (
...
@@ -114,9 +115,10 @@ const (
ProtocolUDP
Protocol
=
"UDP"
ProtocolUDP
Protocol
=
"UDP"
)
)
// GCEPersistent Disk resource.
// GCEPersistentDisk represents a Persistent Disk resource in Google Compute Engine.
// A GCE PD must exist before mounting to a container. The disk must
//
// also be in the same GCE project and zone as the kubelet.
// A GCE PD must exist and be formatted before mounting to a container.
// The disk must also be in the same GCE project and zone as the kubelet.
// A GCE PD can only be mounted as read/write once.
// A GCE PD can only be mounted as read/write once.
type
GCEPersistentDisk
struct
{
type
GCEPersistentDisk
struct
{
// Unique name of the PD resource. Used to identify the disk in GCE
// Unique name of the PD resource. Used to identify the disk in GCE
...
@@ -228,11 +230,11 @@ type LivenessProbe struct {
...
@@ -228,11 +230,11 @@ type LivenessProbe struct {
type
PullPolicy
string
type
PullPolicy
string
const
(
const
(
//
Always attempt
to pull the latest image. Container will fail If the pull fails.
//
PullAlways means that kubelet always attempts
to pull the latest image. Container will fail If the pull fails.
PullAlways
PullPolicy
=
"PullAlways"
PullAlways
PullPolicy
=
"PullAlways"
//
Never pull an image, only use
a local image. Container will fail if the image isn't present
//
PullNever means that kubelet never pulls an image, but only uses
a local image. Container will fail if the image isn't present
PullNever
PullPolicy
=
"PullNever"
PullNever
PullPolicy
=
"PullNever"
// Pull if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.
// Pull
IfNotPresent means that kubelet pulls
if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
)
)
...
@@ -337,9 +339,10 @@ type ContainerStateTerminated struct {
...
@@ -337,9 +339,10 @@ type ContainerStateTerminated struct {
FinishedAt
time
.
Time
`json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
FinishedAt
time
.
Time
`json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
}
}
// ContainerState holds a possible state of container.
// Only one of its members may be specified.
// If none of them is specified, the default one is ContainerStateWaiting.
type
ContainerState
struct
{
type
ContainerState
struct
{
// Only one of the following ContainerState may be specified.
// If none of them is specified, the default one is ContainerStateWaiting.
Waiting
*
ContainerStateWaiting
`json:"waiting,omitempty" yaml:"waiting,omitempty"`
Waiting
*
ContainerStateWaiting
`json:"waiting,omitempty" yaml:"waiting,omitempty"`
Running
*
ContainerStateRunning
`json:"running,omitempty" yaml:"running,omitempty"`
Running
*
ContainerStateRunning
`json:"running,omitempty" yaml:"running,omitempty"`
Termination
*
ContainerStateTerminated
`json:"termination,omitempty" yaml:"termination,omitempty"`
Termination
*
ContainerStateTerminated
`json:"termination,omitempty" yaml:"termination,omitempty"`
...
@@ -657,7 +660,7 @@ const (
...
@@ -657,7 +660,7 @@ const (
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// (e.g. looking up an ID).
// (e.g. looking up an ID).
CauseTypeFieldValueNotFound
CauseType
=
"FieldValueNotFound"
CauseTypeFieldValueNotFound
CauseType
=
"FieldValueNotFound"
// CauseTypeFieldValue
Invali
d is used to report required values that are not
// CauseTypeFieldValue
Require
d is used to report required values that are not
// provided (e.g. empty strings, null values, or empty arrays).
// provided (e.g. empty strings, null values, or empty arrays).
CauseTypeFieldValueRequired
CauseType
=
"FieldValueRequired"
CauseTypeFieldValueRequired
CauseType
=
"FieldValueRequired"
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
...
...
pkg/api/v1beta2/types.go
View file @
f47f1da3
...
@@ -56,8 +56,9 @@ type Volume struct {
...
@@ -56,8 +56,9 @@ type Volume struct {
Source
*
VolumeSource
`yaml:"source" json:"source"`
Source
*
VolumeSource
`yaml:"source" json:"source"`
}
}
// VolumeSource represents the source location of a valume to mount.
// Only one of its members may be specified.
type
VolumeSource
struct
{
type
VolumeSource
struct
{
// Only one of the following sources may be specified
// HostDir represents a pre-existing directory on the host machine that is directly
// HostDir represents a pre-existing directory on the host machine that is directly
// exposed to the container. This is generally used for system agents or other privileged
// exposed to the container. This is generally used for system agents or other privileged
// things that are allowed to see the host machine. Most containers will NOT need this.
// things that are allowed to see the host machine. Most containers will NOT need this.
...
@@ -105,9 +106,10 @@ type Port struct {
...
@@ -105,9 +106,10 @@ type Port struct {
HostIP
string
`yaml:"hostIP,omitempty" json:"hostIP,omitempty"`
HostIP
string
`yaml:"hostIP,omitempty" json:"hostIP,omitempty"`
}
}
// GCEPersistent Disk resource.
// GCEPersistentDisk represents a Persistent Disk resource in Google Compute Engine.
// A GCE PD must exist before mounting to a container. The disk must
//
// also be in the same GCE project and zone as the kubelet.
// A GCE PD must exist and be formatted before mounting to a container.
// The disk must also be in the same GCE project and zone as the kubelet.
// A GCE PD can only be mounted as read/write once.
// A GCE PD can only be mounted as read/write once.
type
GCEPersistentDisk
struct
{
type
GCEPersistentDisk
struct
{
// Unique name of the PD resource. Used to identify the disk in GCE
// Unique name of the PD resource. Used to identify the disk in GCE
...
@@ -194,11 +196,11 @@ type LivenessProbe struct {
...
@@ -194,11 +196,11 @@ type LivenessProbe struct {
type
PullPolicy
string
type
PullPolicy
string
const
(
const
(
//
Always attempt
to pull the latest image. Container will fail If the pull fails.
//
PullAlways means that kubelet always attempts
to pull the latest image. Container will fail If the pull fails.
PullAlways
PullPolicy
=
"PullAlways"
PullAlways
PullPolicy
=
"PullAlways"
//
Never pull an image, only use
a local image. Container will fail if the image isn't present
//
PullNever means that kubelet never pulls an image, but only uses
a local image. Container will fail if the image isn't present
PullNever
PullPolicy
=
"PullNever"
PullNever
PullPolicy
=
"PullNever"
// Pull if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.
// Pull
IfNotPresent means that kubelet pulls
if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
)
)
...
@@ -302,9 +304,10 @@ type ContainerStateTerminated struct {
...
@@ -302,9 +304,10 @@ type ContainerStateTerminated struct {
FinishedAt
time
.
Time
`json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
FinishedAt
time
.
Time
`json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
}
}
// ContainerState holds a possible state of container.
// Only one of its members may be specified.
// If none of them is specified, the default one is ContainerStateWaiting.
type
ContainerState
struct
{
type
ContainerState
struct
{
// Only one of the following ContainerState may be specified.
// If none of them is specified, the default one is ContainerStateWaiting.
Waiting
*
ContainerStateWaiting
`json:"waiting,omitempty" yaml:"waiting,omitempty"`
Waiting
*
ContainerStateWaiting
`json:"waiting,omitempty" yaml:"waiting,omitempty"`
Running
*
ContainerStateRunning
`json:"running,omitempty" yaml:"running,omitempty"`
Running
*
ContainerStateRunning
`json:"running,omitempty" yaml:"running,omitempty"`
Termination
*
ContainerStateTerminated
`json:"termination,omitempty" yaml:"termination,omitempty"`
Termination
*
ContainerStateTerminated
`json:"termination,omitempty" yaml:"termination,omitempty"`
...
@@ -632,7 +635,7 @@ const (
...
@@ -632,7 +635,7 @@ const (
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// (e.g. looking up an ID).
// (e.g. looking up an ID).
CauseTypeFieldValueNotFound
CauseType
=
"FieldValueNotFound"
CauseTypeFieldValueNotFound
CauseType
=
"FieldValueNotFound"
// CauseTypeFieldValue
Invali
d is used to report required values that are not
// CauseTypeFieldValue
Require
d is used to report required values that are not
// provided (e.g. empty strings, null values, or empty arrays).
// provided (e.g. empty strings, null values, or empty arrays).
CauseTypeFieldValueRequired
CauseType
=
"FieldValueRequired"
CauseTypeFieldValueRequired
CauseType
=
"FieldValueRequired"
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
...
...
pkg/api/v1beta3/types.go
View file @
f47f1da3
...
@@ -166,8 +166,9 @@ type Volume struct {
...
@@ -166,8 +166,9 @@ type Volume struct {
Source
*
VolumeSource
`json:"source" yaml:"source"`
Source
*
VolumeSource
`json:"source" yaml:"source"`
}
}
// VolumeSource represents the source location of a valume to mount.
// Only one of its members may be specified.
type
VolumeSource
struct
{
type
VolumeSource
struct
{
// Only one of the following sources may be specified
// HostDir represents a pre-existing directory on the host machine that is directly
// HostDir represents a pre-existing directory on the host machine that is directly
// exposed to the container. This is generally used for system agents or other privileged
// exposed to the container. This is generally used for system agents or other privileged
// things that are allowed to see the host machine. Most containers will NOT need this.
// things that are allowed to see the host machine. Most containers will NOT need this.
...
@@ -200,7 +201,8 @@ const (
...
@@ -200,7 +201,8 @@ const (
ProtocolUDP
Protocol
=
"UDP"
ProtocolUDP
Protocol
=
"UDP"
)
)
// GCEPersistent Disk resource.
// GCEPersistentDisk represents a Persistent Disk resource in Google Compute Engine.
//
// A GCE PD must exist and be formatted before mounting to a container.
// A GCE PD must exist and be formatted before mounting to a container.
// The disk must also be in the same GCE project and zone as the kubelet.
// The disk must also be in the same GCE project and zone as the kubelet.
// A GCE PD can only be mounted as read/write once.
// A GCE PD can only be mounted as read/write once.
...
@@ -306,11 +308,11 @@ type LivenessProbe struct {
...
@@ -306,11 +308,11 @@ type LivenessProbe struct {
type
PullPolicy
string
type
PullPolicy
string
const
(
const
(
//
Always attempt
to pull the latest image. Container will fail If the pull fails.
//
PullAlways means that kubelet always attempts
to pull the latest image. Container will fail If the pull fails.
PullAlways
PullPolicy
=
"PullAlways"
PullAlways
PullPolicy
=
"PullAlways"
//
Never pull an image, only use
a local image. Container will fail if the image isn't present
//
PullNever means that kubelet never pulls an image, but only uses
a local image. Container will fail if the image isn't present
PullNever
PullPolicy
=
"PullNever"
PullNever
PullPolicy
=
"PullNever"
// Pull if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.
// Pull
IfNotPresent means that kubelet pulls
if the image isn't present on disk. Container will fail if the image isn't present and the pull fails.
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
PullIfNotPresent
PullPolicy
=
"PullIfNotPresent"
)
)
...
@@ -402,9 +404,10 @@ type ContainerStateTerminated struct {
...
@@ -402,9 +404,10 @@ type ContainerStateTerminated struct {
FinishedAt
time
.
Time
`json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
FinishedAt
time
.
Time
`json:"finishedAt,omitempty" yaml:"finishedAt,omitempty"`
}
}
// ContainerState holds a possible state of container.
// Only one of its members may be specified.
// If none of them is specified, the default one is ContainerStateWaiting.
type
ContainerState
struct
{
type
ContainerState
struct
{
// Only one of the following ContainerState may be specified.
// If none of them is specified, the default one is ContainerStateWaiting.
Waiting
*
ContainerStateWaiting
`json:"waiting,omitempty" yaml:"waiting,omitempty"`
Waiting
*
ContainerStateWaiting
`json:"waiting,omitempty" yaml:"waiting,omitempty"`
Running
*
ContainerStateRunning
`json:"running,omitempty" yaml:"running,omitempty"`
Running
*
ContainerStateRunning
`json:"running,omitempty" yaml:"running,omitempty"`
Termination
*
ContainerStateTerminated
`json:"termination,omitempty" yaml:"termination,omitempty"`
Termination
*
ContainerStateTerminated
`json:"termination,omitempty" yaml:"termination,omitempty"`
...
@@ -852,7 +855,7 @@ const (
...
@@ -852,7 +855,7 @@ const (
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// (e.g. looking up an ID).
// (e.g. looking up an ID).
CauseTypeFieldValueNotFound
CauseType
=
"FieldValueNotFound"
CauseTypeFieldValueNotFound
CauseType
=
"FieldValueNotFound"
// CauseTypeFieldValue
Invali
d is used to report required values that are not
// CauseTypeFieldValue
Require
d is used to report required values that are not
// provided (e.g. empty strings, null values, or empty arrays).
// provided (e.g. empty strings, null values, or empty arrays).
CauseTypeFieldValueRequired
CauseType
=
"FieldValueRequired"
CauseTypeFieldValueRequired
CauseType
=
"FieldValueRequired"
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
...
...
pkg/api/validation/validation.go
View file @
f47f1da3
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
)
)
// ServiceLister is an abstract interface for testing.
type
ServiceLister
interface
{
type
ServiceLister
interface
{
ListServices
(
api
.
Context
)
(
*
api
.
ServiceList
,
error
)
ListServices
(
api
.
Context
)
(
*
api
.
ServiceList
,
error
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment