
This commit adds support for paused deployments so a user can choose when to run a deployment that exists in the system instead of having the deployment controller automatically reconciling it after every change or sync interval.
601 lines
20 KiB
Go
601 lines
20 KiB
Go
/*
|
|
Copyright 2015 The Kubernetes Authors All rights reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package v1beta1
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
|
|
"k8s.io/kubernetes/pkg/api"
|
|
v1 "k8s.io/kubernetes/pkg/api/v1"
|
|
"k8s.io/kubernetes/pkg/apis/extensions"
|
|
"k8s.io/kubernetes/pkg/conversion"
|
|
"k8s.io/kubernetes/pkg/runtime"
|
|
"k8s.io/kubernetes/pkg/util/intstr"
|
|
)
|
|
|
|
func addConversionFuncs(scheme *runtime.Scheme) {
|
|
// Add non-generated conversion functions
|
|
err := scheme.AddConversionFuncs(
|
|
Convert_api_PodSpec_To_v1_PodSpec,
|
|
Convert_v1_PodSpec_To_api_PodSpec,
|
|
Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec,
|
|
Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec,
|
|
Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy,
|
|
Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy,
|
|
Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment,
|
|
Convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment,
|
|
Convert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec,
|
|
Convert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec,
|
|
Convert_extensions_DaemonSetUpdateStrategy_To_v1beta1_DaemonSetUpdateStrategy,
|
|
Convert_v1beta1_DaemonSetUpdateStrategy_To_extensions_DaemonSetUpdateStrategy,
|
|
Convert_extensions_RollingUpdateDaemonSet_To_v1beta1_RollingUpdateDaemonSet,
|
|
Convert_v1beta1_RollingUpdateDaemonSet_To_extensions_RollingUpdateDaemonSet,
|
|
Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec,
|
|
Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec,
|
|
)
|
|
if err != nil {
|
|
// If one of the conversion functions is malformed, detect it immediately.
|
|
panic(err)
|
|
}
|
|
|
|
// Add field label conversions for kinds having selectable nothing but ObjectMeta fields.
|
|
for _, kind := range []string{"ConfigMap", "DaemonSet", "Deployment", "Ingress"} {
|
|
err = api.Scheme.AddFieldLabelConversionFunc("extensions/v1beta1", kind,
|
|
func(label, value string) (string, string, error) {
|
|
switch label {
|
|
case "metadata.name", "metadata.namespace":
|
|
return label, value, nil
|
|
default:
|
|
return "", "", fmt.Errorf("field label %q not supported for %q", label, kind)
|
|
}
|
|
})
|
|
if err != nil {
|
|
// If one of the conversion functions is malformed, detect it immediately.
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
err = api.Scheme.AddFieldLabelConversionFunc("extensions/v1beta1", "Job",
|
|
func(label, value string) (string, string, error) {
|
|
switch label {
|
|
case "metadata.name", "metadata.namespace", "status.successful":
|
|
return label, value, nil
|
|
default:
|
|
return "", "", fmt.Errorf("field label not supported: %s", label)
|
|
}
|
|
})
|
|
if err != nil {
|
|
// If one of the conversion functions is malformed, detect it immediately.
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// The following two PodSpec conversions functions where copied from pkg/api/conversion.go
|
|
// for the generated functions to work properly.
|
|
// This should be fixed: https://github.com/kubernetes/kubernetes/issues/12977
|
|
func Convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *v1.PodSpec, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*api.PodSpec))(in)
|
|
}
|
|
if in.Volumes != nil {
|
|
out.Volumes = make([]v1.Volume, len(in.Volumes))
|
|
for i := range in.Volumes {
|
|
if err := Convert_api_Volume_To_v1_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
} else {
|
|
out.Volumes = nil
|
|
}
|
|
if in.Containers != nil {
|
|
out.Containers = make([]v1.Container, len(in.Containers))
|
|
for i := range in.Containers {
|
|
if err := Convert_api_Container_To_v1_Container(&in.Containers[i], &out.Containers[i], s); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
} else {
|
|
out.Containers = nil
|
|
}
|
|
out.RestartPolicy = v1.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 = v1.DNSPolicy(in.DNSPolicy)
|
|
if in.NodeSelector != nil {
|
|
out.NodeSelector = make(map[string]string)
|
|
for key, val := range in.NodeSelector {
|
|
out.NodeSelector[key] = val
|
|
}
|
|
} else {
|
|
out.NodeSelector = nil
|
|
}
|
|
out.ServiceAccountName = in.ServiceAccountName
|
|
// DeprecatedServiceAccount is an alias for ServiceAccountName.
|
|
out.DeprecatedServiceAccount = in.ServiceAccountName
|
|
out.NodeName = in.NodeName
|
|
if in.SecurityContext != nil {
|
|
out.SecurityContext = new(v1.PodSecurityContext)
|
|
if err := Convert_api_PodSecurityContext_To_v1_PodSecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil {
|
|
return err
|
|
}
|
|
|
|
out.HostNetwork = in.SecurityContext.HostNetwork
|
|
out.HostPID = in.SecurityContext.HostPID
|
|
out.HostIPC = in.SecurityContext.HostIPC
|
|
}
|
|
if in.ImagePullSecrets != nil {
|
|
out.ImagePullSecrets = make([]v1.LocalObjectReference, len(in.ImagePullSecrets))
|
|
for i := range in.ImagePullSecrets {
|
|
if err := Convert_api_LocalObjectReference_To_v1_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
} else {
|
|
out.ImagePullSecrets = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*v1.PodSpec))(in)
|
|
}
|
|
if in.Volumes != nil {
|
|
out.Volumes = make([]api.Volume, len(in.Volumes))
|
|
for i := range in.Volumes {
|
|
if err := Convert_v1_Volume_To_api_Volume(&in.Volumes[i], &out.Volumes[i], s); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
} else {
|
|
out.Volumes = nil
|
|
}
|
|
if in.Containers != nil {
|
|
out.Containers = make([]api.Container, len(in.Containers))
|
|
for i := range in.Containers {
|
|
if err := Convert_v1_Container_To_api_Container(&in.Containers[i], &out.Containers[i], s); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
} else {
|
|
out.Containers = nil
|
|
}
|
|
out.RestartPolicy = api.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 = api.DNSPolicy(in.DNSPolicy)
|
|
if in.NodeSelector != nil {
|
|
out.NodeSelector = make(map[string]string)
|
|
for key, val := range in.NodeSelector {
|
|
out.NodeSelector[key] = val
|
|
}
|
|
} else {
|
|
out.NodeSelector = nil
|
|
}
|
|
// We support DeprecatedServiceAccount as an alias for ServiceAccountName.
|
|
// If both are specified, ServiceAccountName (the new field) wins.
|
|
out.ServiceAccountName = in.ServiceAccountName
|
|
if in.ServiceAccountName == "" {
|
|
out.ServiceAccountName = in.DeprecatedServiceAccount
|
|
}
|
|
out.NodeName = in.NodeName
|
|
|
|
if in.SecurityContext != nil {
|
|
out.SecurityContext = new(api.PodSecurityContext)
|
|
if err := Convert_v1_PodSecurityContext_To_api_PodSecurityContext(in.SecurityContext, out.SecurityContext, s); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
if out.SecurityContext == nil {
|
|
out.SecurityContext = new(api.PodSecurityContext)
|
|
}
|
|
out.SecurityContext.HostNetwork = in.HostNetwork
|
|
out.SecurityContext.HostPID = in.HostPID
|
|
out.SecurityContext.HostIPC = in.HostIPC
|
|
if in.ImagePullSecrets != nil {
|
|
out.ImagePullSecrets = make([]api.LocalObjectReference, len(in.ImagePullSecrets))
|
|
for i := range in.ImagePullSecrets {
|
|
if err := Convert_v1_LocalObjectReference_To_api_LocalObjectReference(&in.ImagePullSecrets[i], &out.ImagePullSecrets[i], s); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
} else {
|
|
out.ImagePullSecrets = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.DeploymentSpec, out *DeploymentSpec, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*extensions.DeploymentSpec))(in)
|
|
}
|
|
out.Replicas = new(int32)
|
|
*out.Replicas = int32(in.Replicas)
|
|
if in.Selector != nil {
|
|
out.Selector = make(map[string]string)
|
|
for key, val := range in.Selector {
|
|
out.Selector[key] = val
|
|
}
|
|
} else {
|
|
out.Selector = nil
|
|
}
|
|
if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {
|
|
return err
|
|
}
|
|
if err := Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil {
|
|
return err
|
|
}
|
|
out.UniqueLabelKey = new(string)
|
|
*out.UniqueLabelKey = in.UniqueLabelKey
|
|
out.Paused = in.Paused
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentSpec, out *extensions.DeploymentSpec, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*DeploymentSpec))(in)
|
|
}
|
|
if in.Replicas != nil {
|
|
out.Replicas = int(*in.Replicas)
|
|
}
|
|
if in.Selector != nil {
|
|
out.Selector = make(map[string]string)
|
|
for key, val := range in.Selector {
|
|
out.Selector[key] = val
|
|
}
|
|
} else {
|
|
out.Selector = nil
|
|
}
|
|
if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(&in.Template, &out.Template, s); err != nil {
|
|
return err
|
|
}
|
|
if err := Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil {
|
|
return err
|
|
}
|
|
if in.UniqueLabelKey != nil {
|
|
out.UniqueLabelKey = *in.UniqueLabelKey
|
|
}
|
|
out.Paused = in.Paused
|
|
return nil
|
|
}
|
|
|
|
func Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy(in *extensions.DeploymentStrategy, out *DeploymentStrategy, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*extensions.DeploymentStrategy))(in)
|
|
}
|
|
out.Type = DeploymentStrategyType(in.Type)
|
|
if in.RollingUpdate != nil {
|
|
out.RollingUpdate = new(RollingUpdateDeployment)
|
|
if err := Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in.RollingUpdate, out.RollingUpdate, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.RollingUpdate = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(in *DeploymentStrategy, out *extensions.DeploymentStrategy, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*DeploymentStrategy))(in)
|
|
}
|
|
out.Type = extensions.DeploymentStrategyType(in.Type)
|
|
if in.RollingUpdate != nil {
|
|
out.RollingUpdate = new(extensions.RollingUpdateDeployment)
|
|
if err := Convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment(in.RollingUpdate, out.RollingUpdate, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.RollingUpdate = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment(in *extensions.RollingUpdateDeployment, out *RollingUpdateDeployment, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*extensions.RollingUpdateDeployment))(in)
|
|
}
|
|
if out.MaxUnavailable == nil {
|
|
out.MaxUnavailable = &intstr.IntOrString{}
|
|
}
|
|
if err := s.Convert(&in.MaxUnavailable, out.MaxUnavailable, 0); err != nil {
|
|
return err
|
|
}
|
|
if out.MaxSurge == nil {
|
|
out.MaxSurge = &intstr.IntOrString{}
|
|
}
|
|
if err := s.Convert(&in.MaxSurge, out.MaxSurge, 0); err != nil {
|
|
return err
|
|
}
|
|
out.MinReadySeconds = int32(in.MinReadySeconds)
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployment(in *RollingUpdateDeployment, out *extensions.RollingUpdateDeployment, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*RollingUpdateDeployment))(in)
|
|
}
|
|
if err := s.Convert(in.MaxUnavailable, &out.MaxUnavailable, 0); err != nil {
|
|
return err
|
|
}
|
|
if err := s.Convert(in.MaxSurge, &out.MaxSurge, 0); err != nil {
|
|
return err
|
|
}
|
|
out.MinReadySeconds = int(in.MinReadySeconds)
|
|
return nil
|
|
}
|
|
|
|
func Convert_api_PodSecurityContext_To_v1_PodSecurityContext(in *api.PodSecurityContext, out *v1.PodSecurityContext, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*api.PodSecurityContext))(in)
|
|
}
|
|
|
|
out.SupplementalGroups = in.SupplementalGroups
|
|
if in.SELinuxOptions != nil {
|
|
out.SELinuxOptions = new(v1.SELinuxOptions)
|
|
if err := Convert_api_SELinuxOptions_To_v1_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.SELinuxOptions = nil
|
|
}
|
|
if in.RunAsUser != nil {
|
|
out.RunAsUser = new(int64)
|
|
*out.RunAsUser = *in.RunAsUser
|
|
} else {
|
|
out.RunAsUser = nil
|
|
}
|
|
if in.RunAsNonRoot != nil {
|
|
out.RunAsNonRoot = new(bool)
|
|
*out.RunAsNonRoot = *in.RunAsNonRoot
|
|
} else {
|
|
out.RunAsNonRoot = nil
|
|
}
|
|
if in.FSGroup != nil {
|
|
out.FSGroup = new(int64)
|
|
*out.FSGroup = *in.FSGroup
|
|
} else {
|
|
out.FSGroup = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1_PodSecurityContext_To_api_PodSecurityContext(in *v1.PodSecurityContext, out *api.PodSecurityContext, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*v1.PodSecurityContext))(in)
|
|
}
|
|
|
|
out.SupplementalGroups = in.SupplementalGroups
|
|
if in.SELinuxOptions != nil {
|
|
out.SELinuxOptions = new(api.SELinuxOptions)
|
|
if err := Convert_v1_SELinuxOptions_To_api_SELinuxOptions(in.SELinuxOptions, out.SELinuxOptions, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.SELinuxOptions = nil
|
|
}
|
|
if in.RunAsUser != nil {
|
|
out.RunAsUser = new(int64)
|
|
*out.RunAsUser = *in.RunAsUser
|
|
} else {
|
|
out.RunAsUser = nil
|
|
}
|
|
if in.RunAsNonRoot != nil {
|
|
out.RunAsNonRoot = new(bool)
|
|
*out.RunAsNonRoot = *in.RunAsNonRoot
|
|
} else {
|
|
out.RunAsNonRoot = nil
|
|
}
|
|
if in.FSGroup != nil {
|
|
out.FSGroup = new(int64)
|
|
*out.FSGroup = *in.FSGroup
|
|
} else {
|
|
out.FSGroup = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_extensions_DaemonSetSpec_To_v1beta1_DaemonSetSpec(in *extensions.DaemonSetSpec, out *DaemonSetSpec, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*extensions.DaemonSetSpec))(in)
|
|
}
|
|
// unable to generate simple pointer conversion for extensions.LabelSelector -> v1beta1.LabelSelector
|
|
if in.Selector != nil {
|
|
out.Selector = new(LabelSelector)
|
|
if err := Convert_extensions_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.Selector = nil
|
|
}
|
|
// unable to generate simple pointer conversion for api.PodTemplateSpec -> v1.PodTemplateSpec
|
|
if in.Template != nil {
|
|
out.Template = new(v1.PodTemplateSpec)
|
|
if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.Template = nil
|
|
}
|
|
if err := Convert_extensions_DaemonSetUpdateStrategy_To_v1beta1_DaemonSetUpdateStrategy(&in.UpdateStrategy, &out.UpdateStrategy, s); err != nil {
|
|
return err
|
|
}
|
|
out.UniqueLabelKey = new(string)
|
|
*out.UniqueLabelKey = in.UniqueLabelKey
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1beta1_DaemonSetSpec_To_extensions_DaemonSetSpec(in *DaemonSetSpec, out *extensions.DaemonSetSpec, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*DaemonSetSpec))(in)
|
|
}
|
|
// unable to generate simple pointer conversion for v1beta1.LabelSelector -> extensions.LabelSelector
|
|
if in.Selector != nil {
|
|
out.Selector = new(extensions.LabelSelector)
|
|
if err := Convert_v1beta1_LabelSelector_To_extensions_LabelSelector(in.Selector, out.Selector, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.Selector = nil
|
|
}
|
|
// unable to generate simple pointer conversion for v1.PodTemplateSpec -> api.PodTemplateSpec
|
|
if in.Template != nil {
|
|
out.Template = new(api.PodTemplateSpec)
|
|
if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.Template = nil
|
|
}
|
|
if err := Convert_v1beta1_DaemonSetUpdateStrategy_To_extensions_DaemonSetUpdateStrategy(&in.UpdateStrategy, &out.UpdateStrategy, s); err != nil {
|
|
return err
|
|
}
|
|
if in.UniqueLabelKey != nil {
|
|
out.UniqueLabelKey = *in.UniqueLabelKey
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_extensions_DaemonSetUpdateStrategy_To_v1beta1_DaemonSetUpdateStrategy(in *extensions.DaemonSetUpdateStrategy, out *DaemonSetUpdateStrategy, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*extensions.DaemonSetUpdateStrategy))(in)
|
|
}
|
|
out.Type = DaemonSetUpdateStrategyType(in.Type)
|
|
if in.RollingUpdate != nil {
|
|
out.RollingUpdate = new(RollingUpdateDaemonSet)
|
|
if err := Convert_extensions_RollingUpdateDaemonSet_To_v1beta1_RollingUpdateDaemonSet(in.RollingUpdate, out.RollingUpdate, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.RollingUpdate = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1beta1_DaemonSetUpdateStrategy_To_extensions_DaemonSetUpdateStrategy(in *DaemonSetUpdateStrategy, out *extensions.DaemonSetUpdateStrategy, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*DaemonSetUpdateStrategy))(in)
|
|
}
|
|
out.Type = extensions.DaemonSetUpdateStrategyType(in.Type)
|
|
if in.RollingUpdate != nil {
|
|
out.RollingUpdate = new(extensions.RollingUpdateDaemonSet)
|
|
if err := Convert_v1beta1_RollingUpdateDaemonSet_To_extensions_RollingUpdateDaemonSet(in.RollingUpdate, out.RollingUpdate, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.RollingUpdate = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_extensions_RollingUpdateDaemonSet_To_v1beta1_RollingUpdateDaemonSet(in *extensions.RollingUpdateDaemonSet, out *RollingUpdateDaemonSet, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*extensions.RollingUpdateDaemonSet))(in)
|
|
}
|
|
if out.MaxUnavailable == nil {
|
|
out.MaxUnavailable = &intstr.IntOrString{}
|
|
}
|
|
if err := s.Convert(&in.MaxUnavailable, out.MaxUnavailable, 0); err != nil {
|
|
return err
|
|
}
|
|
out.MinReadySeconds = int32(in.MinReadySeconds)
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1beta1_RollingUpdateDaemonSet_To_extensions_RollingUpdateDaemonSet(in *RollingUpdateDaemonSet, out *extensions.RollingUpdateDaemonSet, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*RollingUpdateDaemonSet))(in)
|
|
}
|
|
if err := s.Convert(in.MaxUnavailable, &out.MaxUnavailable, 0); err != nil {
|
|
return err
|
|
}
|
|
out.MinReadySeconds = int(in.MinReadySeconds)
|
|
return nil
|
|
}
|
|
|
|
func Convert_extensions_ReplicaSetSpec_To_v1beta1_ReplicaSetSpec(in *extensions.ReplicaSetSpec, out *ReplicaSetSpec, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*extensions.ReplicaSetSpec))(in)
|
|
}
|
|
out.Replicas = new(int32)
|
|
*out.Replicas = int32(in.Replicas)
|
|
if in.Selector != nil {
|
|
out.Selector = new(LabelSelector)
|
|
if err := Convert_extensions_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.Selector = nil
|
|
}
|
|
if in.Template != nil {
|
|
out.Template = new(v1.PodTemplateSpec)
|
|
if err := Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in.Template, out.Template, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.Template = nil
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetSpec, out *extensions.ReplicaSetSpec, s conversion.Scope) error {
|
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
|
defaulting.(func(*ReplicaSetSpec))(in)
|
|
}
|
|
if in.Replicas != nil {
|
|
out.Replicas = int(*in.Replicas)
|
|
}
|
|
if in.Selector != nil {
|
|
out.Selector = new(extensions.LabelSelector)
|
|
if err := Convert_v1beta1_LabelSelector_To_extensions_LabelSelector(in.Selector, out.Selector, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.Selector = nil
|
|
}
|
|
if in.Template != nil {
|
|
out.Template = new(api.PodTemplateSpec)
|
|
if err := Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in.Template, out.Template, s); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
out.Template = nil
|
|
}
|
|
return nil
|
|
}
|