Commit 03535478 authored by Brian Grant's avatar Brian Grant

Merge pull request #8440 from thockin/api-type-names

Rename a few API types (non-breaking change)
parents 0a6007b2 7c2817d2
...@@ -10160,11 +10160,11 @@ ...@@ -10160,11 +10160,11 @@
"v1beta1.PersistentVolumeSpec": { "v1beta1.PersistentVolumeSpec": {
"id": "v1beta1.PersistentVolumeSpec", "id": "v1beta1.PersistentVolumeSpec",
"required": [ "required": [
"glusterfs",
"nfs",
"persistentDisk", "persistentDisk",
"awsElasticBlockStore", "awsElasticBlockStore",
"hostPath" "hostPath",
"glusterfs",
"nfs"
], ],
"properties": { "properties": {
"accessModes": { "accessModes": {
......
...@@ -10149,11 +10149,11 @@ ...@@ -10149,11 +10149,11 @@
"v1beta2.PersistentVolumeSpec": { "v1beta2.PersistentVolumeSpec": {
"id": "v1beta2.PersistentVolumeSpec", "id": "v1beta2.PersistentVolumeSpec",
"required": [ "required": [
"glusterfs",
"nfs", "nfs",
"persistentDisk", "persistentDisk",
"awsElasticBlockStore", "awsElasticBlockStore",
"hostPath", "hostPath"
"glusterfs"
], ],
"properties": { "properties": {
"accessModes": { "accessModes": {
......
...@@ -182,8 +182,8 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { ...@@ -182,8 +182,8 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
protocols := []api.Protocol{api.ProtocolTCP, api.ProtocolUDP} protocols := []api.Protocol{api.ProtocolTCP, api.ProtocolUDP}
*p = protocols[c.Rand.Intn(len(protocols))] *p = protocols[c.Rand.Intn(len(protocols))]
}, },
func(p *api.AffinityType, c fuzz.Continue) { func(p *api.ServiceAffinity, c fuzz.Continue) {
types := []api.AffinityType{api.AffinityTypeClientIP, api.AffinityTypeNone} types := []api.ServiceAffinity{api.ServiceAffinityClientIP, api.ServiceAffinityNone}
*p = types[c.Rand.Intn(len(types))] *p = types[c.Rand.Intn(len(types))]
}, },
func(ct *api.Container, c fuzz.Continue) { func(ct *api.Container, c fuzz.Continue) {
...@@ -209,8 +209,8 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer { ...@@ -209,8 +209,8 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
priv := c.RandBool() priv := c.RandBool()
sc.Privileged = &priv sc.Privileged = &priv
sc.Capabilities = &api.Capabilities{ sc.Capabilities = &api.Capabilities{
Add: make([]api.CapabilityType, 0), Add: make([]api.Capability, 0),
Drop: make([]api.CapabilityType, 0), Drop: make([]api.Capability, 0),
} }
c.Fuzz(&sc.Capabilities.Add) c.Fuzz(&sc.Capabilities.Add)
c.Fuzz(&sc.Capabilities.Drop) c.Fuzz(&sc.Capabilities.Drop)
......
...@@ -251,7 +251,7 @@ type PersistentVolumeSpec struct { ...@@ -251,7 +251,7 @@ type PersistentVolumeSpec struct {
// Source represents the location and type of a volume to mount. // Source represents the location and type of a volume to mount.
PersistentVolumeSource `json:",inline"` PersistentVolumeSource `json:",inline"`
// AccessModes contains all ways the volume can be mounted // AccessModes contains all ways the volume can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty"`
// ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. // ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
// ClaimRef is expected to be non-nil when bound. // ClaimRef is expected to be non-nil when bound.
// claim.VolumeName is the authoritative bind between PV and PVC. // claim.VolumeName is the authoritative bind between PV and PVC.
...@@ -291,7 +291,7 @@ type PersistentVolumeClaimList struct { ...@@ -291,7 +291,7 @@ type PersistentVolumeClaimList struct {
// and allows a Source for provider-specific attributes // and allows a Source for provider-specific attributes
type PersistentVolumeClaimSpec struct { type PersistentVolumeClaimSpec struct {
// Contains the types of access modes required // Contains the types of access modes required
AccessModes []AccessModeType `json:"accessModes,omitempty"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty"`
// Resources represents the minimum resources required // Resources represents the minimum resources required
Resources ResourceRequirements `json:"resources,omitempty"` Resources ResourceRequirements `json:"resources,omitempty"`
// VolumeName is the binding reference to the PersistentVolume backing this claim // VolumeName is the binding reference to the PersistentVolume backing this claim
...@@ -302,20 +302,20 @@ type PersistentVolumeClaimStatus struct { ...@@ -302,20 +302,20 @@ type PersistentVolumeClaimStatus struct {
// Phase represents the current phase of PersistentVolumeClaim // Phase represents the current phase of PersistentVolumeClaim
Phase PersistentVolumeClaimPhase `json:"phase,omitempty"` Phase PersistentVolumeClaimPhase `json:"phase,omitempty"`
// AccessModes contains all ways the volume backing the PVC can be mounted // AccessModes contains all ways the volume backing the PVC can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty"`
// Represents the actual resources of the underlying volume // Represents the actual resources of the underlying volume
Capacity ResourceList `json:"capacity,omitempty"` Capacity ResourceList `json:"capacity,omitempty"`
} }
type AccessModeType string type PersistentVolumeAccessMode string
const ( const (
// can be mounted read/write mode to exactly 1 host // can be mounted read/write mode to exactly 1 host
ReadWriteOnce AccessModeType = "ReadWriteOnce" ReadWriteOnce PersistentVolumeAccessMode = "ReadWriteOnce"
// can be mounted in read-only mode to many hosts // can be mounted in read-only mode to many hosts
ReadOnlyMany AccessModeType = "ReadOnlyMany" ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany"
// can be mounted in read/write mode to many hosts // can be mounted in read/write mode to many hosts
ReadWriteMany AccessModeType = "ReadWriteMany" ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany"
) )
type PersistentVolumePhase string type PersistentVolumePhase string
...@@ -354,15 +354,15 @@ type EmptyDirVolumeSource struct { ...@@ -354,15 +354,15 @@ type EmptyDirVolumeSource struct {
// this will cover the most common needs. // this will cover the most common needs.
// Optional: what type of storage medium should back this directory. // Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium. // The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium"` Medium StorageMedium `json:"medium"`
} }
// StorageType defines ways that storage can be allocated to a volume. // StorageMedium defines ways that storage can be allocated to a volume.
type StorageType string type StorageMedium string
const ( const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
) )
// Protocol defines network protocols supported for things like conatiner ports. // Protocol defines network protocols supported for things like conatiner ports.
...@@ -582,15 +582,15 @@ const ( ...@@ -582,15 +582,15 @@ const (
PullIfNotPresent PullPolicy = "IfNotPresent" PullIfNotPresent PullPolicy = "IfNotPresent"
) )
// CapabilityType represent POSIX capabilities type // Capability represent POSIX capabilities type
type CapabilityType string type Capability string
// Capabilities represent POSIX capabilities that can be added or removed to a running container. // Capabilities represent POSIX capabilities that can be added or removed to a running container.
type Capabilities struct { type Capabilities struct {
// Added capabilities // Added capabilities
Add []CapabilityType `json:"add,omitempty"` Add []Capability `json:"add,omitempty"`
// Removed capabilities // Removed capabilities
Drop []CapabilityType `json:"drop,omitempty"` Drop []Capability `json:"drop,omitempty"`
} }
// ResourceRequirements describes the compute resource requirements. // ResourceRequirements describes the compute resource requirements.
...@@ -969,14 +969,14 @@ type ServiceList struct { ...@@ -969,14 +969,14 @@ type ServiceList struct {
} }
// Session Affinity Type string // Session Affinity Type string
type AffinityType string type ServiceAffinity string
const ( const (
// AffinityTypeClientIP is the Client IP based. // ServiceAffinityClientIP is the Client IP based.
AffinityTypeClientIP AffinityType = "ClientIP" ServiceAffinityClientIP ServiceAffinity = "ClientIP"
// AffinityTypeNone - no session affinity. // ServiceAffinityNone - no session affinity.
AffinityTypeNone AffinityType = "None" ServiceAffinityNone ServiceAffinity = "None"
) )
// ServiceStatus represents the current status of a service // ServiceStatus represents the current status of a service
...@@ -1009,7 +1009,7 @@ type ServiceSpec struct { ...@@ -1009,7 +1009,7 @@ type ServiceSpec struct {
PublicIPs []string `json:"publicIPs,omitempty"` PublicIPs []string `json:"publicIPs,omitempty"`
// Required: Supports "ClientIP" and "None". Used to maintain session affinity. // Required: Supports "ClientIP" and "None". Used to maintain session affinity.
SessionAffinity AffinityType `json:"sessionAffinity,omitempty"` SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty"`
} }
type ServicePort struct { type ServicePort struct {
......
...@@ -84,17 +84,17 @@ func convert_v1_Capabilities_To_api_Capabilities(in *Capabilities, out *newer.Ca ...@@ -84,17 +84,17 @@ func convert_v1_Capabilities_To_api_Capabilities(in *Capabilities, out *newer.Ca
defaulting.(func(*Capabilities))(in) defaulting.(func(*Capabilities))(in)
} }
if in.Add != nil { if in.Add != nil {
out.Add = make([]newer.CapabilityType, len(in.Add)) out.Add = make([]newer.Capability, len(in.Add))
for i := range in.Add { for i := range in.Add {
out.Add[i] = newer.CapabilityType(in.Add[i]) out.Add[i] = newer.Capability(in.Add[i])
} }
} else { } else {
out.Add = nil out.Add = nil
} }
if in.Drop != nil { if in.Drop != nil {
out.Drop = make([]newer.CapabilityType, len(in.Drop)) out.Drop = make([]newer.Capability, len(in.Drop))
for i := range in.Drop { for i := range in.Drop {
out.Drop[i] = newer.CapabilityType(in.Drop[i]) out.Drop[i] = newer.Capability(in.Drop[i])
} }
} else { } else {
out.Drop = nil out.Drop = nil
...@@ -107,17 +107,17 @@ func convert_api_Capabilities_To_v1_Capabilities(in *newer.Capabilities, out *Ca ...@@ -107,17 +107,17 @@ func convert_api_Capabilities_To_v1_Capabilities(in *newer.Capabilities, out *Ca
defaulting.(func(*newer.Capabilities))(in) defaulting.(func(*newer.Capabilities))(in)
} }
if in.Add != nil { if in.Add != nil {
out.Add = make([]CapabilityType, len(in.Add)) out.Add = make([]Capability, len(in.Add))
for i := range in.Add { for i := range in.Add {
out.Add[i] = CapabilityType(in.Add[i]) out.Add[i] = Capability(in.Add[i])
} }
} else { } else {
out.Add = nil out.Add = nil
} }
if in.Drop != nil { if in.Drop != nil {
out.Drop = make([]CapabilityType, len(in.Drop)) out.Drop = make([]Capability, len(in.Drop))
for i := range in.Drop { for i := range in.Drop {
out.Drop[i] = CapabilityType(in.Drop[i]) out.Drop[i] = Capability(in.Drop[i])
} }
} else { } else {
out.Drop = nil out.Drop = nil
...@@ -657,7 +657,7 @@ func convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVol ...@@ -657,7 +657,7 @@ func convert_v1_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyDirVol
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*EmptyDirVolumeSource))(in) defaulting.(func(*EmptyDirVolumeSource))(in)
} }
out.Medium = newer.StorageType(in.Medium) out.Medium = newer.StorageMedium(in.Medium)
return nil return nil
} }
...@@ -665,7 +665,7 @@ func convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *newer.Empty ...@@ -665,7 +665,7 @@ func convert_api_EmptyDirVolumeSource_To_v1_EmptyDirVolumeSource(in *newer.Empty
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*newer.EmptyDirVolumeSource))(in) defaulting.(func(*newer.EmptyDirVolumeSource))(in)
} }
out.Medium = StorageType(in.Medium) out.Medium = StorageMedium(in.Medium)
return nil return nil
} }
...@@ -2272,9 +2272,9 @@ func convert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(in *P ...@@ -2272,9 +2272,9 @@ func convert_v1_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(in *P
defaulting.(func(*PersistentVolumeClaimSpec))(in) defaulting.(func(*PersistentVolumeClaimSpec))(in)
} }
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]newer.AccessModeType, len(in.AccessModes)) out.AccessModes = make([]newer.PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = newer.AccessModeType(in.AccessModes[i]) out.AccessModes[i] = newer.PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2291,9 +2291,9 @@ func convert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(in *n ...@@ -2291,9 +2291,9 @@ func convert_api_PersistentVolumeClaimSpec_To_v1_PersistentVolumeClaimSpec(in *n
defaulting.(func(*newer.PersistentVolumeClaimSpec))(in) defaulting.(func(*newer.PersistentVolumeClaimSpec))(in)
} }
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]AccessModeType, len(in.AccessModes)) out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = AccessModeType(in.AccessModes[i]) out.AccessModes[i] = PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2311,9 +2311,9 @@ func convert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(i ...@@ -2311,9 +2311,9 @@ func convert_v1_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimStatus(i
} }
out.Phase = newer.PersistentVolumeClaimPhase(in.Phase) out.Phase = newer.PersistentVolumeClaimPhase(in.Phase)
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]newer.AccessModeType, len(in.AccessModes)) out.AccessModes = make([]newer.PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = newer.AccessModeType(in.AccessModes[i]) out.AccessModes[i] = newer.PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2339,9 +2339,9 @@ func convert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(i ...@@ -2339,9 +2339,9 @@ func convert_api_PersistentVolumeClaimStatus_To_v1_PersistentVolumeClaimStatus(i
} }
out.Phase = PersistentVolumeClaimPhase(in.Phase) out.Phase = PersistentVolumeClaimPhase(in.Phase)
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]AccessModeType, len(in.AccessModes)) out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = AccessModeType(in.AccessModes[i]) out.AccessModes[i] = PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2539,9 +2539,9 @@ func convert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *PersistentV ...@@ -2539,9 +2539,9 @@ func convert_v1_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *PersistentV
return err return err
} }
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]newer.AccessModeType, len(in.AccessModes)) out.AccessModes = make([]newer.PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = newer.AccessModeType(in.AccessModes[i]) out.AccessModes[i] = newer.PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2577,9 +2577,9 @@ func convert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *newer.Persi ...@@ -2577,9 +2577,9 @@ func convert_api_PersistentVolumeSpec_To_v1_PersistentVolumeSpec(in *newer.Persi
return err return err
} }
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]AccessModeType, len(in.AccessModes)) out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = AccessModeType(in.AccessModes[i]) out.AccessModes[i] = PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -4057,7 +4057,7 @@ func convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *newer.Servi ...@@ -4057,7 +4057,7 @@ func convert_v1_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *newer.Servi
} else { } else {
out.PublicIPs = nil out.PublicIPs = nil
} }
out.SessionAffinity = newer.AffinityType(in.SessionAffinity) out.SessionAffinity = newer.ServiceAffinity(in.SessionAffinity)
return nil return nil
} }
...@@ -4093,7 +4093,7 @@ func convert_api_ServiceSpec_To_v1_ServiceSpec(in *newer.ServiceSpec, out *Servi ...@@ -4093,7 +4093,7 @@ func convert_api_ServiceSpec_To_v1_ServiceSpec(in *newer.ServiceSpec, out *Servi
} else { } else {
out.PublicIPs = nil out.PublicIPs = nil
} }
out.SessionAffinity = AffinityType(in.SessionAffinity) out.SessionAffinity = ServiceAffinity(in.SessionAffinity)
return nil return nil
} }
......
...@@ -69,7 +69,7 @@ func addDefaultingFuncs() { ...@@ -69,7 +69,7 @@ func addDefaultingFuncs() {
}, },
func(obj *ServiceSpec) { func(obj *ServiceSpec) {
if obj.SessionAffinity == "" { if obj.SessionAffinity == "" {
obj.SessionAffinity = AffinityTypeNone obj.SessionAffinity = ServiceAffinityNone
} }
for i := range obj.Ports { for i := range obj.Ports {
sp := &obj.Ports[i] sp := &obj.Ports[i]
......
...@@ -159,8 +159,8 @@ func TestSetDefaultService(t *testing.T) { ...@@ -159,8 +159,8 @@ func TestSetDefaultService(t *testing.T) {
svc := &current.Service{} svc := &current.Service{}
obj2 := roundTrip(t, runtime.Object(svc)) obj2 := roundTrip(t, runtime.Object(svc))
svc2 := obj2.(*current.Service) svc2 := obj2.(*current.Service)
if svc2.Spec.SessionAffinity != current.AffinityTypeNone { if svc2.Spec.SessionAffinity != current.ServiceAffinityNone {
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.AffinityTypeNone, svc2.Spec.SessionAffinity) t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.ServiceAffinityNone, svc2.Spec.SessionAffinity)
} }
} }
......
...@@ -268,7 +268,7 @@ type PersistentVolumeSpec struct { ...@@ -268,7 +268,7 @@ type PersistentVolumeSpec struct {
// Source represents the location and type of a volume to mount. // Source represents the location and type of a volume to mount.
PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"` PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"`
// AccessModes contains all ways the volume can be mounted // AccessModes contains all ways the volume can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"all ways the volume can be mounted"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"all ways the volume can be mounted"`
// ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. // ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
// ClaimRef is expected to be non-nil when bound. // ClaimRef is expected to be non-nil when bound.
// claim.VolumeName is the authoritative bind between PV and PVC. // claim.VolumeName is the authoritative bind between PV and PVC.
...@@ -308,7 +308,7 @@ type PersistentVolumeClaimList struct { ...@@ -308,7 +308,7 @@ type PersistentVolumeClaimList struct {
// and allows a Source for provider-specific attributes // and allows a Source for provider-specific attributes
type PersistentVolumeClaimSpec struct { type PersistentVolumeClaimSpec struct {
// Contains the types of access modes required // Contains the types of access modes required
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the desired access modes the volume should have"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"the desired access modes the volume should have"`
// Resources represents the minimum resources required // Resources represents the minimum resources required
Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"` Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"`
// VolumeName is the binding reference to the PersistentVolume backing this claim // VolumeName is the binding reference to the PersistentVolume backing this claim
...@@ -319,20 +319,20 @@ type PersistentVolumeClaimStatus struct { ...@@ -319,20 +319,20 @@ type PersistentVolumeClaimStatus struct {
// Phase represents the current phase of PersistentVolumeClaim // Phase represents the current phase of PersistentVolumeClaim
Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"` Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"`
// AccessModes contains all ways the volume backing the PVC can be mounted // AccessModes contains all ways the volume backing the PVC can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the actual access modes the volume has"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"the actual access modes the volume has"`
// Represents the actual resources of the underlying volume // Represents the actual resources of the underlying volume
Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"` Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"`
} }
type AccessModeType string type PersistentVolumeAccessMode string
const ( const (
// can be mounted read/write mode to exactly 1 host // can be mounted read/write mode to exactly 1 host
ReadWriteOnce AccessModeType = "ReadWriteOnce" ReadWriteOnce PersistentVolumeAccessMode = "ReadWriteOnce"
// can be mounted in read-only mode to many hosts // can be mounted in read-only mode to many hosts
ReadOnlyMany AccessModeType = "ReadOnlyMany" ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany"
// can be mounted in read/write mode to many hosts // can be mounted in read/write mode to many hosts
ReadWriteMany AccessModeType = "ReadWriteMany" ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany"
) )
type PersistentVolumePhase string type PersistentVolumePhase string
...@@ -366,7 +366,7 @@ type HostPathVolumeSource struct { ...@@ -366,7 +366,7 @@ type HostPathVolumeSource struct {
type EmptyDirVolumeSource struct { type EmptyDirVolumeSource struct {
// Optional: what type of storage medium should back this directory. // Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium. // The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` Medium StorageMedium `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
} }
// GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod // GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod
...@@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct { ...@@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"` ReadOnly bool `json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"`
} }
// StorageType defines ways that storage can be allocated to a volume. // StorageMedium defines ways that storage can be allocated to a volume.
type StorageType string type StorageMedium string
const ( const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
) )
// Protocol defines network protocols supported for things like conatiner ports. // Protocol defines network protocols supported for things like conatiner ports.
...@@ -590,15 +590,15 @@ const ( ...@@ -590,15 +590,15 @@ const (
PullIfNotPresent PullPolicy = "IfNotPresent" PullIfNotPresent PullPolicy = "IfNotPresent"
) )
// CapabilityType represent POSIX capabilities type // Capability represent POSIX capabilities type
type CapabilityType string type Capability string
// Capabilities represent POSIX capabilities that can be added or removed to a running container. // Capabilities represent POSIX capabilities that can be added or removed to a running container.
type Capabilities struct { type Capabilities struct {
// Added capabilities // Added capabilities
Add []CapabilityType `json:"add,omitempty" description:"added capabilities"` Add []Capability `json:"add,omitempty" description:"added capabilities"`
// Removed capabilities // Removed capabilities
Drop []CapabilityType `json:"drop,omitempty" description:"droped capabilities"` Drop []Capability `json:"drop,omitempty" description:"droped capabilities"`
} }
// ResourceRequirements describes the compute resource requirements. // ResourceRequirements describes the compute resource requirements.
...@@ -951,14 +951,14 @@ type ReplicationControllerList struct { ...@@ -951,14 +951,14 @@ type ReplicationControllerList struct {
} }
// Session Affinity Type string // Session Affinity Type string
type AffinityType string type ServiceAffinity string
const ( const (
// AffinityTypeClientIP is the Client IP based. // ServiceAffinityClientIP is the Client IP based.
AffinityTypeClientIP AffinityType = "ClientIP" ServiceAffinityClientIP ServiceAffinity = "ClientIP"
// AffinityTypeNone - no session affinity. // ServiceAffinityNone - no session affinity.
AffinityTypeNone AffinityType = "None" ServiceAffinityNone ServiceAffinity = "None"
) )
// ServiceStatus represents the current status of a service // ServiceStatus represents the current status of a service
...@@ -987,7 +987,7 @@ type ServiceSpec struct { ...@@ -987,7 +987,7 @@ type ServiceSpec struct {
PublicIPs []string `json:"publicIPs,omitempty" description:"externally visible IPs (e.g. load balancers) that should be proxied to this service"` PublicIPs []string `json:"publicIPs,omitempty" description:"externally visible IPs (e.g. load balancers) that should be proxied to this service"`
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity. // Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"` SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
} }
type ServicePort struct { type ServicePort struct {
......
...@@ -771,11 +771,11 @@ func TestBadSecurityContextConversion(t *testing.T) { ...@@ -771,11 +771,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps add": { "mismatched caps add": {
c: &current.Container{ c: &current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"bar"}, Add: []current.Capability{"bar"},
}, },
}, },
}, },
...@@ -784,11 +784,11 @@ func TestBadSecurityContextConversion(t *testing.T) { ...@@ -784,11 +784,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps drop": { "mismatched caps drop": {
c: &current.Container{ c: &current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Drop: []current.CapabilityType{"foo"}, Drop: []current.Capability{"foo"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
......
...@@ -74,7 +74,7 @@ func addDefaultingFuncs() { ...@@ -74,7 +74,7 @@ func addDefaultingFuncs() {
obj.Protocol = ProtocolTCP obj.Protocol = ProtocolTCP
} }
if obj.SessionAffinity == "" { if obj.SessionAffinity == "" {
obj.SessionAffinity = AffinityTypeNone obj.SessionAffinity = ServiceAffinityNone
} }
for i := range obj.Ports { for i := range obj.Ports {
sp := &obj.Ports[i] sp := &obj.Ports[i]
......
...@@ -149,8 +149,8 @@ func TestSetDefaultService(t *testing.T) { ...@@ -149,8 +149,8 @@ func TestSetDefaultService(t *testing.T) {
if svc2.Protocol != current.ProtocolTCP { if svc2.Protocol != current.ProtocolTCP {
t.Errorf("Expected default protocol :%s, got: %s", current.ProtocolTCP, svc2.Protocol) t.Errorf("Expected default protocol :%s, got: %s", current.ProtocolTCP, svc2.Protocol)
} }
if svc2.SessionAffinity != current.AffinityTypeNone { if svc2.SessionAffinity != current.ServiceAffinityNone {
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.AffinityTypeNone, svc2.SessionAffinity) t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.ServiceAffinityNone, svc2.SessionAffinity)
} }
} }
...@@ -351,8 +351,8 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -351,8 +351,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c: current.Container{ c: current.Container{
Privileged: false, Privileged: false,
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &priv, Privileged: &priv,
...@@ -363,13 +363,13 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -363,13 +363,13 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c: current.Container{ c: current.Container{
Privileged: false, Privileged: false,
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
...@@ -380,8 +380,8 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -380,8 +380,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &priv, Privileged: &priv,
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"biz"}, Add: []current.Capability{"biz"},
Drop: []current.CapabilityType{"baz"}, Drop: []current.Capability{"baz"},
}, },
}, },
}, },
...@@ -389,14 +389,14 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -389,14 +389,14 @@ func TestSetDefaultSecurityContext(t *testing.T) {
"upward defaulting priv": { "upward defaulting priv": {
c: current.Container{ c: current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &privTrue, Privileged: &privTrue,
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
......
...@@ -174,7 +174,7 @@ type PersistentVolumeSpec struct { ...@@ -174,7 +174,7 @@ type PersistentVolumeSpec struct {
// Source represents the location and type of a volume to mount. // Source represents the location and type of a volume to mount.
PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"` PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"`
// AccessModes contains all ways the volume can be mounted // AccessModes contains all ways the volume can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"all ways the volume can be mounted"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"all ways the volume can be mounted"`
// ClaimRef is a non-binding reference to the claim bound to this volume // ClaimRef is a non-binding reference to the claim bound to this volume
ClaimRef *ObjectReference `json:"claimRef,omitempty" description:"when bound, a reference to the bound claim"` ClaimRef *ObjectReference `json:"claimRef,omitempty" description:"when bound, a reference to the bound claim"`
} }
...@@ -209,7 +209,7 @@ type PersistentVolumeClaimList struct { ...@@ -209,7 +209,7 @@ type PersistentVolumeClaimList struct {
// and allows a Source for provider-specific attributes // and allows a Source for provider-specific attributes
type PersistentVolumeClaimSpec struct { type PersistentVolumeClaimSpec struct {
// Contains the types of access modes required // Contains the types of access modes required
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the desired access modes the volume should have"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"the desired access modes the volume should have"`
// Resources represents the minimum resources required // Resources represents the minimum resources required
Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"` Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"`
// VolumeName is the binding reference to the PersistentVolume backing this claim // VolumeName is the binding reference to the PersistentVolume backing this claim
...@@ -220,20 +220,20 @@ type PersistentVolumeClaimStatus struct { ...@@ -220,20 +220,20 @@ type PersistentVolumeClaimStatus struct {
// Phase represents the current phase of PersistentVolumeClaim // Phase represents the current phase of PersistentVolumeClaim
Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"` Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"`
// AccessModes contains all ways the volume backing the PVC can be mounted // AccessModes contains all ways the volume backing the PVC can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the actual access modes the volume has"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"the actual access modes the volume has"`
// Represents the actual resources of the underlying volume // Represents the actual resources of the underlying volume
Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"` Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"`
} }
type AccessModeType string type PersistentVolumeAccessMode string
const ( const (
// can be mounted read/write mode to exactly 1 host // can be mounted read/write mode to exactly 1 host
ReadWriteOnce AccessModeType = "ReadWriteOnce" ReadWriteOnce PersistentVolumeAccessMode = "ReadWriteOnce"
// can be mounted in read-only mode to many hosts // can be mounted in read-only mode to many hosts
ReadOnlyMany AccessModeType = "ReadOnlyMany" ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany"
// can be mounted in read/write mode to many hosts // can be mounted in read/write mode to many hosts
ReadWriteMany AccessModeType = "ReadWriteMany" ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany"
) )
type PersistentVolumePhase string type PersistentVolumePhase string
...@@ -267,15 +267,15 @@ type HostPathVolumeSource struct { ...@@ -267,15 +267,15 @@ type HostPathVolumeSource struct {
type EmptyDirVolumeSource struct { type EmptyDirVolumeSource struct {
// Optional: what type of storage medium should back this directory. // Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium. // The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` Medium StorageMedium `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
} }
// StorageType defines ways that storage can be allocated to a volume. // StorageMedium defines ways that storage can be allocated to a volume.
type StorageType string type StorageMedium string
const ( const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
) )
// Protocol defines network protocols supported for things like conatiner ports. // Protocol defines network protocols supported for things like conatiner ports.
...@@ -481,15 +481,15 @@ const ( ...@@ -481,15 +481,15 @@ const (
PullIfNotPresent PullPolicy = "PullIfNotPresent" PullIfNotPresent PullPolicy = "PullIfNotPresent"
) )
// CapabilityType represent POSIX capabilities type // Capability represent POSIX capabilities type
type CapabilityType string type Capability string
// Capabilities represent POSIX capabilities that can be added or removed to a running container. // Capabilities represent POSIX capabilities that can be added or removed to a running container.
type Capabilities struct { type Capabilities struct {
// Added capabilities // Added capabilities
Add []CapabilityType `json:"add,omitempty" description:"added capabilities"` Add []Capability `json:"add,omitempty" description:"added capabilities"`
// Removed capabilities // Removed capabilities
Drop []CapabilityType `json:"drop,omitempty" description:"droped capabilities"` Drop []Capability `json:"drop,omitempty" description:"droped capabilities"`
} }
type ResourceRequirements struct { type ResourceRequirements struct {
...@@ -793,14 +793,14 @@ type PodTemplate struct { ...@@ -793,14 +793,14 @@ type PodTemplate struct {
} }
// Session Affinity Type string // Session Affinity Type string
type AffinityType string type ServiceAffinity string
const ( const (
// AffinityTypeClientIP is the Client IP based. // ServiceAffinityClientIP is the Client IP based.
AffinityTypeClientIP AffinityType = "ClientIP" ServiceAffinityClientIP ServiceAffinity = "ClientIP"
// AffinityTypeNone - no session affinity. // ServiceAffinityNone - no session affinity.
AffinityTypeNone AffinityType = "None" ServiceAffinityNone ServiceAffinity = "None"
) )
const ( const (
...@@ -856,7 +856,7 @@ type Service struct { ...@@ -856,7 +856,7 @@ type Service struct {
ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"` ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"`
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity. // Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"` SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
// Optional: Ports to expose on the service. If this field is // Optional: Ports to expose on the service. If this field is
// specified, the legacy fields (Port, PortName, Protocol, and // specified, the legacy fields (Port, PortName, Protocol, and
......
...@@ -586,11 +586,11 @@ func TestBadSecurityContextConversion(t *testing.T) { ...@@ -586,11 +586,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps add": { "mismatched caps add": {
c: &current.Container{ c: &current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"bar"}, Add: []current.Capability{"bar"},
}, },
}, },
}, },
...@@ -599,11 +599,11 @@ func TestBadSecurityContextConversion(t *testing.T) { ...@@ -599,11 +599,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps drop": { "mismatched caps drop": {
c: &current.Container{ c: &current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Drop: []current.CapabilityType{"foo"}, Drop: []current.Capability{"foo"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
......
...@@ -75,7 +75,7 @@ func addDefaultingFuncs() { ...@@ -75,7 +75,7 @@ func addDefaultingFuncs() {
obj.Protocol = ProtocolTCP obj.Protocol = ProtocolTCP
} }
if obj.SessionAffinity == "" { if obj.SessionAffinity == "" {
obj.SessionAffinity = AffinityTypeNone obj.SessionAffinity = ServiceAffinityNone
} }
for i := range obj.Ports { for i := range obj.Ports {
sp := &obj.Ports[i] sp := &obj.Ports[i]
......
...@@ -149,8 +149,8 @@ func TestSetDefaultService(t *testing.T) { ...@@ -149,8 +149,8 @@ func TestSetDefaultService(t *testing.T) {
if svc2.Protocol != current.ProtocolTCP { if svc2.Protocol != current.ProtocolTCP {
t.Errorf("Expected default protocol :%s, got: %s", current.ProtocolTCP, svc2.Protocol) t.Errorf("Expected default protocol :%s, got: %s", current.ProtocolTCP, svc2.Protocol)
} }
if svc2.SessionAffinity != current.AffinityTypeNone { if svc2.SessionAffinity != current.ServiceAffinityNone {
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.AffinityTypeNone, svc2.SessionAffinity) t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.ServiceAffinityNone, svc2.SessionAffinity)
} }
} }
...@@ -350,8 +350,8 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -350,8 +350,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c: current.Container{ c: current.Container{
Privileged: false, Privileged: false,
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &priv, Privileged: &priv,
...@@ -362,13 +362,13 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -362,13 +362,13 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c: current.Container{ c: current.Container{
Privileged: false, Privileged: false,
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
...@@ -379,8 +379,8 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -379,8 +379,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &priv, Privileged: &priv,
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"biz"}, Add: []current.Capability{"biz"},
Drop: []current.CapabilityType{"baz"}, Drop: []current.Capability{"baz"},
}, },
}, },
}, },
...@@ -388,14 +388,14 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -388,14 +388,14 @@ func TestSetDefaultSecurityContext(t *testing.T) {
"upward defaulting priv": { "upward defaulting priv": {
c: current.Container{ c: current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &privTrue, Privileged: &privTrue,
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
......
...@@ -135,7 +135,7 @@ type PersistentVolumeSpec struct { ...@@ -135,7 +135,7 @@ type PersistentVolumeSpec struct {
// Source represents the location and type of a volume to mount. // Source represents the location and type of a volume to mount.
PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"` PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"`
// AccessModes contains all ways the volume can be mounted // AccessModes contains all ways the volume can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"all ways the volume can be mounted"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"all ways the volume can be mounted"`
// ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. // ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
// ClaimRef is expected to be non-nil when bound. // ClaimRef is expected to be non-nil when bound.
// claim.VolumeName is the authoritative bind between PV and PVC. // claim.VolumeName is the authoritative bind between PV and PVC.
...@@ -172,7 +172,7 @@ type PersistentVolumeClaimList struct { ...@@ -172,7 +172,7 @@ type PersistentVolumeClaimList struct {
// and allows a Source for provider-specific attributes // and allows a Source for provider-specific attributes
type PersistentVolumeClaimSpec struct { type PersistentVolumeClaimSpec struct {
// Contains the types of access modes required // Contains the types of access modes required
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the desired access modes the volume should have"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"the desired access modes the volume should have"`
// Resources represents the minimum resources required // Resources represents the minimum resources required
Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"` Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"`
// VolumeName is the binding reference to the PersistentVolume backing this claim // VolumeName is the binding reference to the PersistentVolume backing this claim
...@@ -183,20 +183,20 @@ type PersistentVolumeClaimStatus struct { ...@@ -183,20 +183,20 @@ type PersistentVolumeClaimStatus struct {
// Phase represents the current phase of PersistentVolumeClaim // Phase represents the current phase of PersistentVolumeClaim
Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"` Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"`
// AccessModes contains all ways the volume backing the PVC can be mounted // AccessModes contains all ways the volume backing the PVC can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the actual access modes the volume has"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"the actual access modes the volume has"`
// Represents the actual resources of the underlying volume // Represents the actual resources of the underlying volume
Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"` Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"`
} }
type AccessModeType string type PersistentVolumeAccessMode string
const ( const (
// can be mounted read/write mode to exactly 1 host // can be mounted read/write mode to exactly 1 host
ReadWriteOnce AccessModeType = "ReadWriteOnce" ReadWriteOnce PersistentVolumeAccessMode = "ReadWriteOnce"
// can be mounted in read-only mode to many hosts // can be mounted in read-only mode to many hosts
ReadOnlyMany AccessModeType = "ReadOnlyMany" ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany"
// can be mounted in read/write mode to many hosts // can be mounted in read/write mode to many hosts
ReadWriteMany AccessModeType = "ReadWriteMany" ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany"
) )
type PersistentVolumePhase string type PersistentVolumePhase string
...@@ -235,15 +235,15 @@ type HostPathVolumeSource struct { ...@@ -235,15 +235,15 @@ type HostPathVolumeSource struct {
type EmptyDirVolumeSource struct { type EmptyDirVolumeSource struct {
// Optional: what type of storage medium should back this directory. // Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium. // The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` Medium StorageMedium `json:"medium" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
} }
// StorageType defines ways that storage can be allocated to a volume. // StorageMedium defines ways that storage can be allocated to a volume.
type StorageType string type StorageMedium string
const ( const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
) )
// SecretVolumeSource adapts a Secret into a VolumeSource // SecretVolumeSource adapts a Secret into a VolumeSource
...@@ -466,17 +466,17 @@ const ( ...@@ -466,17 +466,17 @@ const (
PullIfNotPresent PullPolicy = "PullIfNotPresent" PullIfNotPresent PullPolicy = "PullIfNotPresent"
) )
// CapabilityType represent POSIX capabilities type // Capability represent POSIX capabilities type
type CapabilityType string type Capability string
// Capabilities represent POSIX capabilities that can be added or removed to a running container. // Capabilities represent POSIX capabilities that can be added or removed to a running container.
// //
// http://docs.k8s.io/containers.md#capabilities // http://docs.k8s.io/containers.md#capabilities
type Capabilities struct { type Capabilities struct {
// Added capabilities // Added capabilities
Add []CapabilityType `json:"add,omitempty" description:"added capabilities"` Add []Capability `json:"add,omitempty" description:"added capabilities"`
// Removed capabilities // Removed capabilities
Drop []CapabilityType `json:"drop,omitempty" description:"droped capabilities"` Drop []Capability `json:"drop,omitempty" description:"droped capabilities"`
} }
type ResourceRequirements struct { type ResourceRequirements struct {
...@@ -799,14 +799,14 @@ type PodTemplate struct { ...@@ -799,14 +799,14 @@ type PodTemplate struct {
} }
// Session Affinity Type string // Session Affinity Type string
type AffinityType string type ServiceAffinity string
const ( const (
// AffinityTypeClientIP is the Client IP based. // ServiceAffinityClientIP is the Client IP based.
AffinityTypeClientIP AffinityType = "ClientIP" ServiceAffinityClientIP ServiceAffinity = "ClientIP"
// AffinityTypeNone - no session affinity. // ServiceAffinityNone - no session affinity.
AffinityTypeNone AffinityType = "None" ServiceAffinityNone ServiceAffinity = "None"
) )
const ( const (
...@@ -864,7 +864,7 @@ type Service struct { ...@@ -864,7 +864,7 @@ type Service struct {
ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"` ProxyPort int `json:"proxyPort,omitempty" description:"if non-zero, a pre-allocated host port used for this service by the proxy on each node; assigned by the master and ignored on input"`
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity. // Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"` SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
// Optional: Ports to expose on the service. If this field is // Optional: Ports to expose on the service. If this field is
// specified, the legacy fields (Port, PortName, Protocol, and // specified, the legacy fields (Port, PortName, Protocol, and
......
...@@ -84,17 +84,17 @@ func convert_api_Capabilities_To_v1beta3_Capabilities(in *newer.Capabilities, ou ...@@ -84,17 +84,17 @@ func convert_api_Capabilities_To_v1beta3_Capabilities(in *newer.Capabilities, ou
defaulting.(func(*newer.Capabilities))(in) defaulting.(func(*newer.Capabilities))(in)
} }
if in.Add != nil { if in.Add != nil {
out.Add = make([]CapabilityType, len(in.Add)) out.Add = make([]Capability, len(in.Add))
for i := range in.Add { for i := range in.Add {
out.Add[i] = CapabilityType(in.Add[i]) out.Add[i] = Capability(in.Add[i])
} }
} else { } else {
out.Add = nil out.Add = nil
} }
if in.Drop != nil { if in.Drop != nil {
out.Drop = make([]CapabilityType, len(in.Drop)) out.Drop = make([]Capability, len(in.Drop))
for i := range in.Drop { for i := range in.Drop {
out.Drop[i] = CapabilityType(in.Drop[i]) out.Drop[i] = Capability(in.Drop[i])
} }
} else { } else {
out.Drop = nil out.Drop = nil
...@@ -107,17 +107,17 @@ func convert_v1beta3_Capabilities_To_api_Capabilities(in *Capabilities, out *new ...@@ -107,17 +107,17 @@ func convert_v1beta3_Capabilities_To_api_Capabilities(in *Capabilities, out *new
defaulting.(func(*Capabilities))(in) defaulting.(func(*Capabilities))(in)
} }
if in.Add != nil { if in.Add != nil {
out.Add = make([]newer.CapabilityType, len(in.Add)) out.Add = make([]newer.Capability, len(in.Add))
for i := range in.Add { for i := range in.Add {
out.Add[i] = newer.CapabilityType(in.Add[i]) out.Add[i] = newer.Capability(in.Add[i])
} }
} else { } else {
out.Add = nil out.Add = nil
} }
if in.Drop != nil { if in.Drop != nil {
out.Drop = make([]newer.CapabilityType, len(in.Drop)) out.Drop = make([]newer.Capability, len(in.Drop))
for i := range in.Drop { for i := range in.Drop {
out.Drop[i] = newer.CapabilityType(in.Drop[i]) out.Drop[i] = newer.Capability(in.Drop[i])
} }
} else { } else {
out.Drop = nil out.Drop = nil
...@@ -471,7 +471,7 @@ func convert_v1beta3_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyD ...@@ -471,7 +471,7 @@ func convert_v1beta3_EmptyDirVolumeSource_To_api_EmptyDirVolumeSource(in *EmptyD
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*EmptyDirVolumeSource))(in) defaulting.(func(*EmptyDirVolumeSource))(in)
} }
out.Medium = newer.StorageType(in.Medium) out.Medium = newer.StorageMedium(in.Medium)
return nil return nil
} }
...@@ -479,7 +479,7 @@ func convert_api_EmptyDirVolumeSource_To_v1beta3_EmptyDirVolumeSource(in *newer. ...@@ -479,7 +479,7 @@ func convert_api_EmptyDirVolumeSource_To_v1beta3_EmptyDirVolumeSource(in *newer.
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*newer.EmptyDirVolumeSource))(in) defaulting.(func(*newer.EmptyDirVolumeSource))(in)
} }
out.Medium = StorageType(in.Medium) out.Medium = StorageMedium(in.Medium)
return nil return nil
} }
...@@ -2086,9 +2086,9 @@ func convert_v1beta3_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec( ...@@ -2086,9 +2086,9 @@ func convert_v1beta3_PersistentVolumeClaimSpec_To_api_PersistentVolumeClaimSpec(
defaulting.(func(*PersistentVolumeClaimSpec))(in) defaulting.(func(*PersistentVolumeClaimSpec))(in)
} }
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]newer.AccessModeType, len(in.AccessModes)) out.AccessModes = make([]newer.PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = newer.AccessModeType(in.AccessModes[i]) out.AccessModes[i] = newer.PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2105,9 +2105,9 @@ func convert_api_PersistentVolumeClaimSpec_To_v1beta3_PersistentVolumeClaimSpec( ...@@ -2105,9 +2105,9 @@ func convert_api_PersistentVolumeClaimSpec_To_v1beta3_PersistentVolumeClaimSpec(
defaulting.(func(*newer.PersistentVolumeClaimSpec))(in) defaulting.(func(*newer.PersistentVolumeClaimSpec))(in)
} }
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]AccessModeType, len(in.AccessModes)) out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = AccessModeType(in.AccessModes[i]) out.AccessModes[i] = PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2125,9 +2125,9 @@ func convert_v1beta3_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimSta ...@@ -2125,9 +2125,9 @@ func convert_v1beta3_PersistentVolumeClaimStatus_To_api_PersistentVolumeClaimSta
} }
out.Phase = newer.PersistentVolumeClaimPhase(in.Phase) out.Phase = newer.PersistentVolumeClaimPhase(in.Phase)
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]newer.AccessModeType, len(in.AccessModes)) out.AccessModes = make([]newer.PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = newer.AccessModeType(in.AccessModes[i]) out.AccessModes[i] = newer.PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2153,9 +2153,9 @@ func convert_api_PersistentVolumeClaimStatus_To_v1beta3_PersistentVolumeClaimSta ...@@ -2153,9 +2153,9 @@ func convert_api_PersistentVolumeClaimStatus_To_v1beta3_PersistentVolumeClaimSta
} }
out.Phase = PersistentVolumeClaimPhase(in.Phase) out.Phase = PersistentVolumeClaimPhase(in.Phase)
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]AccessModeType, len(in.AccessModes)) out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = AccessModeType(in.AccessModes[i]) out.AccessModes[i] = PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2353,9 +2353,9 @@ func convert_v1beta3_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *Persis ...@@ -2353,9 +2353,9 @@ func convert_v1beta3_PersistentVolumeSpec_To_api_PersistentVolumeSpec(in *Persis
return err return err
} }
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]newer.AccessModeType, len(in.AccessModes)) out.AccessModes = make([]newer.PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = newer.AccessModeType(in.AccessModes[i]) out.AccessModes[i] = newer.PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -2391,9 +2391,9 @@ func convert_api_PersistentVolumeSpec_To_v1beta3_PersistentVolumeSpec(in *newer. ...@@ -2391,9 +2391,9 @@ func convert_api_PersistentVolumeSpec_To_v1beta3_PersistentVolumeSpec(in *newer.
return err return err
} }
if in.AccessModes != nil { if in.AccessModes != nil {
out.AccessModes = make([]AccessModeType, len(in.AccessModes)) out.AccessModes = make([]PersistentVolumeAccessMode, len(in.AccessModes))
for i := range in.AccessModes { for i := range in.AccessModes {
out.AccessModes[i] = AccessModeType(in.AccessModes[i]) out.AccessModes[i] = PersistentVolumeAccessMode(in.AccessModes[i])
} }
} else { } else {
out.AccessModes = nil out.AccessModes = nil
...@@ -3871,7 +3871,7 @@ func convert_v1beta3_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *newer. ...@@ -3871,7 +3871,7 @@ func convert_v1beta3_ServiceSpec_To_api_ServiceSpec(in *ServiceSpec, out *newer.
} else { } else {
out.PublicIPs = nil out.PublicIPs = nil
} }
out.SessionAffinity = newer.AffinityType(in.SessionAffinity) out.SessionAffinity = newer.ServiceAffinity(in.SessionAffinity)
return nil return nil
} }
...@@ -3907,7 +3907,7 @@ func convert_api_ServiceSpec_To_v1beta3_ServiceSpec(in *newer.ServiceSpec, out * ...@@ -3907,7 +3907,7 @@ func convert_api_ServiceSpec_To_v1beta3_ServiceSpec(in *newer.ServiceSpec, out *
} else { } else {
out.PublicIPs = nil out.PublicIPs = nil
} }
out.SessionAffinity = AffinityType(in.SessionAffinity) out.SessionAffinity = ServiceAffinity(in.SessionAffinity)
return nil return nil
} }
......
...@@ -67,11 +67,11 @@ func TestBadSecurityContextConversion(t *testing.T) { ...@@ -67,11 +67,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps add": { "mismatched caps add": {
c: &current.Container{ c: &current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"bar"}, Add: []current.Capability{"bar"},
}, },
}, },
}, },
...@@ -80,11 +80,11 @@ func TestBadSecurityContextConversion(t *testing.T) { ...@@ -80,11 +80,11 @@ func TestBadSecurityContextConversion(t *testing.T) {
"mismatched caps drop": { "mismatched caps drop": {
c: &current.Container{ c: &current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Drop: []current.CapabilityType{"foo"}, Drop: []current.Capability{"foo"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
......
...@@ -71,7 +71,7 @@ func addDefaultingFuncs() { ...@@ -71,7 +71,7 @@ func addDefaultingFuncs() {
}, },
func(obj *ServiceSpec) { func(obj *ServiceSpec) {
if obj.SessionAffinity == "" { if obj.SessionAffinity == "" {
obj.SessionAffinity = AffinityTypeNone obj.SessionAffinity = ServiceAffinityNone
} }
for i := range obj.Ports { for i := range obj.Ports {
sp := &obj.Ports[i] sp := &obj.Ports[i]
......
...@@ -159,8 +159,8 @@ func TestSetDefaultService(t *testing.T) { ...@@ -159,8 +159,8 @@ func TestSetDefaultService(t *testing.T) {
svc := &current.Service{} svc := &current.Service{}
obj2 := roundTrip(t, runtime.Object(svc)) obj2 := roundTrip(t, runtime.Object(svc))
svc2 := obj2.(*current.Service) svc2 := obj2.(*current.Service)
if svc2.Spec.SessionAffinity != current.AffinityTypeNone { if svc2.Spec.SessionAffinity != current.ServiceAffinityNone {
t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.AffinityTypeNone, svc2.Spec.SessionAffinity) t.Errorf("Expected default sesseion affinity type:%s, got: %s", current.ServiceAffinityNone, svc2.Spec.SessionAffinity)
} }
} }
...@@ -360,8 +360,8 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -360,8 +360,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c: current.Container{ c: current.Container{
Privileged: false, Privileged: false,
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &priv, Privileged: &priv,
...@@ -372,13 +372,13 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -372,13 +372,13 @@ func TestSetDefaultSecurityContext(t *testing.T) {
c: current.Container{ c: current.Container{
Privileged: false, Privileged: false,
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
...@@ -389,8 +389,8 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -389,8 +389,8 @@ func TestSetDefaultSecurityContext(t *testing.T) {
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &priv, Privileged: &priv,
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"biz"}, Add: []current.Capability{"biz"},
Drop: []current.CapabilityType{"baz"}, Drop: []current.Capability{"baz"},
}, },
}, },
}, },
...@@ -398,14 +398,14 @@ func TestSetDefaultSecurityContext(t *testing.T) { ...@@ -398,14 +398,14 @@ func TestSetDefaultSecurityContext(t *testing.T) {
"upward defaulting priv": { "upward defaulting priv": {
c: current.Container{ c: current.Container{
Capabilities: current.Capabilities{ Capabilities: current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
SecurityContext: &current.SecurityContext{ SecurityContext: &current.SecurityContext{
Privileged: &privTrue, Privileged: &privTrue,
Capabilities: &current.Capabilities{ Capabilities: &current.Capabilities{
Add: []current.CapabilityType{"foo"}, Add: []current.Capability{"foo"},
Drop: []current.CapabilityType{"bar"}, Drop: []current.Capability{"bar"},
}, },
}, },
}, },
......
...@@ -268,7 +268,7 @@ type PersistentVolumeSpec struct { ...@@ -268,7 +268,7 @@ type PersistentVolumeSpec struct {
// Source represents the location and type of a volume to mount. // Source represents the location and type of a volume to mount.
PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"` PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"`
// AccessModes contains all ways the volume can be mounted // AccessModes contains all ways the volume can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"all ways the volume can be mounted"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"all ways the volume can be mounted"`
// ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. // ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
// ClaimRef is expected to be non-nil when bound. // ClaimRef is expected to be non-nil when bound.
// claim.VolumeName is the authoritative bind between PV and PVC. // claim.VolumeName is the authoritative bind between PV and PVC.
...@@ -308,7 +308,7 @@ type PersistentVolumeClaimList struct { ...@@ -308,7 +308,7 @@ type PersistentVolumeClaimList struct {
// and allows a Source for provider-specific attributes // and allows a Source for provider-specific attributes
type PersistentVolumeClaimSpec struct { type PersistentVolumeClaimSpec struct {
// Contains the types of access modes required // Contains the types of access modes required
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the desired access modes the volume should have"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"the desired access modes the volume should have"`
// Resources represents the minimum resources required // Resources represents the minimum resources required
Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"` Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"`
// VolumeName is the binding reference to the PersistentVolume backing this claim // VolumeName is the binding reference to the PersistentVolume backing this claim
...@@ -319,20 +319,20 @@ type PersistentVolumeClaimStatus struct { ...@@ -319,20 +319,20 @@ type PersistentVolumeClaimStatus struct {
// Phase represents the current phase of PersistentVolumeClaim // Phase represents the current phase of PersistentVolumeClaim
Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"` Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"`
// AccessModes contains all ways the volume backing the PVC can be mounted // AccessModes contains all ways the volume backing the PVC can be mounted
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the actual access modes the volume has"` AccessModes []PersistentVolumeAccessMode `json:"accessModes,omitempty" description:"the actual access modes the volume has"`
// Represents the actual resources of the underlying volume // Represents the actual resources of the underlying volume
Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"` Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"`
} }
type AccessModeType string type PersistentVolumeAccessMode string
const ( const (
// can be mounted read/write mode to exactly 1 host // can be mounted read/write mode to exactly 1 host
ReadWriteOnce AccessModeType = "ReadWriteOnce" ReadWriteOnce PersistentVolumeAccessMode = "ReadWriteOnce"
// can be mounted in read-only mode to many hosts // can be mounted in read-only mode to many hosts
ReadOnlyMany AccessModeType = "ReadOnlyMany" ReadOnlyMany PersistentVolumeAccessMode = "ReadOnlyMany"
// can be mounted in read/write mode to many hosts // can be mounted in read/write mode to many hosts
ReadWriteMany AccessModeType = "ReadWriteMany" ReadWriteMany PersistentVolumeAccessMode = "ReadWriteMany"
) )
type PersistentVolumePhase string type PersistentVolumePhase string
...@@ -366,7 +366,7 @@ type HostPathVolumeSource struct { ...@@ -366,7 +366,7 @@ type HostPathVolumeSource struct {
type EmptyDirVolumeSource struct { type EmptyDirVolumeSource struct {
// Optional: what type of storage medium should back this directory. // Optional: what type of storage medium should back this directory.
// The default is "" which means to use the node's default medium. // The default is "" which means to use the node's default medium.
Medium StorageType `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"` Medium StorageMedium `json:"medium,omitempty" description:"type of storage used to back the volume; must be an empty string (default) or Memory"`
} }
// GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod // GlusterfsVolumeSource represents a Glusterfs Mount that lasts the lifetime of a pod
...@@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct { ...@@ -382,12 +382,12 @@ type GlusterfsVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"` ReadOnly bool `json:"readOnly,omitempty" description:"glusterfs volume to be mounted with read-only permissions"`
} }
// StorageType defines ways that storage can be allocated to a volume. // StorageMedium defines ways that storage can be allocated to a volume.
type StorageType string type StorageMedium string
const ( const (
StorageTypeDefault StorageType = "" // use whatever the default is for the node StorageMediumDefault StorageMedium = "" // use whatever the default is for the node
StorageTypeMemory StorageType = "Memory" // use memory (tmpfs) StorageMediumMemory StorageMedium = "Memory" // use memory (tmpfs)
) )
// Protocol defines network protocols supported for things like conatiner ports. // Protocol defines network protocols supported for things like conatiner ports.
...@@ -590,15 +590,15 @@ const ( ...@@ -590,15 +590,15 @@ const (
PullIfNotPresent PullPolicy = "IfNotPresent" PullIfNotPresent PullPolicy = "IfNotPresent"
) )
// CapabilityType represent POSIX capabilities type // Capability represent POSIX capabilities type
type CapabilityType string type Capability string
// Capabilities represent POSIX capabilities that can be added or removed to a running container. // Capabilities represent POSIX capabilities that can be added or removed to a running container.
type Capabilities struct { type Capabilities struct {
// Added capabilities // Added capabilities
Add []CapabilityType `json:"add,omitempty" description:"added capabilities"` Add []Capability `json:"add,omitempty" description:"added capabilities"`
// Removed capabilities // Removed capabilities
Drop []CapabilityType `json:"drop,omitempty" description:"droped capabilities"` Drop []Capability `json:"drop,omitempty" description:"droped capabilities"`
} }
// ResourceRequirements describes the compute resource requirements. // ResourceRequirements describes the compute resource requirements.
...@@ -955,14 +955,14 @@ type ReplicationControllerList struct { ...@@ -955,14 +955,14 @@ type ReplicationControllerList struct {
} }
// Session Affinity Type string // Session Affinity Type string
type AffinityType string type ServiceAffinity string
const ( const (
// AffinityTypeClientIP is the Client IP based. // ServiceAffinityClientIP is the Client IP based.
AffinityTypeClientIP AffinityType = "ClientIP" ServiceAffinityClientIP ServiceAffinity = "ClientIP"
// AffinityTypeNone - no session affinity. // ServiceAffinityNone - no session affinity.
AffinityTypeNone AffinityType = "None" ServiceAffinityNone ServiceAffinity = "None"
) )
// ServiceStatus represents the current status of a service // ServiceStatus represents the current status of a service
...@@ -991,7 +991,7 @@ type ServiceSpec struct { ...@@ -991,7 +991,7 @@ type ServiceSpec struct {
PublicIPs []string `json:"publicIPs,omitempty" description:"externally visible IPs (e.g. load balancers) that should be proxied to this service"` PublicIPs []string `json:"publicIPs,omitempty" description:"externally visible IPs (e.g. load balancers) that should be proxied to this service"`
// Optional: Supports "ClientIP" and "None". Used to maintain session affinity. // Optional: Supports "ClientIP" and "None". Used to maintain session affinity.
SessionAffinity AffinityType `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"` SessionAffinity ServiceAffinity `json:"sessionAffinity,omitempty" description:"enable client IP based session affinity; must be ClientIP or None; defaults to None"`
} }
type ServicePort struct { type ServicePort struct {
......
...@@ -514,7 +514,7 @@ func ValidatePersistentVolumeStatusUpdate(newPv, oldPv *api.PersistentVolume) er ...@@ -514,7 +514,7 @@ func ValidatePersistentVolumeStatusUpdate(newPv, oldPv *api.PersistentVolume) er
func ValidatePersistentVolumeClaim(pvc *api.PersistentVolumeClaim) errs.ValidationErrorList { func ValidatePersistentVolumeClaim(pvc *api.PersistentVolumeClaim) errs.ValidationErrorList {
allErrs := ValidateObjectMeta(&pvc.ObjectMeta, true, ValidatePersistentVolumeName) allErrs := ValidateObjectMeta(&pvc.ObjectMeta, true, ValidatePersistentVolumeName)
if len(pvc.Spec.AccessModes) == 0 { if len(pvc.Spec.AccessModes) == 0 {
allErrs = append(allErrs, errs.NewFieldInvalid("persistentVolumeClaim.Spec.AccessModes", pvc.Spec.AccessModes, "at least 1 AccessModeType is required")) allErrs = append(allErrs, errs.NewFieldInvalid("persistentVolumeClaim.Spec.AccessModes", pvc.Spec.AccessModes, "at least 1 PersistentVolumeAccessMode is required"))
} }
if _, ok := pvc.Spec.Resources.Requests[api.ResourceStorage]; !ok { if _, ok := pvc.Spec.Resources.Requests[api.ResourceStorage]; !ok {
allErrs = append(allErrs, errs.NewFieldInvalid("persistentVolumeClaim.Spec.Resources.Requests", pvc.Spec.Resources.Requests, "No Storage size specified")) allErrs = append(allErrs, errs.NewFieldInvalid("persistentVolumeClaim.Spec.Resources.Requests", pvc.Spec.Resources.Requests, "No Storage size specified"))
...@@ -985,7 +985,7 @@ func ValidatePodTemplateUpdate(newPod, oldPod *api.PodTemplate) errs.ValidationE ...@@ -985,7 +985,7 @@ func ValidatePodTemplateUpdate(newPod, oldPod *api.PodTemplate) errs.ValidationE
return allErrs return allErrs
} }
var supportedSessionAffinityType = util.NewStringSet(string(api.AffinityTypeClientIP), string(api.AffinityTypeNone)) var supportedSessionAffinityType = util.NewStringSet(string(api.ServiceAffinityClientIP), string(api.ServiceAffinityNone))
// ValidateService tests if required fields in the service are set. // ValidateService tests if required fields in the service are set.
func ValidateService(service *api.Service) errs.ValidationErrorList { func ValidateService(service *api.Service) errs.ValidationErrorList {
......
...@@ -228,7 +228,7 @@ func TestValidatePersistentVolumes(t *testing.T) { ...@@ -228,7 +228,7 @@ func TestValidatePersistentVolumes(t *testing.T) {
Capacity: api.ResourceList{ Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
}, },
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: "/foo"}, HostPath: &api.HostPathVolumeSource{Path: "/foo"},
}, },
...@@ -240,7 +240,7 @@ func TestValidatePersistentVolumes(t *testing.T) { ...@@ -240,7 +240,7 @@ func TestValidatePersistentVolumes(t *testing.T) {
Capacity: api.ResourceList{ Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
}, },
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: "/foo"}, HostPath: &api.HostPathVolumeSource{Path: "/foo"},
}, },
...@@ -252,7 +252,7 @@ func TestValidatePersistentVolumes(t *testing.T) { ...@@ -252,7 +252,7 @@ func TestValidatePersistentVolumes(t *testing.T) {
Capacity: api.ResourceList{ Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
}, },
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: "/foo"}, HostPath: &api.HostPathVolumeSource{Path: "/foo"},
}, },
...@@ -264,7 +264,7 @@ func TestValidatePersistentVolumes(t *testing.T) { ...@@ -264,7 +264,7 @@ func TestValidatePersistentVolumes(t *testing.T) {
Capacity: api.ResourceList{ Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
}, },
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
}), }),
}, },
"missing-capacity": { "missing-capacity": {
...@@ -324,7 +324,7 @@ func TestValidatePersistentVolumeClaim(t *testing.T) { ...@@ -324,7 +324,7 @@ func TestValidatePersistentVolumeClaim(t *testing.T) {
"good-claim": { "good-claim": {
isExpectedFailure: false, isExpectedFailure: false,
claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -338,7 +338,7 @@ func TestValidatePersistentVolumeClaim(t *testing.T) { ...@@ -338,7 +338,7 @@ func TestValidatePersistentVolumeClaim(t *testing.T) {
"missing-namespace": { "missing-namespace": {
isExpectedFailure: true, isExpectedFailure: true,
claim: testVolumeClaim("foo", "", api.PersistentVolumeClaimSpec{ claim: testVolumeClaim("foo", "", api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -362,7 +362,7 @@ func TestValidatePersistentVolumeClaim(t *testing.T) { ...@@ -362,7 +362,7 @@ func TestValidatePersistentVolumeClaim(t *testing.T) {
"no-resource-requests": { "no-resource-requests": {
isExpectedFailure: true, isExpectedFailure: true,
claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
}, },
}), }),
...@@ -370,7 +370,7 @@ func TestValidatePersistentVolumeClaim(t *testing.T) { ...@@ -370,7 +370,7 @@ func TestValidatePersistentVolumeClaim(t *testing.T) {
"invalid-resource-requests": { "invalid-resource-requests": {
isExpectedFailure: true, isExpectedFailure: true,
claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{ claim: testVolumeClaim("foo", "ns", api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
}, },
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
...@@ -3175,8 +3175,8 @@ func TestValidateSecurityContext(t *testing.T) { ...@@ -3175,8 +3175,8 @@ func TestValidateSecurityContext(t *testing.T) {
return &api.SecurityContext{ return &api.SecurityContext{
Privileged: &priv, Privileged: &priv,
Capabilities: &api.Capabilities{ Capabilities: &api.Capabilities{
Add: []api.CapabilityType{"foo"}, Add: []api.Capability{"foo"},
Drop: []api.CapabilityType{"bar"}, Drop: []api.Capability{"bar"},
}, },
SELinuxOptions: &api.SELinuxOptions{ SELinuxOptions: &api.SELinuxOptions{
User: "user", User: "user",
......
...@@ -41,7 +41,7 @@ func TestPersistentVolumeClaimCreate(t *testing.T) { ...@@ -41,7 +41,7 @@ func TestPersistentVolumeClaimCreate(t *testing.T) {
Name: "abc", Name: "abc",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -75,7 +75,7 @@ func TestPersistentVolumeClaimGet(t *testing.T) { ...@@ -75,7 +75,7 @@ func TestPersistentVolumeClaimGet(t *testing.T) {
Namespace: "foo", Namespace: "foo",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -130,7 +130,7 @@ func TestPersistentVolumeClaimUpdate(t *testing.T) { ...@@ -130,7 +130,7 @@ func TestPersistentVolumeClaimUpdate(t *testing.T) {
ResourceVersion: "1", ResourceVersion: "1",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -157,7 +157,7 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) { ...@@ -157,7 +157,7 @@ func TestPersistentVolumeClaimStatusUpdate(t *testing.T) {
ResourceVersion: "1", ResourceVersion: "1",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
......
...@@ -63,7 +63,7 @@ type TCPLoadBalancer interface { ...@@ -63,7 +63,7 @@ type TCPLoadBalancer interface {
// if so, what its IP address or hostname is. // if so, what its IP address or hostname is.
GetTCPLoadBalancer(name, region string) (endpoint string, exists bool, err error) GetTCPLoadBalancer(name, region string) (endpoint string, exists bool, err error)
// CreateTCPLoadBalancer creates a new tcp load balancer. Returns the IP address or hostname of the balancer // CreateTCPLoadBalancer creates a new tcp load balancer. Returns the IP address or hostname of the balancer
CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.AffinityType) (string, error) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.ServiceAffinity) (string, error)
// UpdateTCPLoadBalancer updates hosts under the specified load balancer. // UpdateTCPLoadBalancer updates hosts under the specified load balancer.
UpdateTCPLoadBalancer(name, region string, hosts []string) error UpdateTCPLoadBalancer(name, region string, hosts []string) error
// DeleteTCPLoadBalancer deletes a specified load balancer. // DeleteTCPLoadBalancer deletes a specified load balancer.
......
...@@ -101,7 +101,7 @@ func (f *FakeCloud) GetTCPLoadBalancer(name, region string) (endpoint string, ex ...@@ -101,7 +101,7 @@ func (f *FakeCloud) GetTCPLoadBalancer(name, region string) (endpoint string, ex
// CreateTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.CreateTCPLoadBalancer. // CreateTCPLoadBalancer is a test-spy implementation of TCPLoadBalancer.CreateTCPLoadBalancer.
// It adds an entry "create" into the internal method call record. // It adds an entry "create" into the internal method call record.
func (f *FakeCloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.AffinityType) (string, error) { func (f *FakeCloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.ServiceAffinity) (string, error) {
f.addCall("create") f.addCall("create")
f.Balancers = append(f.Balancers, FakeBalancer{name, region, externalIP, ports, hosts}) f.Balancers = append(f.Balancers, FakeBalancer{name, region, externalIP, ports, hosts})
return f.ExternalIP.String(), f.Err return f.ExternalIP.String(), f.Err
......
...@@ -294,11 +294,11 @@ func isHTTPErrorCode(err error, code int) bool { ...@@ -294,11 +294,11 @@ func isHTTPErrorCode(err error, code int) bool {
} }
// translate from what K8s supports to what the cloud provider supports for session affinity. // translate from what K8s supports to what the cloud provider supports for session affinity.
func translateAffinityType(affinityType api.AffinityType) GCEAffinityType { func translateAffinityType(affinityType api.ServiceAffinity) GCEAffinityType {
switch affinityType { switch affinityType {
case api.AffinityTypeClientIP: case api.ServiceAffinityClientIP:
return GCEAffinityTypeClientIP return GCEAffinityTypeClientIP
case api.AffinityTypeNone: case api.ServiceAffinityNone:
return GCEAffinityTypeNone return GCEAffinityTypeNone
default: default:
glog.Errorf("unexpected affinity type: %v", affinityType) glog.Errorf("unexpected affinity type: %v", affinityType)
...@@ -309,7 +309,7 @@ func translateAffinityType(affinityType api.AffinityType) GCEAffinityType { ...@@ -309,7 +309,7 @@ func translateAffinityType(affinityType api.AffinityType) GCEAffinityType {
// CreateTCPLoadBalancer is an implementation of TCPLoadBalancer.CreateTCPLoadBalancer. // CreateTCPLoadBalancer is an implementation of TCPLoadBalancer.CreateTCPLoadBalancer.
// TODO(a-robinson): Don't just ignore specified IP addresses. Check if they're // TODO(a-robinson): Don't just ignore specified IP addresses. Check if they're
// owned by the project and available to be used, and use them if they are. // owned by the project and available to be used, and use them if they are.
func (gce *GCECloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.AffinityType) (string, error) { func (gce *GCECloud) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinityType api.ServiceAffinity) (string, error) {
err := gce.makeTargetPool(name, region, hosts, translateAffinityType(affinityType)) err := gce.makeTargetPool(name, region, hosts, translateAffinityType(affinityType))
if err != nil { if err != nil {
if !isHTTPErrorCode(err, http.StatusConflict) { if !isHTTPErrorCode(err, http.StatusConflict) {
......
...@@ -480,7 +480,7 @@ func (lb *LoadBalancer) GetTCPLoadBalancer(name, region string) (endpoint string ...@@ -480,7 +480,7 @@ func (lb *LoadBalancer) GetTCPLoadBalancer(name, region string) (endpoint string
// a list of regions (from config) and query/create loadbalancers in // a list of regions (from config) and query/create loadbalancers in
// each region. // each region.
func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinity api.AffinityType) (string, error) { func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP net.IP, ports []int, hosts []string, affinity api.ServiceAffinity) (string, error) {
glog.V(4).Infof("CreateTCPLoadBalancer(%v, %v, %v, %v, %v, %v)", name, region, externalIP, ports, hosts, affinity) glog.V(4).Infof("CreateTCPLoadBalancer(%v, %v, %v, %v, %v, %v)", name, region, externalIP, ports, hosts, affinity)
if len(ports) > 1 { if len(ports) > 1 {
...@@ -489,9 +489,9 @@ func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP ne ...@@ -489,9 +489,9 @@ func (lb *LoadBalancer) CreateTCPLoadBalancer(name, region string, externalIP ne
var persistence *vips.SessionPersistence var persistence *vips.SessionPersistence
switch affinity { switch affinity {
case api.AffinityTypeNone: case api.ServiceAffinityNone:
persistence = nil persistence = nil
case api.AffinityTypeClientIP: case api.ServiceAffinityClientIP:
persistence = &vips.SessionPersistence{Type: "SOURCE_IP"} persistence = &vips.SessionPersistence{Type: "SOURCE_IP"}
default: default:
return "", fmt.Errorf("unsupported load balancer affinity: %v", affinity) return "", fmt.Errorf("unsupported load balancer affinity: %v", affinity)
......
...@@ -116,10 +116,10 @@ func getAllCapabilities() string { ...@@ -116,10 +116,10 @@ func getAllCapabilities() string {
return strings.Join(capabilities, ",") return strings.Join(capabilities, ",")
} }
// TODO(yifan): This assumes that api.CapabilityType has the form of // TODO(yifan): This assumes that api.Capability has the form of
// "CAP_SYS_ADMIN". We need to have a formal definition for // "CAP_SYS_ADMIN". We need to have a formal definition for
// capabilities. // capabilities.
func getCapabilities(caps []api.CapabilityType) string { func getCapabilities(caps []api.Capability) string {
var capList []string var capList []string
for _, cap := range caps { for _, cap := range caps {
capList = append(capList, fmt.Sprintf("%q", cap)) capList = append(capList, fmt.Sprintf("%q", cap))
......
...@@ -181,7 +181,7 @@ func (c *Controller) CreateMasterServiceIfNeeded(serviceName string, serviceIP n ...@@ -181,7 +181,7 @@ func (c *Controller) CreateMasterServiceIfNeeded(serviceName string, serviceIP n
// maintained by this code, not by the pod selector // maintained by this code, not by the pod selector
Selector: nil, Selector: nil,
PortalIP: serviceIP.String(), PortalIP: serviceIP.String(),
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
}, },
} }
_, err := c.ServiceRegistry.CreateService(ctx, svc) _, err := c.ServiceRegistry.CreateService(ctx, svc)
......
...@@ -29,7 +29,7 @@ type LoadBalancer interface { ...@@ -29,7 +29,7 @@ type LoadBalancer interface {
// NextEndpoint returns the endpoint to handle a request for the given // NextEndpoint returns the endpoint to handle a request for the given
// service-port and source address. // service-port and source address.
NextEndpoint(service ServicePortName, srcAddr net.Addr) (string, error) NextEndpoint(service ServicePortName, srcAddr net.Addr) (string, error)
NewService(service ServicePortName, sessionAffinityType api.AffinityType, stickyMaxAgeMinutes int) error NewService(service ServicePortName, sessionAffinityType api.ServiceAffinity, stickyMaxAgeMinutes int) error
CleanupStaleStickySessions(service ServicePortName) CleanupStaleStickySessions(service ServicePortName)
} }
......
...@@ -41,7 +41,7 @@ type serviceInfo struct { ...@@ -41,7 +41,7 @@ type serviceInfo struct {
socket proxySocket socket proxySocket
timeout time.Duration timeout time.Duration
publicIPs []string // TODO: make this net.IP publicIPs []string // TODO: make this net.IP
sessionAffinityType api.AffinityType sessionAffinityType api.ServiceAffinity
stickyMaxAgeMinutes int stickyMaxAgeMinutes int
} }
...@@ -208,8 +208,8 @@ func (proxier *Proxier) addServiceOnPort(service ServicePortName, protocol api.P ...@@ -208,8 +208,8 @@ func (proxier *Proxier) addServiceOnPort(service ServicePortName, protocol api.P
protocol: protocol, protocol: protocol,
socket: sock, socket: sock,
timeout: timeout, timeout: timeout,
sessionAffinityType: api.AffinityTypeNone, // default sessionAffinityType: api.ServiceAffinityNone, // default
stickyMaxAgeMinutes: 180, // TODO: paramaterize this in the API. stickyMaxAgeMinutes: 180, // TODO: paramaterize this in the API.
} }
proxier.setServiceInfo(service, si) proxier.setServiceInfo(service, si)
......
...@@ -45,7 +45,7 @@ type affinityState struct { ...@@ -45,7 +45,7 @@ type affinityState struct {
} }
type affinityPolicy struct { type affinityPolicy struct {
affinityType api.AffinityType affinityType api.ServiceAffinity
affinityMap map[string]*affinityState // map client IP -> affinity info affinityMap map[string]*affinityState // map client IP -> affinity info
ttlMinutes int ttlMinutes int
} }
...@@ -65,7 +65,7 @@ type balancerState struct { ...@@ -65,7 +65,7 @@ type balancerState struct {
affinity affinityPolicy affinity affinityPolicy
} }
func newAffinityPolicy(affinityType api.AffinityType, ttlMinutes int) *affinityPolicy { func newAffinityPolicy(affinityType api.ServiceAffinity, ttlMinutes int) *affinityPolicy {
return &affinityPolicy{ return &affinityPolicy{
affinityType: affinityType, affinityType: affinityType,
affinityMap: make(map[string]*affinityState), affinityMap: make(map[string]*affinityState),
...@@ -80,7 +80,7 @@ func NewLoadBalancerRR() *LoadBalancerRR { ...@@ -80,7 +80,7 @@ func NewLoadBalancerRR() *LoadBalancerRR {
} }
} }
func (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.AffinityType, ttlMinutes int) error { func (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.ServiceAffinity, ttlMinutes int) error {
lb.lock.Lock() lb.lock.Lock()
defer lb.lock.Unlock() defer lb.lock.Unlock()
lb.newServiceInternal(svcPort, affinityType, ttlMinutes) lb.newServiceInternal(svcPort, affinityType, ttlMinutes)
...@@ -88,7 +88,7 @@ func (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.A ...@@ -88,7 +88,7 @@ func (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.A
} }
// This assumes that lb.lock is already held. // This assumes that lb.lock is already held.
func (lb *LoadBalancerRR) newServiceInternal(svcPort ServicePortName, affinityType api.AffinityType, ttlMinutes int) *balancerState { func (lb *LoadBalancerRR) newServiceInternal(svcPort ServicePortName, affinityType api.ServiceAffinity, ttlMinutes int) *balancerState {
if ttlMinutes == 0 { if ttlMinutes == 0 {
ttlMinutes = 180 //default to 3 hours if not specified. Should 0 be unlimeted instead???? ttlMinutes = 180 //default to 3 hours if not specified. Should 0 be unlimeted instead????
} }
...@@ -103,7 +103,7 @@ func (lb *LoadBalancerRR) newServiceInternal(svcPort ServicePortName, affinityTy ...@@ -103,7 +103,7 @@ func (lb *LoadBalancerRR) newServiceInternal(svcPort ServicePortName, affinityTy
// return true if this service is using some form of session affinity. // return true if this service is using some form of session affinity.
func isSessionAffinity(affinity *affinityPolicy) bool { func isSessionAffinity(affinity *affinityPolicy) bool {
// Should never be empty string, but checking for it to be safe. // Should never be empty string, but checking for it to be safe.
if affinity.affinityType == "" || affinity.affinityType == api.AffinityTypeNone { if affinity.affinityType == "" || affinity.affinityType == api.ServiceAffinityNone {
return false return false
} }
return true return true
...@@ -262,7 +262,7 @@ func (lb *LoadBalancerRR) OnUpdate(allEndpoints []api.Endpoints) { ...@@ -262,7 +262,7 @@ func (lb *LoadBalancerRR) OnUpdate(allEndpoints []api.Endpoints) {
// OnUpdate can be called without NewService being called externally. // OnUpdate can be called without NewService being called externally.
// To be safe we will call it here. A new service will only be created // To be safe we will call it here. A new service will only be created
// if one does not already exist. // if one does not already exist.
state = lb.newServiceInternal(svcPort, api.AffinityTypeNone, 0) state = lb.newServiceInternal(svcPort, api.ServiceAffinityNone, 0)
state.endpoints = slice.ShuffleStrings(newEndpoints) state.endpoints = slice.ShuffleStrings(newEndpoints)
// Reset the round-robin index. // Reset the round-robin index.
......
...@@ -351,7 +351,7 @@ func TestStickyLoadBalanceWorksWithSingleEndpoint(t *testing.T) { ...@@ -351,7 +351,7 @@ func TestStickyLoadBalanceWorksWithSingleEndpoint(t *testing.T) {
if err == nil || len(endpoint) != 0 { if err == nil || len(endpoint) != 0 {
t.Errorf("Didn't fail with non-existent service") t.Errorf("Didn't fail with non-existent service")
} }
loadBalancer.NewService(service, api.AffinityTypeClientIP, 0) loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0)
endpoints := make([]api.Endpoints, 1) endpoints := make([]api.Endpoints, 1)
endpoints[0] = api.Endpoints{ endpoints[0] = api.Endpoints{
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
...@@ -375,7 +375,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpoints(t *testing.T) { ...@@ -375,7 +375,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpoints(t *testing.T) {
t.Errorf("Didn't fail with non-existent service") t.Errorf("Didn't fail with non-existent service")
} }
loadBalancer.NewService(service, api.AffinityTypeClientIP, 0) loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0)
endpoints := make([]api.Endpoints, 1) endpoints := make([]api.Endpoints, 1)
endpoints[0] = api.Endpoints{ endpoints[0] = api.Endpoints{
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
...@@ -409,7 +409,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpointsStickyNone(t *testing.T) { ...@@ -409,7 +409,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpointsStickyNone(t *testing.T) {
t.Errorf("Didn't fail with non-existent service") t.Errorf("Didn't fail with non-existent service")
} }
loadBalancer.NewService(service, api.AffinityTypeNone, 0) loadBalancer.NewService(service, api.ServiceAffinityNone, 0)
endpoints := make([]api.Endpoints, 1) endpoints := make([]api.Endpoints, 1)
endpoints[0] = api.Endpoints{ endpoints[0] = api.Endpoints{
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
...@@ -447,7 +447,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpointsRemoveOne(t *testing.T) { ...@@ -447,7 +447,7 @@ func TestStickyLoadBalanaceWorksWithMultipleEndpointsRemoveOne(t *testing.T) {
t.Errorf("Didn't fail with non-existent service") t.Errorf("Didn't fail with non-existent service")
} }
loadBalancer.NewService(service, api.AffinityTypeClientIP, 0) loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0)
endpoints := make([]api.Endpoints, 1) endpoints := make([]api.Endpoints, 1)
endpoints[0] = api.Endpoints{ endpoints[0] = api.Endpoints{
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
...@@ -521,7 +521,7 @@ func TestStickyLoadBalanceWorksWithMultipleEndpointsAndUpdates(t *testing.T) { ...@@ -521,7 +521,7 @@ func TestStickyLoadBalanceWorksWithMultipleEndpointsAndUpdates(t *testing.T) {
t.Errorf("Didn't fail with non-existent service") t.Errorf("Didn't fail with non-existent service")
} }
loadBalancer.NewService(service, api.AffinityTypeClientIP, 0) loadBalancer.NewService(service, api.ServiceAffinityClientIP, 0)
endpoints := make([]api.Endpoints, 1) endpoints := make([]api.Endpoints, 1)
endpoints[0] = api.Endpoints{ endpoints[0] = api.Endpoints{
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
...@@ -581,7 +581,7 @@ func TestStickyLoadBalanceWorksWithServiceRemoval(t *testing.T) { ...@@ -581,7 +581,7 @@ func TestStickyLoadBalanceWorksWithServiceRemoval(t *testing.T) {
if err == nil || len(endpoint) != 0 { if err == nil || len(endpoint) != 0 {
t.Errorf("Didn't fail with non-existent service") t.Errorf("Didn't fail with non-existent service")
} }
loadBalancer.NewService(fooService, api.AffinityTypeClientIP, 0) loadBalancer.NewService(fooService, api.ServiceAffinityClientIP, 0)
endpoints := make([]api.Endpoints, 2) endpoints := make([]api.Endpoints, 2)
endpoints[0] = api.Endpoints{ endpoints[0] = api.Endpoints{
ObjectMeta: api.ObjectMeta{Name: fooService.Name, Namespace: fooService.Namespace}, ObjectMeta: api.ObjectMeta{Name: fooService.Name, Namespace: fooService.Namespace},
...@@ -593,7 +593,7 @@ func TestStickyLoadBalanceWorksWithServiceRemoval(t *testing.T) { ...@@ -593,7 +593,7 @@ func TestStickyLoadBalanceWorksWithServiceRemoval(t *testing.T) {
}, },
} }
barService := ServicePortName{types.NamespacedName{"testnamespace", "bar"}, ""} barService := ServicePortName{types.NamespacedName{"testnamespace", "bar"}, ""}
loadBalancer.NewService(barService, api.AffinityTypeClientIP, 0) loadBalancer.NewService(barService, api.ServiceAffinityClientIP, 0)
endpoints[1] = api.Endpoints{ endpoints[1] = api.Endpoints{
ObjectMeta: api.ObjectMeta{Name: barService.Name, Namespace: barService.Namespace}, ObjectMeta: api.ObjectMeta{Name: barService.Name, Namespace: barService.Namespace},
Subsets: []api.EndpointSubset{ Subsets: []api.EndpointSubset{
......
...@@ -55,7 +55,7 @@ func validNewPersistentVolume(name string) *api.PersistentVolume { ...@@ -55,7 +55,7 @@ func validNewPersistentVolume(name string) *api.PersistentVolume {
Capacity: api.ResourceList{ Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
}, },
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: "/foo"}, HostPath: &api.HostPathVolumeSource{Path: "/foo"},
}, },
......
...@@ -53,7 +53,7 @@ func validNewPersistentVolumeClaim(name, ns string) *api.PersistentVolumeClaim { ...@@ -53,7 +53,7 @@ func validNewPersistentVolumeClaim(name, ns string) *api.PersistentVolumeClaim {
Namespace: ns, Namespace: ns,
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("10G"), api.ResourceName(api.ResourceStorage): resource.MustParse("10G"),
...@@ -334,7 +334,7 @@ func TestEtcdUpdateStatus(t *testing.T) { ...@@ -334,7 +334,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
ResourceVersion: "1", ResourceVersion: "1",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("3Gi"), api.ResourceName(api.ResourceStorage): resource.MustParse("3Gi"),
......
...@@ -67,7 +67,7 @@ func TestServiceRegistryCreate(t *testing.T) { ...@@ -67,7 +67,7 @@ func TestServiceRegistryCreate(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo"}, ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -108,7 +108,7 @@ func TestServiceStorageValidatesCreate(t *testing.T) { ...@@ -108,7 +108,7 @@ func TestServiceStorageValidatesCreate(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: ""}, ObjectMeta: api.ObjectMeta{Name: ""},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -119,7 +119,7 @@ func TestServiceStorageValidatesCreate(t *testing.T) { ...@@ -119,7 +119,7 @@ func TestServiceStorageValidatesCreate(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo"}, ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
}}, }},
...@@ -161,7 +161,7 @@ func TestServiceRegistryUpdate(t *testing.T) { ...@@ -161,7 +161,7 @@ func TestServiceRegistryUpdate(t *testing.T) {
ResourceVersion: svc.ResourceVersion}, ResourceVersion: svc.ResourceVersion},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz2"}, Selector: map[string]string{"bar": "baz2"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -204,7 +204,7 @@ func TestServiceStorageValidatesUpdate(t *testing.T) { ...@@ -204,7 +204,7 @@ func TestServiceStorageValidatesUpdate(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: ""}, ObjectMeta: api.ObjectMeta{Name: ""},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -215,7 +215,7 @@ func TestServiceStorageValidatesUpdate(t *testing.T) { ...@@ -215,7 +215,7 @@ func TestServiceStorageValidatesUpdate(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo"}, ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"ThisSelectorFailsValidation": "ok"}, Selector: map[string]string{"ThisSelectorFailsValidation": "ok"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -242,7 +242,7 @@ func TestServiceRegistryExternalService(t *testing.T) { ...@@ -242,7 +242,7 @@ func TestServiceRegistryExternalService(t *testing.T) {
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
CreateExternalLoadBalancer: true, CreateExternalLoadBalancer: true,
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -269,7 +269,7 @@ func TestServiceRegistryDelete(t *testing.T) { ...@@ -269,7 +269,7 @@ func TestServiceRegistryDelete(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo"}, ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -291,7 +291,7 @@ func TestServiceRegistryDeleteExternal(t *testing.T) { ...@@ -291,7 +291,7 @@ func TestServiceRegistryDeleteExternal(t *testing.T) {
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
CreateExternalLoadBalancer: true, CreateExternalLoadBalancer: true,
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -315,7 +315,7 @@ func TestServiceRegistryUpdateExternalService(t *testing.T) { ...@@ -315,7 +315,7 @@ func TestServiceRegistryUpdateExternalService(t *testing.T) {
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
CreateExternalLoadBalancer: false, CreateExternalLoadBalancer: false,
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -351,7 +351,7 @@ func TestServiceRegistryUpdateMultiPortExternalService(t *testing.T) { ...@@ -351,7 +351,7 @@ func TestServiceRegistryUpdateMultiPortExternalService(t *testing.T) {
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
CreateExternalLoadBalancer: true, CreateExternalLoadBalancer: true,
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Name: "p", Name: "p",
Port: 6502, Port: 6502,
...@@ -490,7 +490,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) { ...@@ -490,7 +490,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo"}, ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -511,7 +511,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) { ...@@ -511,7 +511,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "bar"}, ObjectMeta: api.ObjectMeta{Name: "bar"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -540,7 +540,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) { ...@@ -540,7 +540,7 @@ func TestServiceRegistryIPAllocation(t *testing.T) {
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
PortalIP: testIP, PortalIP: testIP,
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -565,7 +565,7 @@ func TestServiceRegistryIPReallocation(t *testing.T) { ...@@ -565,7 +565,7 @@ func TestServiceRegistryIPReallocation(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo"}, ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -588,7 +588,7 @@ func TestServiceRegistryIPReallocation(t *testing.T) { ...@@ -588,7 +588,7 @@ func TestServiceRegistryIPReallocation(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "bar"}, ObjectMeta: api.ObjectMeta{Name: "bar"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -613,7 +613,7 @@ func TestServiceRegistryIPUpdate(t *testing.T) { ...@@ -613,7 +613,7 @@ func TestServiceRegistryIPUpdate(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"}, ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
...@@ -657,7 +657,7 @@ func TestServiceRegistryIPExternalLoadBalancer(t *testing.T) { ...@@ -657,7 +657,7 @@ func TestServiceRegistryIPExternalLoadBalancer(t *testing.T) {
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Selector: map[string]string{"bar": "baz"}, Selector: map[string]string{"bar": "baz"},
CreateExternalLoadBalancer: true, CreateExternalLoadBalancer: true,
SessionAffinity: api.AffinityTypeNone, SessionAffinity: api.ServiceAffinityNone,
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Port: 6502, Port: 6502,
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
......
...@@ -81,8 +81,8 @@ func modifySecurityOption(config []string, name, value string) []string { ...@@ -81,8 +81,8 @@ func modifySecurityOption(config []string, name, value string) []string {
return config return config
} }
// makeCapabilites creates string slices from CapabilityType slices // makeCapabilites creates string slices from Capability slices
func makeCapabilites(capAdd []api.CapabilityType, capDrop []api.CapabilityType) ([]string, []string) { func makeCapabilites(capAdd []api.Capability, capDrop []api.Capability) ([]string, []string) {
var ( var (
addCaps []string addCaps []string
dropCaps []string dropCaps []string
......
...@@ -154,8 +154,8 @@ func fullValidSecurityContext() *api.SecurityContext { ...@@ -154,8 +154,8 @@ func fullValidSecurityContext() *api.SecurityContext {
return &api.SecurityContext{ return &api.SecurityContext{
Privileged: &priv, Privileged: &priv,
Capabilities: &api.Capabilities{ Capabilities: &api.Capabilities{
Add: []api.CapabilityType{"addCapA", "addCapB"}, Add: []api.Capability{"addCapA", "addCapB"},
Drop: []api.CapabilityType{"dropCapA", "dropCapB"}, Drop: []api.Capability{"dropCapA", "dropCapB"},
}, },
SELinuxOptions: &api.SELinuxOptions{ SELinuxOptions: &api.SELinuxOptions{
User: "user", User: "user",
......
...@@ -62,8 +62,8 @@ func (plugin *awsElasticBlockStorePlugin) CanSupport(spec *volume.Spec) bool { ...@@ -62,8 +62,8 @@ func (plugin *awsElasticBlockStorePlugin) CanSupport(spec *volume.Spec) bool {
return spec.PersistentVolumeSource.AWSElasticBlockStore != nil || spec.VolumeSource.AWSElasticBlockStore != nil return spec.PersistentVolumeSource.AWSElasticBlockStore != nil || spec.VolumeSource.AWSElasticBlockStore != nil
} }
func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []api.AccessModeType { func (plugin *awsElasticBlockStorePlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.AccessModeType{ return []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
} }
} }
......
...@@ -58,7 +58,7 @@ func TestGetAccessModes(t *testing.T) { ...@@ -58,7 +58,7 @@ func TestGetAccessModes(t *testing.T) {
} }
} }
func contains(modes []api.AccessModeType, mode api.AccessModeType) bool { func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
......
...@@ -80,7 +80,7 @@ func (plugin *emptyDirPlugin) newBuilderInternal(spec *volume.Spec, pod *api.Pod ...@@ -80,7 +80,7 @@ func (plugin *emptyDirPlugin) newBuilderInternal(spec *volume.Spec, pod *api.Pod
// Legacy mode instances can be cleaned up but not created anew. // Legacy mode instances can be cleaned up but not created anew.
return nil, fmt.Errorf("legacy mode: can not create new instances") return nil, fmt.Errorf("legacy mode: can not create new instances")
} }
medium := api.StorageTypeDefault medium := api.StorageMediumDefault
if spec.VolumeSource.EmptyDir != nil { // Support a non-specified source as EmptyDir. if spec.VolumeSource.EmptyDir != nil { // Support a non-specified source as EmptyDir.
medium = spec.VolumeSource.EmptyDir.Medium medium = spec.VolumeSource.EmptyDir.Medium
} }
...@@ -109,7 +109,7 @@ func (plugin *emptyDirPlugin) newCleanerInternal(volName string, podUID types.UI ...@@ -109,7 +109,7 @@ func (plugin *emptyDirPlugin) newCleanerInternal(volName string, podUID types.UI
ed := &emptyDir{ ed := &emptyDir{
podUID: podUID, podUID: podUID,
volName: volName, volName: volName,
medium: api.StorageTypeDefault, // might be changed later medium: api.StorageMediumDefault, // might be changed later
mounter: mounter, mounter: mounter,
mountDetector: mountDetector, mountDetector: mountDetector,
plugin: plugin, plugin: plugin,
...@@ -140,7 +140,7 @@ const ( ...@@ -140,7 +140,7 @@ const (
type emptyDir struct { type emptyDir struct {
podUID types.UID podUID types.UID
volName string volName string
medium api.StorageType medium api.StorageMedium
mounter mount.Interface mounter mount.Interface
mountDetector mountDetector mountDetector mountDetector
plugin *emptyDirPlugin plugin *emptyDirPlugin
...@@ -159,9 +159,9 @@ func (ed *emptyDir) SetUpAt(dir string) error { ...@@ -159,9 +159,9 @@ func (ed *emptyDir) SetUpAt(dir string) error {
return fmt.Errorf("legacy mode: can not create new instances") return fmt.Errorf("legacy mode: can not create new instances")
} }
switch ed.medium { switch ed.medium {
case api.StorageTypeDefault: case api.StorageMediumDefault:
return ed.setupDefault(dir) return ed.setupDefault(dir)
case api.StorageTypeMemory: case api.StorageMediumMemory:
return ed.setupTmpfs(dir) return ed.setupTmpfs(dir)
default: default:
return fmt.Errorf("unknown storage medium %q", ed.medium) return fmt.Errorf("unknown storage medium %q", ed.medium)
...@@ -231,10 +231,10 @@ func (ed *emptyDir) TearDownAt(dir string) error { ...@@ -231,10 +231,10 @@ func (ed *emptyDir) TearDownAt(dir string) error {
return err return err
} }
if isMnt && medium == mediumMemory { if isMnt && medium == mediumMemory {
ed.medium = api.StorageTypeMemory ed.medium = api.StorageMediumMemory
return ed.teardownTmpfs(dir) return ed.teardownTmpfs(dir)
} }
// assume StorageTypeDefault // assume StorageMediumDefault
return ed.teardownDefault(dir) return ed.teardownDefault(dir)
} }
......
...@@ -70,7 +70,7 @@ func TestPlugin(t *testing.T) { ...@@ -70,7 +70,7 @@ func TestPlugin(t *testing.T) {
spec := &api.Volume{ spec := &api.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeDefault}}, VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumDefault}},
} }
mounter := mount.FakeMounter{} mounter := mount.FakeMounter{}
mountDetector := fakeMountDetector{} mountDetector := fakeMountDetector{}
...@@ -130,7 +130,7 @@ func TestPluginTmpfs(t *testing.T) { ...@@ -130,7 +130,7 @@ func TestPluginTmpfs(t *testing.T) {
spec := &api.Volume{ spec := &api.Volume{
Name: "vol1", Name: "vol1",
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeMemory}}, VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory}},
} }
mounter := mount.FakeMounter{} mounter := mount.FakeMounter{}
mountDetector := fakeMountDetector{} mountDetector := fakeMountDetector{}
......
...@@ -68,8 +68,8 @@ func (plugin *gcePersistentDiskPlugin) CanSupport(spec *volume.Spec) bool { ...@@ -68,8 +68,8 @@ func (plugin *gcePersistentDiskPlugin) CanSupport(spec *volume.Spec) bool {
return spec.VolumeSource.GCEPersistentDisk != nil || spec.PersistentVolumeSource.GCEPersistentDisk != nil return spec.VolumeSource.GCEPersistentDisk != nil || spec.PersistentVolumeSource.GCEPersistentDisk != nil
} }
func (plugin *gcePersistentDiskPlugin) GetAccessModes() []api.AccessModeType { func (plugin *gcePersistentDiskPlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.AccessModeType{ return []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
} }
......
...@@ -55,7 +55,7 @@ func TestGetAccessModes(t *testing.T) { ...@@ -55,7 +55,7 @@ func TestGetAccessModes(t *testing.T) {
} }
} }
func contains(modes []api.AccessModeType, mode api.AccessModeType) bool { func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
......
...@@ -56,8 +56,8 @@ func (plugin *glusterfsPlugin) CanSupport(spec *volume.Spec) bool { ...@@ -56,8 +56,8 @@ func (plugin *glusterfsPlugin) CanSupport(spec *volume.Spec) bool {
return spec.VolumeSource.Glusterfs != nil || spec.PersistentVolumeSource.Glusterfs != nil return spec.VolumeSource.Glusterfs != nil || spec.PersistentVolumeSource.Glusterfs != nil
} }
func (plugin *glusterfsPlugin) GetAccessModes() []api.AccessModeType { func (plugin *glusterfsPlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.AccessModeType{ return []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
api.ReadWriteMany, api.ReadWriteMany,
......
...@@ -58,7 +58,7 @@ func TestGetAccessModes(t *testing.T) { ...@@ -58,7 +58,7 @@ func TestGetAccessModes(t *testing.T) {
} }
} }
func contains(modes []api.AccessModeType, mode api.AccessModeType) bool { func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
......
...@@ -52,8 +52,8 @@ func (plugin *hostPathPlugin) CanSupport(spec *volume.Spec) bool { ...@@ -52,8 +52,8 @@ func (plugin *hostPathPlugin) CanSupport(spec *volume.Spec) bool {
return spec.VolumeSource.HostPath != nil || spec.PersistentVolumeSource.HostPath != nil return spec.VolumeSource.HostPath != nil || spec.PersistentVolumeSource.HostPath != nil
} }
func (plugin *hostPathPlugin) GetAccessModes() []api.AccessModeType { func (plugin *hostPathPlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.AccessModeType{ return []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
} }
} }
......
...@@ -52,7 +52,7 @@ func TestGetAccessModes(t *testing.T) { ...@@ -52,7 +52,7 @@ func TestGetAccessModes(t *testing.T) {
t.Errorf("Can't find the plugin by name") t.Errorf("Can't find the plugin by name")
} }
if len(plug.GetAccessModes()) != 1 || plug.GetAccessModes()[0] != api.ReadWriteOnce { if len(plug.GetAccessModes()) != 1 || plug.GetAccessModes()[0] != api.ReadWriteOnce {
t.Errorf("Expected %s AccessModeType", api.ReadWriteOnce) t.Errorf("Expected %s PersistentVolumeAccessMode", api.ReadWriteOnce)
} }
} }
......
...@@ -65,8 +65,8 @@ func (plugin *ISCSIPlugin) CanSupport(spec *volume.Spec) bool { ...@@ -65,8 +65,8 @@ func (plugin *ISCSIPlugin) CanSupport(spec *volume.Spec) bool {
return false return false
} }
func (plugin *ISCSIPlugin) GetAccessModes() []api.AccessModeType { func (plugin *ISCSIPlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.AccessModeType{ return []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
} }
......
...@@ -55,8 +55,8 @@ func (plugin *nfsPlugin) CanSupport(spec *volume.Spec) bool { ...@@ -55,8 +55,8 @@ func (plugin *nfsPlugin) CanSupport(spec *volume.Spec) bool {
return spec.VolumeSource.NFS != nil return spec.VolumeSource.NFS != nil
} }
func (plugin *nfsPlugin) GetAccessModes() []api.AccessModeType { func (plugin *nfsPlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.AccessModeType{ return []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
api.ReadWriteMany, api.ReadWriteMany,
......
...@@ -57,7 +57,7 @@ func TestGetAccessModes(t *testing.T) { ...@@ -57,7 +57,7 @@ func TestGetAccessModes(t *testing.T) {
} }
} }
func contains(modes []api.AccessModeType, mode api.AccessModeType) bool { func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
......
...@@ -76,7 +76,7 @@ type VolumePlugin interface { ...@@ -76,7 +76,7 @@ type VolumePlugin interface {
type PersistentVolumePlugin interface { type PersistentVolumePlugin interface {
VolumePlugin VolumePlugin
// GetAccessModes describes the ways a given volume can be accessed/mounted. // GetAccessModes describes the ways a given volume can be accessed/mounted.
GetAccessModes() []api.AccessModeType GetAccessModes() []api.PersistentVolumeAccessMode
} }
// VolumeHost is an interface that plugins can use to access the kubelet. // VolumeHost is an interface that plugins can use to access the kubelet.
......
...@@ -89,7 +89,7 @@ func (sv *secretVolume) SetUp() error { ...@@ -89,7 +89,7 @@ func (sv *secretVolume) SetUp() error {
// This is the spec for the volume that this plugin wraps. // This is the spec for the volume that this plugin wraps.
var wrappedVolumeSpec = &volume.Spec{ var wrappedVolumeSpec = &volume.Spec{
Name: "not-used", Name: "not-used",
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageTypeMemory}}, VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory}},
} }
func (sv *secretVolume) SetUpAt(dir string) error { func (sv *secretVolume) SetUpAt(dir string) error {
......
...@@ -104,8 +104,8 @@ func (plugin *FakeVolumePlugin) NewCleaner(volName string, podUID types.UID, mou ...@@ -104,8 +104,8 @@ func (plugin *FakeVolumePlugin) NewCleaner(volName string, podUID types.UID, mou
return &FakeVolume{podUID, volName, plugin}, nil return &FakeVolume{podUID, volName, plugin}, nil
} }
func (plugin *FakeVolumePlugin) GetAccessModes() []api.AccessModeType { func (plugin *FakeVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMode {
return []api.AccessModeType{} return []api.PersistentVolumeAccessMode{}
} }
type FakeVolume struct { type FakeVolume struct {
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
) )
func GetAccessModesAsString(modes []api.AccessModeType) string { func GetAccessModesAsString(modes []api.PersistentVolumeAccessMode) string {
modesAsString := "" modesAsString := ""
if contains(modes, api.ReadWriteOnce) { if contains(modes, api.ReadWriteOnce) {
...@@ -43,7 +43,7 @@ func appendAccessMode(modes *string, mode string) { ...@@ -43,7 +43,7 @@ func appendAccessMode(modes *string, mode string) {
*modes += mode *modes += mode
} }
func contains(modes []api.AccessModeType, mode api.AccessModeType) bool { func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeAccessMode) bool {
for _, m := range modes { for _, m := range modes {
if m == mode { if m == mode {
return true return true
......
...@@ -57,7 +57,7 @@ func TestExampleObjects(t *testing.T) { ...@@ -57,7 +57,7 @@ func TestExampleObjects(t *testing.T) {
"claims/claim-01.yaml": { "claims/claim-01.yaml": {
expected: &api.PersistentVolumeClaim{ expected: &api.PersistentVolumeClaim{
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("3Gi"), api.ResourceName(api.ResourceStorage): resource.MustParse("3Gi"),
...@@ -69,7 +69,7 @@ func TestExampleObjects(t *testing.T) { ...@@ -69,7 +69,7 @@ func TestExampleObjects(t *testing.T) {
"claims/claim-02.yaml": { "claims/claim-02.yaml": {
expected: &api.PersistentVolumeClaim{ expected: &api.PersistentVolumeClaim{
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("8Gi"), api.ResourceName(api.ResourceStorage): resource.MustParse("8Gi"),
...@@ -81,7 +81,7 @@ func TestExampleObjects(t *testing.T) { ...@@ -81,7 +81,7 @@ func TestExampleObjects(t *testing.T) {
"volumes/local-01.yaml": { "volumes/local-01.yaml": {
expected: &api.PersistentVolume{ expected: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: api.PersistentVolumeSpec{
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
Capacity: api.ResourceList{ Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("10Gi"), api.ResourceName(api.ResourceStorage): resource.MustParse("10Gi"),
}, },
...@@ -96,7 +96,7 @@ func TestExampleObjects(t *testing.T) { ...@@ -96,7 +96,7 @@ func TestExampleObjects(t *testing.T) {
"volumes/local-02.yaml": { "volumes/local-02.yaml": {
expected: &api.PersistentVolume{ expected: &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: api.PersistentVolumeSpec{
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
Capacity: api.ResourceList{ Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("5Gi"), api.ResourceName(api.ResourceStorage): resource.MustParse("5Gi"),
}, },
......
...@@ -41,7 +41,7 @@ func TestMatchVolume(t *testing.T) { ...@@ -41,7 +41,7 @@ func TestMatchVolume(t *testing.T) {
Namespace: "myns", Namespace: "myns",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadOnlyMany, api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadOnlyMany, api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("8G"), api.ResourceName(api.ResourceStorage): resource.MustParse("8G"),
...@@ -58,7 +58,7 @@ func TestMatchVolume(t *testing.T) { ...@@ -58,7 +58,7 @@ func TestMatchVolume(t *testing.T) {
Namespace: "myns", Namespace: "myns",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadOnlyMany, api.ReadWriteOnce, api.ReadWriteMany}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadOnlyMany, api.ReadWriteOnce, api.ReadWriteMany},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("5G"), api.ResourceName(api.ResourceStorage): resource.MustParse("5G"),
...@@ -75,7 +75,7 @@ func TestMatchVolume(t *testing.T) { ...@@ -75,7 +75,7 @@ func TestMatchVolume(t *testing.T) {
Namespace: "myns", Namespace: "myns",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadOnlyMany, api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadOnlyMany, api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("1G"), api.ResourceName(api.ResourceStorage): resource.MustParse("1G"),
...@@ -92,7 +92,7 @@ func TestMatchVolume(t *testing.T) { ...@@ -92,7 +92,7 @@ func TestMatchVolume(t *testing.T) {
Namespace: "myns", Namespace: "myns",
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadOnlyMany, api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadOnlyMany, api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("999G"), api.ResourceName(api.ResourceStorage): resource.MustParse("999G"),
...@@ -126,7 +126,7 @@ func TestSort(t *testing.T) { ...@@ -126,7 +126,7 @@ func TestSort(t *testing.T) {
volList.Add(pv) volList.Add(pv)
} }
volumes, err := volList.ListByAccessModes([]api.AccessModeType{api.ReadWriteOnce, api.ReadOnlyMany}) volumes, err := volList.ListByAccessModes([]api.PersistentVolumeAccessMode{api.ReadWriteOnce, api.ReadOnlyMany})
if err != nil { if err != nil {
t.Error("Unexpected error retrieving volumes by access modes:", err) t.Error("Unexpected error retrieving volumes by access modes:", err)
} }
...@@ -137,7 +137,7 @@ func TestSort(t *testing.T) { ...@@ -137,7 +137,7 @@ func TestSort(t *testing.T) {
} }
} }
volumes, err = volList.ListByAccessModes([]api.AccessModeType{api.ReadWriteOnce, api.ReadOnlyMany, api.ReadWriteMany}) volumes, err = volList.ListByAccessModes([]api.PersistentVolumeAccessMode{api.ReadWriteOnce, api.ReadOnlyMany, api.ReadWriteMany})
if err != nil { if err != nil {
t.Error("Unexpected error retrieving volumes by access modes:", err) t.Error("Unexpected error retrieving volumes by access modes:", err)
} }
...@@ -164,7 +164,7 @@ func createTestVolumes() []*api.PersistentVolume { ...@@ -164,7 +164,7 @@ func createTestVolumes() []*api.PersistentVolume {
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}, GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{},
}, },
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -182,7 +182,7 @@ func createTestVolumes() []*api.PersistentVolume { ...@@ -182,7 +182,7 @@ func createTestVolumes() []*api.PersistentVolume {
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
Glusterfs: &api.GlusterfsVolumeSource{}, Glusterfs: &api.GlusterfsVolumeSource{},
}, },
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
api.ReadWriteMany, api.ReadWriteMany,
...@@ -201,7 +201,7 @@ func createTestVolumes() []*api.PersistentVolume { ...@@ -201,7 +201,7 @@ func createTestVolumes() []*api.PersistentVolume {
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}, GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{},
}, },
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -221,7 +221,7 @@ func createTestVolumes() []*api.PersistentVolume { ...@@ -221,7 +221,7 @@ func createTestVolumes() []*api.PersistentVolume {
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
Glusterfs: &api.GlusterfsVolumeSource{}, Glusterfs: &api.GlusterfsVolumeSource{},
}, },
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
api.ReadWriteMany, api.ReadWriteMany,
...@@ -240,7 +240,7 @@ func createTestVolumes() []*api.PersistentVolume { ...@@ -240,7 +240,7 @@ func createTestVolumes() []*api.PersistentVolume {
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}, GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{},
}, },
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -258,7 +258,7 @@ func createTestVolumes() []*api.PersistentVolume { ...@@ -258,7 +258,7 @@ func createTestVolumes() []*api.PersistentVolume {
PersistentVolumeSource: api.PersistentVolumeSource{ PersistentVolumeSource: api.PersistentVolumeSource{
Glusterfs: &api.GlusterfsVolumeSource{}, Glusterfs: &api.GlusterfsVolumeSource{},
}, },
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
api.ReadWriteMany, api.ReadWriteMany,
......
...@@ -49,7 +49,7 @@ func accessModesIndexFunc(obj interface{}) (string, error) { ...@@ -49,7 +49,7 @@ func accessModesIndexFunc(obj interface{}) (string, error) {
} }
// ListByAccessModes returns all volumes with the given set of AccessModeTypes *in order* of their storage capacity (low to high) // ListByAccessModes returns all volumes with the given set of AccessModeTypes *in order* of their storage capacity (low to high)
func (pvIndex *persistentVolumeOrderedIndex) ListByAccessModes(modes []api.AccessModeType) ([]*api.PersistentVolume, error) { func (pvIndex *persistentVolumeOrderedIndex) ListByAccessModes(modes []api.PersistentVolumeAccessMode) ([]*api.PersistentVolume, error) {
pv := &api.PersistentVolume{ pv := &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: api.PersistentVolumeSpec{
AccessModes: modes, AccessModes: modes,
...@@ -88,7 +88,7 @@ func (pvIndex *persistentVolumeOrderedIndex) Find(pv *api.PersistentVolume, matc ...@@ -88,7 +88,7 @@ func (pvIndex *persistentVolumeOrderedIndex) Find(pv *api.PersistentVolume, matc
} }
// FindByAccessModesAndStorageCapacity is a convenience method that calls Find w/ requisite matchPredicate for storage // FindByAccessModesAndStorageCapacity is a convenience method that calls Find w/ requisite matchPredicate for storage
func (pvIndex *persistentVolumeOrderedIndex) FindByAccessModesAndStorageCapacity(modes []api.AccessModeType, qty resource.Quantity) (*api.PersistentVolume, error) { func (pvIndex *persistentVolumeOrderedIndex) FindByAccessModesAndStorageCapacity(modes []api.PersistentVolumeAccessMode, qty resource.Quantity) (*api.PersistentVolume, error) {
pv := &api.PersistentVolume{ pv := &api.PersistentVolume{
Spec: api.PersistentVolumeSpec{ Spec: api.PersistentVolumeSpec{
AccessModes: modes, AccessModes: modes,
......
...@@ -42,7 +42,7 @@ var _ = Describe("emptyDir", func() { ...@@ -42,7 +42,7 @@ var _ = Describe("emptyDir", func() {
It("volume on tmpfs should have the correct mode", func() { It("volume on tmpfs should have the correct mode", func() {
volumePath := "/test-volume" volumePath := "/test-volume"
source := &api.EmptyDirVolumeSource{ source := &api.EmptyDirVolumeSource{
Medium: api.StorageTypeMemory, Medium: api.StorageMediumMemory,
} }
pod := testPodWithVolume(volumePath, source) pod := testPodWithVolume(volumePath, source)
...@@ -60,7 +60,7 @@ var _ = Describe("emptyDir", func() { ...@@ -60,7 +60,7 @@ var _ = Describe("emptyDir", func() {
volumePath := "/test-volume" volumePath := "/test-volume"
filePath := path.Join(volumePath, "test-file") filePath := path.Join(volumePath, "test-file")
source := &api.EmptyDirVolumeSource{ source := &api.EmptyDirVolumeSource{
Medium: api.StorageTypeMemory, Medium: api.StorageMediumMemory,
} }
pod := testPodWithVolume(volumePath, source) pod := testPodWithVolume(volumePath, source)
......
...@@ -119,7 +119,7 @@ func createTestClaims() []*api.PersistentVolumeClaim { ...@@ -119,7 +119,7 @@ func createTestClaims() []*api.PersistentVolumeClaim {
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("500G"), api.ResourceName(api.ResourceStorage): resource.MustParse("500G"),
...@@ -133,7 +133,7 @@ func createTestClaims() []*api.PersistentVolumeClaim { ...@@ -133,7 +133,7 @@ func createTestClaims() []*api.PersistentVolumeClaim {
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadOnlyMany, api.ReadWriteOnce}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadOnlyMany, api.ReadWriteOnce},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("8G"), api.ResourceName(api.ResourceStorage): resource.MustParse("8G"),
...@@ -147,7 +147,7 @@ func createTestClaims() []*api.PersistentVolumeClaim { ...@@ -147,7 +147,7 @@ func createTestClaims() []*api.PersistentVolumeClaim {
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
}, },
Spec: api.PersistentVolumeClaimSpec{ Spec: api.PersistentVolumeClaimSpec{
AccessModes: []api.AccessModeType{api.ReadOnlyMany, api.ReadWriteOnce, api.ReadWriteMany}, AccessModes: []api.PersistentVolumeAccessMode{api.ReadOnlyMany, api.ReadWriteOnce, api.ReadWriteMany},
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Requests: api.ResourceList{ Requests: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("5G"), api.ResourceName(api.ResourceStorage): resource.MustParse("5G"),
...@@ -175,7 +175,7 @@ func createTestVolumes() []*api.PersistentVolume { ...@@ -175,7 +175,7 @@ func createTestVolumes() []*api.PersistentVolume {
FSType: "foo", FSType: "foo",
}, },
}, },
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
}, },
...@@ -196,7 +196,7 @@ func createTestVolumes() []*api.PersistentVolume { ...@@ -196,7 +196,7 @@ func createTestVolumes() []*api.PersistentVolume {
Path: "theloveyoutakeisequaltotheloveyoumake", Path: "theloveyoutakeisequaltotheloveyoumake",
}, },
}, },
AccessModes: []api.AccessModeType{ AccessModes: []api.PersistentVolumeAccessMode{
api.ReadWriteOnce, api.ReadWriteOnce,
api.ReadOnlyMany, api.ReadOnlyMany,
api.ReadWriteMany, api.ReadWriteMany,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment