Merge pull request #9807 from krousey/container_manifest
Removing ContainerManifest
This commit is contained in:
@@ -81,94 +81,5 @@ func init() {
|
||||
*out = *in.Copy()
|
||||
return nil
|
||||
},
|
||||
// Convert ContainerManifest to Pod
|
||||
func(in *ContainerManifest, out *Pod, s conversion.Scope) error {
|
||||
out.Spec.Containers = in.Containers
|
||||
out.Spec.Volumes = in.Volumes
|
||||
out.Spec.RestartPolicy = in.RestartPolicy
|
||||
out.Spec.DNSPolicy = in.DNSPolicy
|
||||
out.Name = in.ID
|
||||
out.UID = in.UUID
|
||||
|
||||
if in.ID != "" {
|
||||
out.SelfLink = "/api/v1beta1/pods/" + in.ID
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
func(in *Pod, out *ContainerManifest, s conversion.Scope) error {
|
||||
out.Containers = in.Spec.Containers
|
||||
out.Volumes = in.Spec.Volumes
|
||||
out.RestartPolicy = in.Spec.RestartPolicy
|
||||
out.DNSPolicy = in.Spec.DNSPolicy
|
||||
out.Version = "v1beta2"
|
||||
out.ID = in.Name
|
||||
out.UUID = in.UID
|
||||
return nil
|
||||
},
|
||||
|
||||
// ContainerManifestList
|
||||
func(in *ContainerManifestList, out *PodList, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.Items, &out.Items, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
for i := range out.Items {
|
||||
item := &out.Items[i]
|
||||
item.ResourceVersion = in.ResourceVersion
|
||||
}
|
||||
return nil
|
||||
},
|
||||
func(in *PodList, out *ContainerManifestList, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.Items, &out.Items, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ResourceVersion = in.ResourceVersion
|
||||
return nil
|
||||
},
|
||||
|
||||
// Conversion between Manifest and PodSpec
|
||||
func(in *PodSpec, out *ContainerManifest, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.Volumes, &out.Volumes, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Containers, &out.Containers, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.RestartPolicy, &out.RestartPolicy, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.TerminationGracePeriodSeconds != nil {
|
||||
out.TerminationGracePeriodSeconds = new(int64)
|
||||
*out.TerminationGracePeriodSeconds = *in.TerminationGracePeriodSeconds
|
||||
}
|
||||
if in.ActiveDeadlineSeconds != nil {
|
||||
out.ActiveDeadlineSeconds = new(int64)
|
||||
*out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds
|
||||
}
|
||||
out.DNSPolicy = in.DNSPolicy
|
||||
out.Version = "v1beta2"
|
||||
return nil
|
||||
},
|
||||
func(in *ContainerManifest, out *PodSpec, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.Volumes, &out.Volumes, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Containers, &out.Containers, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.RestartPolicy, &out.RestartPolicy, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.TerminationGracePeriodSeconds != nil {
|
||||
out.TerminationGracePeriodSeconds = new(int64)
|
||||
*out.TerminationGracePeriodSeconds = *in.TerminationGracePeriodSeconds
|
||||
}
|
||||
if in.ActiveDeadlineSeconds != nil {
|
||||
out.ActiveDeadlineSeconds = new(int64)
|
||||
*out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds
|
||||
}
|
||||
out.DNSPolicy = in.DNSPolicy
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@@ -207,78 +207,6 @@ func deepCopy_api_Container(in Container, out *Container, c *conversion.Cloner)
|
||||
return nil
|
||||
}
|
||||
|
||||
func deepCopy_api_ContainerManifest(in ContainerManifest, out *ContainerManifest, c *conversion.Cloner) error {
|
||||
out.Version = in.Version
|
||||
out.ID = in.ID
|
||||
out.UUID = in.UUID
|
||||
if in.Volumes != nil {
|
||||
out.Volumes = make([]Volume, len(in.Volumes))
|
||||
for i := range in.Volumes {
|
||||
if err := deepCopy_api_Volume(in.Volumes[i], &out.Volumes[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Volumes = nil
|
||||
}
|
||||
if in.Containers != nil {
|
||||
out.Containers = make([]Container, len(in.Containers))
|
||||
for i := range in.Containers {
|
||||
if err := deepCopy_api_Container(in.Containers[i], &out.Containers[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Containers = nil
|
||||
}
|
||||
out.RestartPolicy = in.RestartPolicy
|
||||
if in.TerminationGracePeriodSeconds != nil {
|
||||
out.TerminationGracePeriodSeconds = new(int64)
|
||||
*out.TerminationGracePeriodSeconds = *in.TerminationGracePeriodSeconds
|
||||
} else {
|
||||
out.TerminationGracePeriodSeconds = nil
|
||||
}
|
||||
if in.ActiveDeadlineSeconds != nil {
|
||||
out.ActiveDeadlineSeconds = new(int64)
|
||||
*out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds
|
||||
} else {
|
||||
out.ActiveDeadlineSeconds = nil
|
||||
}
|
||||
out.DNSPolicy = in.DNSPolicy
|
||||
out.HostNetwork = in.HostNetwork
|
||||
if in.ImagePullSecrets != nil {
|
||||
out.ImagePullSecrets = make([]LocalObjectReference, len(in.ImagePullSecrets))
|
||||
for i := range in.ImagePullSecrets {
|
||||
if err := deepCopy_api_LocalObjectReference(in.ImagePullSecrets[i], &out.ImagePullSecrets[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.ImagePullSecrets = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func deepCopy_api_ContainerManifestList(in ContainerManifestList, out *ContainerManifestList, c *conversion.Cloner) error {
|
||||
if err := deepCopy_api_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := deepCopy_api_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if in.Items != nil {
|
||||
out.Items = make([]ContainerManifest, len(in.Items))
|
||||
for i := range in.Items {
|
||||
if err := deepCopy_api_ContainerManifest(in.Items[i], &out.Items[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.Items = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func deepCopy_api_ContainerPort(in ContainerPort, out *ContainerPort, c *conversion.Cloner) error {
|
||||
out.Name = in.Name
|
||||
out.HostPort = in.HostPort
|
||||
@@ -2152,8 +2080,6 @@ func init() {
|
||||
deepCopy_api_ComponentStatus,
|
||||
deepCopy_api_ComponentStatusList,
|
||||
deepCopy_api_Container,
|
||||
deepCopy_api_ContainerManifest,
|
||||
deepCopy_api_ContainerManifestList,
|
||||
deepCopy_api_ContainerPort,
|
||||
deepCopy_api_ContainerState,
|
||||
deepCopy_api_ContainerStateRunning,
|
||||
|
@@ -103,7 +103,6 @@ func init() {
|
||||
"ListOptions",
|
||||
"DeleteOptions",
|
||||
"Status",
|
||||
"ContainerManifest",
|
||||
"PodLogOptions",
|
||||
"PodExecOptions",
|
||||
"PodProxyOptions")
|
||||
|
@@ -42,8 +42,6 @@ func init() {
|
||||
&Binding{},
|
||||
&Event{},
|
||||
&EventList{},
|
||||
&ContainerManifest{},
|
||||
&ContainerManifestList{},
|
||||
&List{},
|
||||
&LimitRange{},
|
||||
&LimitRangeList{},
|
||||
@@ -91,8 +89,6 @@ func (*Binding) IsAnAPIObject() {}
|
||||
func (*Status) IsAnAPIObject() {}
|
||||
func (*Event) IsAnAPIObject() {}
|
||||
func (*EventList) IsAnAPIObject() {}
|
||||
func (*ContainerManifest) IsAnAPIObject() {}
|
||||
func (*ContainerManifestList) IsAnAPIObject() {}
|
||||
func (*List) IsAnAPIObject() {}
|
||||
func (*LimitRange) IsAnAPIObject() {}
|
||||
func (*LimitRangeList) IsAnAPIObject() {}
|
||||
|
@@ -125,7 +125,7 @@ func TestList(t *testing.T) {
|
||||
roundTripSame(t, item)
|
||||
}
|
||||
|
||||
var nonRoundTrippableTypes = util.NewStringSet("ContainerManifest", "ContainerManifestList")
|
||||
var nonRoundTrippableTypes = util.NewStringSet()
|
||||
var nonInternalRoundTrippableTypes = util.NewStringSet("List", "ListOptions", "PodExecOptions")
|
||||
var nonRoundTrippableTypesByVersion = map[string][]string{}
|
||||
|
||||
|
@@ -1816,43 +1816,6 @@ type EventList struct {
|
||||
Items []Event `json:"items"`
|
||||
}
|
||||
|
||||
// ContainerManifest corresponds to the Container Manifest format, documented at:
|
||||
// https://developers.google.com/compute/docs/containers/container_vms#container_manifest
|
||||
// This is used as the representation of Kubernetes workloads.
|
||||
// DEPRECATED: Replaced with Pod
|
||||
type ContainerManifest struct {
|
||||
// Required: This must be a supported version string, such as "v1beta1".
|
||||
Version string `json:"version"`
|
||||
// Required: This must be a DNS_SUBDOMAIN.
|
||||
// TODO: ID on Manifest is deprecated and will be removed in the future.
|
||||
ID string `json:"id"`
|
||||
// TODO: UUID on Manifest is deprecated in the future once we are done
|
||||
// with the API refactoring. It is required for now to determine the instance
|
||||
// of a Pod.
|
||||
UUID types.UID `json:"uuid,omitempty"`
|
||||
Volumes []Volume `json:"volumes"`
|
||||
Containers []Container `json:"containers"`
|
||||
RestartPolicy RestartPolicy `json:"restartPolicy,omitempty"`
|
||||
TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
|
||||
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`
|
||||
// Required: Set DNS policy.
|
||||
DNSPolicy DNSPolicy `json:"dnsPolicy"`
|
||||
HostNetwork bool `json:"hostNetwork,omitempty"`
|
||||
// ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec.
|
||||
// If specified, these secrets will be passed to individual puller implementations for them to use. For example,
|
||||
// in the case of docker, only DockerConfig type secrets are honored.
|
||||
ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" description:"list of references to secrets in the same namespace available for pulling the container images"`
|
||||
}
|
||||
|
||||
// ContainerManifestList is used to communicate container manifests to kubelet.
|
||||
// DEPRECATED: Replaced with Pods
|
||||
type ContainerManifestList struct {
|
||||
TypeMeta `json:",inline"`
|
||||
ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
Items []ContainerManifest `json:"items"`
|
||||
}
|
||||
|
||||
// List holds a list of objects, which may not be known by the server.
|
||||
type List struct {
|
||||
TypeMeta `json:",inline"`
|
||||
|
@@ -152,38 +152,6 @@ const (
|
||||
NamespaceAll string = ""
|
||||
)
|
||||
|
||||
//
|
||||
//// ContainerManifest corresponds to the Container Manifest format, documented at:
|
||||
//// https://developers.google.com/compute/docs/containers/container_vms#container_manifest
|
||||
//// This is used as the representation of Kubernetes workloads.
|
||||
//// DEPRECATED: Exists to allow backwards compatible storage for clients accessing etcd
|
||||
//// directly.
|
||||
//type ContainerManifest struct {
|
||||
// // Required: This must be a supported version string, such as "v1beta1".
|
||||
// Version string `json:"version"`
|
||||
// // Required: This must be a DNS_SUBDOMAIN.
|
||||
// // TODO: ID on Manifest is deprecated and will be removed in the future.
|
||||
// ID string `json:"id"`
|
||||
// // TODO: UUID on Manifest is deprecated in the future once we are done
|
||||
// // with the API refactoring. It is required for now to determine the instance
|
||||
// // of a Pod.
|
||||
// UUID types.UID `json:"uuid,omitempty"`
|
||||
// Volumes []Volume `json:"volumes"`
|
||||
// Containers []Container `json:"containers"`
|
||||
// RestartPolicy RestartPolicy `json:"restartPolicy,omitempty"`
|
||||
//}
|
||||
//
|
||||
//// ContainerManifestList is used to communicate container manifests to kubelet.
|
||||
//// DEPRECATED: Exists to allow backwards compatible storage for clients accessing etcd
|
||||
//// directly.
|
||||
//type ContainerManifestList struct {
|
||||
// TypeMeta `json:",inline"`
|
||||
// // ID is the legacy field representing Name
|
||||
// ID string `json:"id,omitempty"`
|
||||
//
|
||||
// Items []ContainerManifest `json:"items,omitempty"`
|
||||
//}
|
||||
|
||||
// Volume represents a named volume in a pod that may be accessed by any containers in the pod.
|
||||
type Volume struct {
|
||||
// Required: This must be a DNS_LABEL. Each volume in a pod must have
|
||||
|
@@ -152,38 +152,6 @@ const (
|
||||
NamespaceAll string = ""
|
||||
)
|
||||
|
||||
//
|
||||
//// ContainerManifest corresponds to the Container Manifest format, documented at:
|
||||
//// https://developers.google.com/compute/docs/containers/container_vms#container_manifest
|
||||
//// This is used as the representation of Kubernetes workloads.
|
||||
//// DEPRECATED: Exists to allow backwards compatible storage for clients accessing etcd
|
||||
//// directly.
|
||||
//type ContainerManifest struct {
|
||||
// // Required: This must be a supported version string, such as "v1beta1".
|
||||
// Version string `json:"version"`
|
||||
// // Required: This must be a DNS_SUBDOMAIN.
|
||||
// // TODO: ID on Manifest is deprecated and will be removed in the future.
|
||||
// ID string `json:"id"`
|
||||
// // TODO: UUID on Manifest is deprecated in the future once we are done
|
||||
// // with the API refactoring. It is required for now to determine the instance
|
||||
// // of a Pod.
|
||||
// UUID types.UID `json:"uuid,omitempty"`
|
||||
// Volumes []Volume `json:"volumes"`
|
||||
// Containers []Container `json:"containers"`
|
||||
// RestartPolicy RestartPolicy `json:"restartPolicy,omitempty"`
|
||||
//}
|
||||
//
|
||||
//// ContainerManifestList is used to communicate container manifests to kubelet.
|
||||
//// DEPRECATED: Exists to allow backwards compatible storage for clients accessing etcd
|
||||
//// directly.
|
||||
//type ContainerManifestList struct {
|
||||
// TypeMeta `json:",inline"`
|
||||
// // ID is the legacy field representing Name
|
||||
// ID string `json:"id,omitempty"`
|
||||
//
|
||||
// Items []ContainerManifest `json:"items,omitempty"`
|
||||
//}
|
||||
|
||||
// Volume represents a named volume in a pod that may be accessed by any containers in the pod.
|
||||
type Volume struct {
|
||||
// Required: This must be a DNS_LABEL. Each volume in a pod must have
|
||||
|
@@ -863,29 +863,6 @@ func validateContainers(containers []api.Container, volumes util.StringSet) errs
|
||||
return allErrs
|
||||
}
|
||||
|
||||
var supportedManifestVersions = util.NewStringSet("v1beta1", "v1beta2")
|
||||
|
||||
// ValidateManifest tests that the specified ContainerManifest has valid data.
|
||||
// This includes checking formatting and uniqueness. It also canonicalizes the
|
||||
// structure by setting default values and implementing any backwards-compatibility
|
||||
// tricks.
|
||||
// TODO: replaced by ValidatePodSpec
|
||||
func ValidateManifest(manifest *api.ContainerManifest) errs.ValidationErrorList {
|
||||
allErrs := errs.ValidationErrorList{}
|
||||
|
||||
if len(manifest.Version) == 0 {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("version"))
|
||||
} else if !supportedManifestVersions.Has(strings.ToLower(manifest.Version)) {
|
||||
allErrs = append(allErrs, errs.NewFieldNotSupported("version", manifest.Version))
|
||||
}
|
||||
allVolumes, vErrs := validateVolumes(manifest.Volumes)
|
||||
allErrs = append(allErrs, vErrs.Prefix("volumes")...)
|
||||
allErrs = append(allErrs, validateContainers(manifest.Containers, allVolumes).Prefix("containers")...)
|
||||
allErrs = append(allErrs, validateRestartPolicy(&manifest.RestartPolicy).Prefix("restartPolicy")...)
|
||||
allErrs = append(allErrs, validateDNSPolicy(&manifest.DNSPolicy).Prefix("dnsPolicy")...)
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateRestartPolicy(restartPolicy *api.RestartPolicy) errs.ValidationErrorList {
|
||||
allErrors := errs.ValidationErrorList{}
|
||||
switch *restartPolicy {
|
||||
|
Reference in New Issue
Block a user