Commit ee2a0694 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #24872 from smarterclayton/propogate_int_types

Automatic merge from submit-queue Convert internal types to use exact precision integers This makes conversion more suitable for future optimizations, and we need to stop pretending for some of our internal types that the width of the int doesn't matter. @wojtek-t
parents f8196d90 fdb110c8
...@@ -192,7 +192,7 @@ func (ks *kube2sky) generateRecordsForHeadlessService(subdomain string, e *kapi. ...@@ -192,7 +192,7 @@ func (ks *kube2sky) generateRecordsForHeadlessService(subdomain string, e *kapi.
endpointPort := &e.Subsets[idx].Ports[portIdx] endpointPort := &e.Subsets[idx].Ports[portIdx]
portSegment := buildPortSegmentString(endpointPort.Name, endpointPort.Protocol) portSegment := buildPortSegmentString(endpointPort.Name, endpointPort.Protocol)
if portSegment != "" { if portSegment != "" {
err := ks.generateSRVRecord(subdomain, portSegment, recordLabel, recordKey, endpointPort.Port) err := ks.generateSRVRecord(subdomain, portSegment, recordLabel, recordKey, int(endpointPort.Port))
if err != nil { if err != nil {
return err return err
} }
...@@ -343,7 +343,7 @@ func (ks *kube2sky) generateRecordsForPortalService(subdomain string, service *k ...@@ -343,7 +343,7 @@ func (ks *kube2sky) generateRecordsForPortalService(subdomain string, service *k
port := &service.Spec.Ports[i] port := &service.Spec.Ports[i]
portSegment := buildPortSegmentString(port.Name, port.Protocol) portSegment := buildPortSegmentString(port.Name, port.Protocol)
if portSegment != "" { if portSegment != "" {
err = ks.generateSRVRecord(subdomain, portSegment, recordLabel, subdomain, port.Port) err = ks.generateSRVRecord(subdomain, portSegment, recordLabel, subdomain, int(port.Port))
if err != nil { if err != nil {
return err return err
} }
......
...@@ -111,7 +111,7 @@ type hostPort struct { ...@@ -111,7 +111,7 @@ type hostPort struct {
func getHostPort(service *kapi.Service) *hostPort { func getHostPort(service *kapi.Service) *hostPort {
return &hostPort{ return &hostPort{
Host: service.Spec.ClusterIP, Host: service.Spec.ClusterIP,
Port: service.Spec.Ports[0].Port, Port: int(service.Spec.Ports[0].Port),
} }
} }
...@@ -181,7 +181,7 @@ func newService(namespace, serviceName, clusterIP, portName string, portNumber i ...@@ -181,7 +181,7 @@ func newService(namespace, serviceName, clusterIP, portName string, portNumber i
Spec: kapi.ServiceSpec{ Spec: kapi.ServiceSpec{
ClusterIP: clusterIP, ClusterIP: clusterIP,
Ports: []kapi.ServicePort{ Ports: []kapi.ServicePort{
{Port: portNumber, Name: portName, Protocol: "TCP"}, {Port: int32(portNumber), Name: portName, Protocol: "TCP"},
}, },
}, },
} }
...@@ -212,7 +212,7 @@ func newSubset() kapi.EndpointSubset { ...@@ -212,7 +212,7 @@ func newSubset() kapi.EndpointSubset {
func newSubsetWithOnePort(portName string, port int, ips ...string) kapi.EndpointSubset { func newSubsetWithOnePort(portName string, port int, ips ...string) kapi.EndpointSubset {
subset := newSubset() subset := newSubset()
subset.Ports = append(subset.Ports, kapi.EndpointPort{Port: port, Name: portName, Protocol: "TCP"}) subset.Ports = append(subset.Ports, kapi.EndpointPort{Port: int32(port), Name: portName, Protocol: "TCP"})
for _, ip := range ips { for _, ip := range ips {
subset.Addresses = append(subset.Addresses, kapi.EndpointAddress{IP: ip}) subset.Addresses = append(subset.Addresses, kapi.EndpointAddress{IP: ip})
} }
...@@ -221,7 +221,7 @@ func newSubsetWithOnePort(portName string, port int, ips ...string) kapi.Endpoin ...@@ -221,7 +221,7 @@ func newSubsetWithOnePort(portName string, port int, ips ...string) kapi.Endpoin
func newSubsetWithTwoPorts(portName1 string, portNumber1 int, portName2 string, portNumber2 int, ips ...string) kapi.EndpointSubset { func newSubsetWithTwoPorts(portName1 string, portNumber1 int, portName2 string, portNumber2 int, ips ...string) kapi.EndpointSubset {
subset := newSubsetWithOnePort(portName1, portNumber1, ips...) subset := newSubsetWithOnePort(portName1, portNumber1, ips...)
subset.Ports = append(subset.Ports, kapi.EndpointPort{Port: portNumber2, Name: portName2, Protocol: "TCP"}) subset.Ports = append(subset.Ports, kapi.EndpointPort{Port: int32(portNumber2), Name: portName2, Protocol: "TCP"})
return subset return subset
} }
......
...@@ -126,7 +126,7 @@ func Run(s *options.CMServer) error { ...@@ -126,7 +126,7 @@ func Run(s *options.CMServer) error {
kubeconfig.ContentConfig.ContentType = s.ContentType kubeconfig.ContentConfig.ContentType = s.ContentType
// Override kubeconfig qps/burst settings from flags // Override kubeconfig qps/burst settings from flags
kubeconfig.QPS = s.KubeAPIQPS kubeconfig.QPS = s.KubeAPIQPS
kubeconfig.Burst = s.KubeAPIBurst kubeconfig.Burst = int(s.KubeAPIBurst)
kubeClient, err := client.New(kubeconfig) kubeClient, err := client.New(kubeconfig)
if err != nil { if err != nil {
...@@ -144,7 +144,7 @@ func Run(s *options.CMServer) error { ...@@ -144,7 +144,7 @@ func Run(s *options.CMServer) error {
mux.Handle("/metrics", prometheus.Handler()) mux.Handle("/metrics", prometheus.Handler())
server := &http.Server{ server := &http.Server{
Addr: net.JoinHostPort(s.Address, strconv.Itoa(s.Port)), Addr: net.JoinHostPort(s.Address, strconv.Itoa(int(s.Port))),
Handler: mux, Handler: mux,
} }
glog.Fatal(server.ListenAndServe()) glog.Fatal(server.ListenAndServe())
...@@ -198,7 +198,7 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig ...@@ -198,7 +198,7 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
informers[reflect.TypeOf(&api.Pod{})] = podInformer informers[reflect.TypeOf(&api.Pod{})] = podInformer
go endpointcontroller.NewEndpointController(podInformer, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "endpoint-controller"))). go endpointcontroller.NewEndpointController(podInformer, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "endpoint-controller"))).
Run(s.ConcurrentEndpointSyncs, wait.NeverStop) Run(int(s.ConcurrentEndpointSyncs), wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
go replicationcontroller.NewReplicationManager( go replicationcontroller.NewReplicationManager(
...@@ -206,12 +206,12 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig ...@@ -206,12 +206,12 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "replication-controller")), clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "replication-controller")),
ResyncPeriod(s), ResyncPeriod(s),
replicationcontroller.BurstReplicas, replicationcontroller.BurstReplicas,
s.LookupCacheSizeForRC, int(s.LookupCacheSizeForRC),
).Run(s.ConcurrentRCSyncs, wait.NeverStop) ).Run(int(s.ConcurrentRCSyncs), wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
if s.TerminatedPodGCThreshold > 0 { if s.TerminatedPodGCThreshold > 0 {
go gc.New(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "garbage-collector")), ResyncPeriod(s), s.TerminatedPodGCThreshold). go gc.New(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "garbage-collector")), ResyncPeriod(s), int(s.TerminatedPodGCThreshold)).
Run(wait.NeverStop) Run(wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
} }
...@@ -224,8 +224,8 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig ...@@ -224,8 +224,8 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
// this cidr has been validated already // this cidr has been validated already
_, clusterCIDR, _ := net.ParseCIDR(s.ClusterCIDR) _, clusterCIDR, _ := net.ParseCIDR(s.ClusterCIDR)
nodeController := nodecontroller.NewNodeController(cloud, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "node-controller")), nodeController := nodecontroller.NewNodeController(cloud, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "node-controller")),
s.PodEvictionTimeout.Duration, flowcontrol.NewTokenBucketRateLimiter(s.DeletingPodsQps, s.DeletingPodsBurst), s.PodEvictionTimeout.Duration, flowcontrol.NewTokenBucketRateLimiter(s.DeletingPodsQps, int(s.DeletingPodsBurst)),
flowcontrol.NewTokenBucketRateLimiter(s.DeletingPodsQps, s.DeletingPodsBurst), flowcontrol.NewTokenBucketRateLimiter(s.DeletingPodsQps, int(s.DeletingPodsBurst)),
s.NodeMonitorGracePeriod.Duration, s.NodeStartupGracePeriod.Duration, s.NodeMonitorPeriod.Duration, clusterCIDR, s.AllocateNodeCIDRs) s.NodeMonitorGracePeriod.Duration, s.NodeStartupGracePeriod.Duration, s.NodeMonitorPeriod.Duration, clusterCIDR, s.AllocateNodeCIDRs)
nodeController.Run(s.NodeSyncPeriod.Duration) nodeController.Run(s.NodeSyncPeriod.Duration)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
...@@ -268,7 +268,7 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig ...@@ -268,7 +268,7 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
ReplenishmentResyncPeriod: ResyncPeriod(s), ReplenishmentResyncPeriod: ResyncPeriod(s),
GroupKindsToReplenish: groupKindsToReplenish, GroupKindsToReplenish: groupKindsToReplenish,
} }
go resourcequotacontroller.NewResourceQuotaController(resourceQuotaControllerOptions).Run(s.ConcurrentResourceQuotaSyncs, wait.NeverStop) go resourcequotacontroller.NewResourceQuotaController(resourceQuotaControllerOptions).Run(int(s.ConcurrentResourceQuotaSyncs), wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
// If apiserver is not running we should wait for some time and fail only then. This is particularly // If apiserver is not running we should wait for some time and fail only then. This is particularly
...@@ -299,7 +299,7 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig ...@@ -299,7 +299,7 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
glog.Fatalf("Failed to get supported resources from server: %v", err) glog.Fatalf("Failed to get supported resources from server: %v", err)
} }
namespaceController := namespacecontroller.NewNamespaceController(namespaceKubeClient, namespaceClientPool, groupVersionResources, s.NamespaceSyncPeriod.Duration, api.FinalizerKubernetes) namespaceController := namespacecontroller.NewNamespaceController(namespaceKubeClient, namespaceClientPool, groupVersionResources, s.NamespaceSyncPeriod.Duration, api.FinalizerKubernetes)
go namespaceController.Run(s.ConcurrentNamespaceSyncs, wait.NeverStop) go namespaceController.Run(int(s.ConcurrentNamespaceSyncs), wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
groupVersion := "extensions/v1beta1" groupVersion := "extensions/v1beta1"
...@@ -324,29 +324,29 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig ...@@ -324,29 +324,29 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
if containsResource(resources, "daemonsets") { if containsResource(resources, "daemonsets") {
glog.Infof("Starting daemon set controller") glog.Infof("Starting daemon set controller")
go daemon.NewDaemonSetsController(podInformer, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "daemon-set-controller")), ResyncPeriod(s), s.LookupCacheSizeForDaemonSet). go daemon.NewDaemonSetsController(podInformer, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "daemon-set-controller")), ResyncPeriod(s), int(s.LookupCacheSizeForDaemonSet)).
Run(s.ConcurrentDaemonSetSyncs, wait.NeverStop) Run(int(s.ConcurrentDaemonSetSyncs), wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
} }
if containsResource(resources, "jobs") { if containsResource(resources, "jobs") {
glog.Infof("Starting job controller") glog.Infof("Starting job controller")
go job.NewJobController(podInformer, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "job-controller"))). go job.NewJobController(podInformer, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "job-controller"))).
Run(s.ConcurrentJobSyncs, wait.NeverStop) Run(int(s.ConcurrentJobSyncs), wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
} }
if containsResource(resources, "deployments") { if containsResource(resources, "deployments") {
glog.Infof("Starting deployment controller") glog.Infof("Starting deployment controller")
go deployment.NewDeploymentController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "deployment-controller")), ResyncPeriod(s)). go deployment.NewDeploymentController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "deployment-controller")), ResyncPeriod(s)).
Run(s.ConcurrentDeploymentSyncs, wait.NeverStop) Run(int(s.ConcurrentDeploymentSyncs), wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
} }
if containsResource(resources, "replicasets") { if containsResource(resources, "replicasets") {
glog.Infof("Starting ReplicaSet controller") glog.Infof("Starting ReplicaSet controller")
go replicaset.NewReplicaSetController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "replicaset-controller")), ResyncPeriod(s), replicaset.BurstReplicas, s.LookupCacheSizeForRS). go replicaset.NewReplicaSetController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "replicaset-controller")), ResyncPeriod(s), replicaset.BurstReplicas, int(s.LookupCacheSizeForRS)).
Run(s.ConcurrentRSSyncs, wait.NeverStop) Run(int(s.ConcurrentRSSyncs), wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
} }
} }
...@@ -364,7 +364,7 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig ...@@ -364,7 +364,7 @@ func StartControllers(s *options.CMServer, kubeClient *client.Client, kubeconfig
pvRecycler, err := persistentvolumecontroller.NewPersistentVolumeRecycler( pvRecycler, err := persistentvolumecontroller.NewPersistentVolumeRecycler(
clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "persistent-volume-recycler")), clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "persistent-volume-recycler")),
s.PVClaimBinderSyncPeriod.Duration, s.PVClaimBinderSyncPeriod.Duration,
s.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.MaximumRetry, int(s.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.MaximumRetry),
ProbeRecyclableVolumePlugins(s.VolumeConfiguration), ProbeRecyclableVolumePlugins(s.VolumeConfiguration),
cloud, cloud,
) )
......
...@@ -57,8 +57,8 @@ func ProbeRecyclableVolumePlugins(config componentconfig.VolumeConfiguration) [] ...@@ -57,8 +57,8 @@ func ProbeRecyclableVolumePlugins(config componentconfig.VolumeConfiguration) []
// HostPath recycling is for testing and development purposes only! // HostPath recycling is for testing and development purposes only!
hostPathConfig := volume.VolumeConfig{ hostPathConfig := volume.VolumeConfig{
RecyclerMinimumTimeout: config.PersistentVolumeRecyclerConfiguration.MinimumTimeoutHostPath, RecyclerMinimumTimeout: int(config.PersistentVolumeRecyclerConfiguration.MinimumTimeoutHostPath),
RecyclerTimeoutIncrement: config.PersistentVolumeRecyclerConfiguration.IncrementTimeoutHostPath, RecyclerTimeoutIncrement: int(config.PersistentVolumeRecyclerConfiguration.IncrementTimeoutHostPath),
RecyclerPodTemplate: volume.NewPersistentVolumeRecyclerPodTemplate(), RecyclerPodTemplate: volume.NewPersistentVolumeRecyclerPodTemplate(),
} }
if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, &hostPathConfig); err != nil { if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathHostPath, &hostPathConfig); err != nil {
...@@ -67,8 +67,8 @@ func ProbeRecyclableVolumePlugins(config componentconfig.VolumeConfiguration) [] ...@@ -67,8 +67,8 @@ func ProbeRecyclableVolumePlugins(config componentconfig.VolumeConfiguration) []
allPlugins = append(allPlugins, host_path.ProbeVolumePlugins(hostPathConfig)...) allPlugins = append(allPlugins, host_path.ProbeVolumePlugins(hostPathConfig)...)
nfsConfig := volume.VolumeConfig{ nfsConfig := volume.VolumeConfig{
RecyclerMinimumTimeout: config.PersistentVolumeRecyclerConfiguration.MinimumTimeoutNFS, RecyclerMinimumTimeout: int(config.PersistentVolumeRecyclerConfiguration.MinimumTimeoutNFS),
RecyclerTimeoutIncrement: config.PersistentVolumeRecyclerConfiguration.IncrementTimeoutNFS, RecyclerTimeoutIncrement: int(config.PersistentVolumeRecyclerConfiguration.IncrementTimeoutNFS),
RecyclerPodTemplate: volume.NewPersistentVolumeRecyclerPodTemplate(), RecyclerPodTemplate: volume.NewPersistentVolumeRecyclerPodTemplate(),
} }
if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, &nfsConfig); err != nil { if err := AttemptToLoadRecycler(config.PersistentVolumeRecyclerConfiguration.PodTemplateFilePathNFS, &nfsConfig); err != nil {
......
...@@ -40,7 +40,7 @@ type ProxyServerConfig struct { ...@@ -40,7 +40,7 @@ type ProxyServerConfig struct {
ResourceContainer string ResourceContainer string
ContentType string ContentType string
KubeAPIQPS float32 KubeAPIQPS float32
KubeAPIBurst int KubeAPIBurst int32
ConfigSyncPeriod time.Duration ConfigSyncPeriod time.Duration
CleanupAndExit bool CleanupAndExit bool
NodeRef *api.ObjectReference NodeRef *api.ObjectReference
...@@ -63,16 +63,16 @@ func NewProxyConfig() *ProxyServerConfig { ...@@ -63,16 +63,16 @@ func NewProxyConfig() *ProxyServerConfig {
func (s *ProxyServerConfig) AddFlags(fs *pflag.FlagSet) { func (s *ProxyServerConfig) AddFlags(fs *pflag.FlagSet) {
fs.Var(componentconfig.IPVar{Val: &s.BindAddress}, "bind-address", "The IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)") fs.Var(componentconfig.IPVar{Val: &s.BindAddress}, "bind-address", "The IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)")
fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)") fs.StringVar(&s.Master, "master", s.Master, "The address of the Kubernetes API server (overrides any value in kubeconfig)")
fs.IntVar(&s.HealthzPort, "healthz-port", s.HealthzPort, "The port to bind the health check server. Use 0 to disable.") fs.Int32Var(&s.HealthzPort, "healthz-port", s.HealthzPort, "The port to bind the health check server. Use 0 to disable.")
fs.Var(componentconfig.IPVar{Val: &s.HealthzBindAddress}, "healthz-bind-address", "The IP address for the health check server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)") fs.Var(componentconfig.IPVar{Val: &s.HealthzBindAddress}, "healthz-bind-address", "The IP address for the health check server to serve on, defaulting to 127.0.0.1 (set to 0.0.0.0 for all interfaces)")
fs.IntVar(s.OOMScoreAdj, "oom-score-adj", util.IntPtrDerefOr(s.OOMScoreAdj, qos.KubeProxyOOMScoreAdj), "The oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]") fs.Int32Var(s.OOMScoreAdj, "oom-score-adj", util.Int32PtrDerefOr(s.OOMScoreAdj, int32(qos.KubeProxyOOMScoreAdj)), "The oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]")
fs.StringVar(&s.ResourceContainer, "resource-container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).") fs.StringVar(&s.ResourceContainer, "resource-container", s.ResourceContainer, "Absolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).")
fs.MarkDeprecated("resource-container", "This feature will be removed in a later release.") fs.MarkDeprecated("resource-container", "This feature will be removed in a later release.")
fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization information (the master location is set by the master flag).") fs.StringVar(&s.Kubeconfig, "kubeconfig", s.Kubeconfig, "Path to kubeconfig file with authorization information (the master location is set by the master flag).")
fs.Var(componentconfig.PortRangeVar{Val: &s.PortRange}, "proxy-port-range", "Range of host ports (beginPort-endPort, inclusive) that may be consumed in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen.") fs.Var(componentconfig.PortRangeVar{Val: &s.PortRange}, "proxy-port-range", "Range of host ports (beginPort-endPort, inclusive) that may be consumed in order to proxy service traffic. If unspecified (0-0) then ports will be randomly chosen.")
fs.StringVar(&s.HostnameOverride, "hostname-override", s.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.") fs.StringVar(&s.HostnameOverride, "hostname-override", s.HostnameOverride, "If non-empty, will use this string as identification instead of the actual hostname.")
fs.Var(&s.Mode, "proxy-mode", "Which proxy mode to use: 'userspace' (older) or 'iptables' (faster). If blank, look at the Node object on the Kubernetes API and respect the '"+ExperimentalProxyModeAnnotation+"' annotation if provided. Otherwise use the best-available proxy (currently iptables). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient, this always falls back to the userspace proxy.") fs.Var(&s.Mode, "proxy-mode", "Which proxy mode to use: 'userspace' (older) or 'iptables' (faster). If blank, look at the Node object on the Kubernetes API and respect the '"+ExperimentalProxyModeAnnotation+"' annotation if provided. Otherwise use the best-available proxy (currently iptables). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient, this always falls back to the userspace proxy.")
fs.IntVar(s.IPTablesMasqueradeBit, "iptables-masquerade-bit", util.IntPtrDerefOr(s.IPTablesMasqueradeBit, 14), "If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].") fs.Int32Var(s.IPTablesMasqueradeBit, "iptables-masquerade-bit", util.Int32PtrDerefOr(s.IPTablesMasqueradeBit, 14), "If using the pure iptables proxy, the bit of the fwmark space to mark packets requiring SNAT with. Must be within the range [0, 31].")
fs.DurationVar(&s.IPTablesSyncPeriod.Duration, "iptables-sync-period", s.IPTablesSyncPeriod.Duration, "How often iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.") fs.DurationVar(&s.IPTablesSyncPeriod.Duration, "iptables-sync-period", s.IPTablesSyncPeriod.Duration, "How often iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.")
fs.DurationVar(&s.ConfigSyncPeriod, "config-sync-period", s.ConfigSyncPeriod, "How often configuration from the apiserver is refreshed. Must be greater than 0.") fs.DurationVar(&s.ConfigSyncPeriod, "config-sync-period", s.ConfigSyncPeriod, "How often configuration from the apiserver is refreshed. Must be greater than 0.")
fs.BoolVar(&s.MasqueradeAll, "masquerade-all", s.MasqueradeAll, "If using the pure iptables proxy, SNAT everything") fs.BoolVar(&s.MasqueradeAll, "masquerade-all", s.MasqueradeAll, "If using the pure iptables proxy, SNAT everything")
...@@ -80,8 +80,8 @@ func (s *ProxyServerConfig) AddFlags(fs *pflag.FlagSet) { ...@@ -80,8 +80,8 @@ func (s *ProxyServerConfig) AddFlags(fs *pflag.FlagSet) {
fs.BoolVar(&s.CleanupAndExit, "cleanup-iptables", s.CleanupAndExit, "If true cleanup iptables rules and exit.") fs.BoolVar(&s.CleanupAndExit, "cleanup-iptables", s.CleanupAndExit, "If true cleanup iptables rules and exit.")
fs.StringVar(&s.ContentType, "kube-api-content-type", s.ContentType, "ContentType of requests sent to apiserver. Passing application/vnd.kubernetes.protobuf is an experimental feature now.") fs.StringVar(&s.ContentType, "kube-api-content-type", s.ContentType, "ContentType of requests sent to apiserver. Passing application/vnd.kubernetes.protobuf is an experimental feature now.")
fs.Float32Var(&s.KubeAPIQPS, "kube-api-qps", s.KubeAPIQPS, "QPS to use while talking with kubernetes apiserver") fs.Float32Var(&s.KubeAPIQPS, "kube-api-qps", s.KubeAPIQPS, "QPS to use while talking with kubernetes apiserver")
fs.IntVar(&s.KubeAPIBurst, "kube-api-burst", s.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver") fs.Int32Var(&s.KubeAPIBurst, "kube-api-burst", s.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver")
fs.DurationVar(&s.UDPIdleTimeout.Duration, "udp-timeout", s.UDPIdleTimeout.Duration, "How long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxy-mode=userspace") fs.DurationVar(&s.UDPIdleTimeout.Duration, "udp-timeout", s.UDPIdleTimeout.Duration, "How long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxy-mode=userspace")
fs.IntVar(&s.ConntrackMax, "conntrack-max", s.ConntrackMax, "Maximum number of NAT connections to track (0 to leave as-is)") fs.Int32Var(&s.ConntrackMax, "conntrack-max", s.ConntrackMax, "Maximum number of NAT connections to track (0 to leave as-is)")
fs.DurationVar(&s.ConntrackTCPEstablishedTimeout.Duration, "conntrack-tcp-timeout-established", s.ConntrackTCPEstablishedTimeout.Duration, "Idle timeout for established TCP connections (0 to leave as-is)") fs.DurationVar(&s.ConntrackTCPEstablishedTimeout.Duration, "conntrack-tcp-timeout-established", s.ConntrackTCPEstablishedTimeout.Duration, "Idle timeout for established TCP connections (0 to leave as-is)")
} }
...@@ -150,7 +150,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err ...@@ -150,7 +150,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err
var oomAdjuster *oom.OOMAdjuster var oomAdjuster *oom.OOMAdjuster
if config.OOMScoreAdj != nil { if config.OOMScoreAdj != nil {
oomAdjuster = oom.NewOOMAdjuster() oomAdjuster = oom.NewOOMAdjuster()
if err := oomAdjuster.ApplyOOMScoreAdj(0, *config.OOMScoreAdj); err != nil { if err := oomAdjuster.ApplyOOMScoreAdj(0, int(*config.OOMScoreAdj)); err != nil {
glog.V(2).Info(err) glog.V(2).Info(err)
} }
} }
...@@ -181,7 +181,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err ...@@ -181,7 +181,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err
kubeconfig.ContentType = config.ContentType kubeconfig.ContentType = config.ContentType
// Override kubeconfig qps/burst settings from flags // Override kubeconfig qps/burst settings from flags
kubeconfig.QPS = config.KubeAPIQPS kubeconfig.QPS = config.KubeAPIQPS
kubeconfig.Burst = config.KubeAPIBurst kubeconfig.Burst = int(config.KubeAPIBurst)
client, err := kubeclient.New(kubeconfig) client, err := kubeclient.New(kubeconfig)
if err != nil { if err != nil {
...@@ -204,7 +204,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err ...@@ -204,7 +204,7 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err
return nil, fmt.Errorf("Unable to read IPTablesMasqueradeBit from config") return nil, fmt.Errorf("Unable to read IPTablesMasqueradeBit from config")
} }
proxierIptables, err := iptables.NewProxier(iptInterface, execer, config.IPTablesSyncPeriod.Duration, config.MasqueradeAll, *config.IPTablesMasqueradeBit, config.ClusterCIDR) proxierIptables, err := iptables.NewProxier(iptInterface, execer, config.IPTablesSyncPeriod.Duration, config.MasqueradeAll, int(*config.IPTablesMasqueradeBit), config.ClusterCIDR)
if err != nil { if err != nil {
glog.Fatalf("Unable to create proxier: %v", err) glog.Fatalf("Unable to create proxier: %v", err)
} }
...@@ -289,7 +289,7 @@ func (s *ProxyServer) Run() error { ...@@ -289,7 +289,7 @@ func (s *ProxyServer) Run() error {
}) })
configz.InstallHandler(http.DefaultServeMux) configz.InstallHandler(http.DefaultServeMux)
go wait.Until(func() { go wait.Until(func() {
err := http.ListenAndServe(s.Config.HealthzBindAddress+":"+strconv.Itoa(s.Config.HealthzPort), nil) err := http.ListenAndServe(s.Config.HealthzBindAddress+":"+strconv.Itoa(int(s.Config.HealthzPort)), nil)
if err != nil { if err != nil {
glog.Errorf("Starting health server failed: %v", err) glog.Errorf("Starting health server failed: %v", err)
} }
...@@ -299,7 +299,7 @@ func (s *ProxyServer) Run() error { ...@@ -299,7 +299,7 @@ func (s *ProxyServer) Run() error {
// Tune conntrack, if requested // Tune conntrack, if requested
if s.Conntracker != nil { if s.Conntracker != nil {
if s.Config.ConntrackMax > 0 { if s.Config.ConntrackMax > 0 {
if err := s.Conntracker.SetMax(s.Config.ConntrackMax); err != nil { if err := s.Conntracker.SetMax(int(s.Config.ConntrackMax)); err != nil {
return err return err
} }
} }
......
...@@ -160,13 +160,13 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) { ...@@ -160,13 +160,13 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
imageGCPolicy := kubelet.ImageGCPolicy{ imageGCPolicy := kubelet.ImageGCPolicy{
MinAge: s.ImageMinimumGCAge.Duration, MinAge: s.ImageMinimumGCAge.Duration,
HighThresholdPercent: s.ImageGCHighThresholdPercent, HighThresholdPercent: int(s.ImageGCHighThresholdPercent),
LowThresholdPercent: s.ImageGCLowThresholdPercent, LowThresholdPercent: int(s.ImageGCLowThresholdPercent),
} }
diskSpacePolicy := kubelet.DiskSpacePolicy{ diskSpacePolicy := kubelet.DiskSpacePolicy{
DockerFreeDiskMB: s.LowDiskSpaceThresholdMB, DockerFreeDiskMB: int(s.LowDiskSpaceThresholdMB),
RootFreeDiskMB: s.LowDiskSpaceThresholdMB, RootFreeDiskMB: int(s.LowDiskSpaceThresholdMB),
} }
manifestURLHeader := make(http.Header) manifestURLHeader := make(http.Header)
...@@ -205,7 +205,7 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) { ...@@ -205,7 +205,7 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
EnableCustomMetrics: s.EnableCustomMetrics, EnableCustomMetrics: s.EnableCustomMetrics,
EnableDebuggingHandlers: s.EnableDebuggingHandlers, EnableDebuggingHandlers: s.EnableDebuggingHandlers,
EnableServer: s.EnableServer, EnableServer: s.EnableServer,
EventBurst: s.EventBurst, EventBurst: int(s.EventBurst),
EventRecordQPS: s.EventRecordQPS, EventRecordQPS: s.EventRecordQPS,
FileCheckFrequency: s.FileCheckFrequency.Duration, FileCheckFrequency: s.FileCheckFrequency.Duration,
HostnameOverride: s.HostnameOverride, HostnameOverride: s.HostnameOverride,
...@@ -218,10 +218,10 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) { ...@@ -218,10 +218,10 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
ManifestURL: s.ManifestURL, ManifestURL: s.ManifestURL,
ManifestURLHeader: manifestURLHeader, ManifestURLHeader: manifestURLHeader,
MasterServiceNamespace: s.MasterServiceNamespace, MasterServiceNamespace: s.MasterServiceNamespace,
MaxContainerCount: s.MaxContainerCount, MaxContainerCount: int(s.MaxContainerCount),
MaxOpenFiles: s.MaxOpenFiles, MaxOpenFiles: s.MaxOpenFiles,
MaxPerPodContainerCount: s.MaxPerPodContainerCount, MaxPerPodContainerCount: int(s.MaxPerPodContainerCount),
MaxPods: s.MaxPods, MaxPods: int(s.MaxPods),
MinimumGCAge: s.MinimumGCAge.Duration, MinimumGCAge: s.MinimumGCAge.Duration,
Mounter: mounter, Mounter: mounter,
NetworkPluginName: s.NetworkPluginName, NetworkPluginName: s.NetworkPluginName,
...@@ -238,7 +238,7 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) { ...@@ -238,7 +238,7 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
ReadOnlyPort: s.ReadOnlyPort, ReadOnlyPort: s.ReadOnlyPort,
RegisterNode: s.RegisterNode, RegisterNode: s.RegisterNode,
RegisterSchedulable: s.RegisterSchedulable, RegisterSchedulable: s.RegisterSchedulable,
RegistryBurst: s.RegistryBurst, RegistryBurst: int(s.RegistryBurst),
RegistryPullQPS: s.RegistryPullQPS, RegistryPullQPS: s.RegistryPullQPS,
ResolverConfig: s.ResolverConfig, ResolverConfig: s.ResolverConfig,
Reservation: *reservation, Reservation: *reservation,
...@@ -302,7 +302,7 @@ func run(s *options.KubeletServer, kcfg *KubeletConfig) (err error) { ...@@ -302,7 +302,7 @@ func run(s *options.KubeletServer, kcfg *KubeletConfig) (err error) {
// make a separate client for events // make a separate client for events
eventClientConfig := *clientConfig eventClientConfig := *clientConfig
eventClientConfig.QPS = s.EventRecordQPS eventClientConfig.QPS = s.EventRecordQPS
eventClientConfig.Burst = s.EventBurst eventClientConfig.Burst = int(s.EventBurst)
kcfg.EventClient, err = clientset.NewForConfig(&eventClientConfig) kcfg.EventClient, err = clientset.NewForConfig(&eventClientConfig)
} }
if err != nil && len(s.APIServerList) > 0 { if err != nil && len(s.APIServerList) > 0 {
...@@ -349,7 +349,7 @@ func run(s *options.KubeletServer, kcfg *KubeletConfig) (err error) { ...@@ -349,7 +349,7 @@ func run(s *options.KubeletServer, kcfg *KubeletConfig) (err error) {
// TODO(vmarmol): Do this through container config. // TODO(vmarmol): Do this through container config.
oomAdjuster := kcfg.OOMAdjuster oomAdjuster := kcfg.OOMAdjuster
if err := oomAdjuster.ApplyOOMScoreAdj(0, s.OOMScoreAdj); err != nil { if err := oomAdjuster.ApplyOOMScoreAdj(0, int(s.OOMScoreAdj)); err != nil {
glog.Warning(err) glog.Warning(err)
} }
...@@ -360,7 +360,7 @@ func run(s *options.KubeletServer, kcfg *KubeletConfig) (err error) { ...@@ -360,7 +360,7 @@ func run(s *options.KubeletServer, kcfg *KubeletConfig) (err error) {
if s.HealthzPort > 0 { if s.HealthzPort > 0 {
healthz.DefaultHealthz() healthz.DefaultHealthz()
go wait.Until(func() { go wait.Until(func() {
err := http.ListenAndServe(net.JoinHostPort(s.HealthzBindAddress, strconv.Itoa(s.HealthzPort)), nil) err := http.ListenAndServe(net.JoinHostPort(s.HealthzBindAddress, strconv.Itoa(int(s.HealthzPort))), nil)
if err != nil { if err != nil {
glog.Errorf("Starting health server failed: %v", err) glog.Errorf("Starting health server failed: %v", err)
} }
...@@ -473,7 +473,7 @@ func CreateAPIServerClientConfig(s *options.KubeletServer) (*restclient.Config, ...@@ -473,7 +473,7 @@ func CreateAPIServerClientConfig(s *options.KubeletServer) (*restclient.Config,
clientConfig.ContentType = s.ContentType clientConfig.ContentType = s.ContentType
// Override kubeconfig qps/burst settings from flags // Override kubeconfig qps/burst settings from flags
clientConfig.QPS = s.KubeAPIQPS clientConfig.QPS = s.KubeAPIQPS
clientConfig.Burst = s.KubeAPIBurst clientConfig.Burst = int(s.KubeAPIBurst)
addChaosToClientConfig(s, clientConfig) addChaosToClientConfig(s, clientConfig)
return clientConfig, nil return clientConfig, nil
...@@ -801,7 +801,7 @@ func CreateAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod ...@@ -801,7 +801,7 @@ func CreateAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod
} }
daemonEndpoints := &api.NodeDaemonEndpoints{ daemonEndpoints := &api.NodeDaemonEndpoints{
KubeletEndpoint: api.DaemonEndpoint{Port: int(kc.Port)}, KubeletEndpoint: api.DaemonEndpoint{Port: int32(kc.Port)},
} }
pc = kc.PodConfig pc = kc.PodConfig
......
...@@ -127,20 +127,20 @@ func (s *CMServer) Run(_ []string) error { ...@@ -127,20 +127,20 @@ func (s *CMServer) Run(_ []string) error {
} }
mux.Handle("/metrics", prometheus.Handler()) mux.Handle("/metrics", prometheus.Handler())
server := &http.Server{ server := &http.Server{
Addr: net.JoinHostPort(s.Address, strconv.Itoa(s.Port)), Addr: net.JoinHostPort(s.Address, strconv.Itoa(int(s.Port))),
Handler: mux, Handler: mux,
} }
glog.Fatal(server.ListenAndServe()) glog.Fatal(server.ListenAndServe())
}() }()
endpoints := s.createEndpointController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "endpoint-controller"))) endpoints := s.createEndpointController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "endpoint-controller")))
go endpoints.Run(s.ConcurrentEndpointSyncs, wait.NeverStop) go endpoints.Run(int(s.ConcurrentEndpointSyncs), wait.NeverStop)
go replicationcontroller.NewReplicationManagerFromClient(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "replication-controller")), s.resyncPeriod, replicationcontroller.BurstReplicas, s.LookupCacheSizeForRC). go replicationcontroller.NewReplicationManagerFromClient(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "replication-controller")), s.resyncPeriod, replicationcontroller.BurstReplicas, int(s.LookupCacheSizeForRC)).
Run(s.ConcurrentRCSyncs, wait.NeverStop) Run(int(s.ConcurrentRCSyncs), wait.NeverStop)
if s.TerminatedPodGCThreshold > 0 { if s.TerminatedPodGCThreshold > 0 {
go gc.New(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "garbage-collector")), s.resyncPeriod, s.TerminatedPodGCThreshold). go gc.New(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "garbage-collector")), s.resyncPeriod, int(s.TerminatedPodGCThreshold)).
Run(wait.NeverStop) Run(wait.NeverStop)
} }
...@@ -154,8 +154,8 @@ func (s *CMServer) Run(_ []string) error { ...@@ -154,8 +154,8 @@ func (s *CMServer) Run(_ []string) error {
} }
_, clusterCIDR, _ := net.ParseCIDR(s.ClusterCIDR) _, clusterCIDR, _ := net.ParseCIDR(s.ClusterCIDR)
nodeController := nodecontroller.NewNodeController(cloud, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "node-controller")), nodeController := nodecontroller.NewNodeController(cloud, clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "node-controller")),
s.PodEvictionTimeout.Duration, flowcontrol.NewTokenBucketRateLimiter(s.DeletingPodsQps, s.DeletingPodsBurst), s.PodEvictionTimeout.Duration, flowcontrol.NewTokenBucketRateLimiter(s.DeletingPodsQps, int(s.DeletingPodsBurst)),
flowcontrol.NewTokenBucketRateLimiter(s.DeletingPodsQps, s.DeletingPodsBurst), flowcontrol.NewTokenBucketRateLimiter(s.DeletingPodsQps, int(s.DeletingPodsBurst)),
s.NodeMonitorGracePeriod.Duration, s.NodeStartupGracePeriod.Duration, s.NodeMonitorPeriod.Duration, clusterCIDR, s.AllocateNodeCIDRs) s.NodeMonitorGracePeriod.Duration, s.NodeStartupGracePeriod.Duration, s.NodeMonitorPeriod.Duration, clusterCIDR, s.AllocateNodeCIDRs)
nodeController.Run(s.NodeSyncPeriod.Duration) nodeController.Run(s.NodeSyncPeriod.Duration)
...@@ -195,7 +195,7 @@ func (s *CMServer) Run(_ []string) error { ...@@ -195,7 +195,7 @@ func (s *CMServer) Run(_ []string) error {
ReplenishmentResyncPeriod: s.resyncPeriod, ReplenishmentResyncPeriod: s.resyncPeriod,
ControllerFactory: resourcequotacontroller.NewReplenishmentControllerFactoryFromClient(resourceQuotaControllerClient), ControllerFactory: resourcequotacontroller.NewReplenishmentControllerFactoryFromClient(resourceQuotaControllerClient),
} }
go resourcequotacontroller.NewResourceQuotaController(resourceQuotaControllerOptions).Run(s.ConcurrentResourceQuotaSyncs, wait.NeverStop) go resourcequotacontroller.NewResourceQuotaController(resourceQuotaControllerOptions).Run(int(s.ConcurrentResourceQuotaSyncs), wait.NeverStop)
// If apiserver is not running we should wait for some time and fail only then. This is particularly // If apiserver is not running we should wait for some time and fail only then. This is particularly
// important when we start apiserver and controller manager at the same time. // important when we start apiserver and controller manager at the same time.
...@@ -225,7 +225,7 @@ func (s *CMServer) Run(_ []string) error { ...@@ -225,7 +225,7 @@ func (s *CMServer) Run(_ []string) error {
glog.Fatalf("Failed to get supported resources from server: %v", err) glog.Fatalf("Failed to get supported resources from server: %v", err)
} }
namespaceController := namespacecontroller.NewNamespaceController(namespaceKubeClient, namespaceClientPool, groupVersionResources, s.NamespaceSyncPeriod.Duration, api.FinalizerKubernetes) namespaceController := namespacecontroller.NewNamespaceController(namespaceKubeClient, namespaceClientPool, groupVersionResources, s.NamespaceSyncPeriod.Duration, api.FinalizerKubernetes)
go namespaceController.Run(s.ConcurrentNamespaceSyncs, wait.NeverStop) go namespaceController.Run(int(s.ConcurrentNamespaceSyncs), wait.NeverStop)
groupVersion := "extensions/v1beta1" groupVersion := "extensions/v1beta1"
resources, found := resourceMap[groupVersion] resources, found := resourceMap[groupVersion]
...@@ -248,26 +248,26 @@ func (s *CMServer) Run(_ []string) error { ...@@ -248,26 +248,26 @@ func (s *CMServer) Run(_ []string) error {
if containsResource(resources, "daemonsets") { if containsResource(resources, "daemonsets") {
glog.Infof("Starting daemon set controller") glog.Infof("Starting daemon set controller")
go daemon.NewDaemonSetsControllerFromClient(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "daemon-set-controller")), s.resyncPeriod, s.LookupCacheSizeForDaemonSet). go daemon.NewDaemonSetsControllerFromClient(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "daemon-set-controller")), s.resyncPeriod, int(s.LookupCacheSizeForDaemonSet)).
Run(s.ConcurrentDaemonSetSyncs, wait.NeverStop) Run(int(s.ConcurrentDaemonSetSyncs), wait.NeverStop)
} }
if containsResource(resources, "jobs") { if containsResource(resources, "jobs") {
glog.Infof("Starting job controller") glog.Infof("Starting job controller")
go job.NewJobControllerFromClient(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "job-controller")), s.resyncPeriod). go job.NewJobControllerFromClient(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "job-controller")), s.resyncPeriod).
Run(s.ConcurrentJobSyncs, wait.NeverStop) Run(int(s.ConcurrentJobSyncs), wait.NeverStop)
} }
if containsResource(resources, "deployments") { if containsResource(resources, "deployments") {
glog.Infof("Starting deployment controller") glog.Infof("Starting deployment controller")
go deployment.NewDeploymentController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "deployment-controller")), s.resyncPeriod). go deployment.NewDeploymentController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "deployment-controller")), s.resyncPeriod).
Run(s.ConcurrentDeploymentSyncs, wait.NeverStop) Run(int(s.ConcurrentDeploymentSyncs), wait.NeverStop)
} }
if containsResource(resources, "replicasets") { if containsResource(resources, "replicasets") {
glog.Infof("Starting ReplicaSet controller") glog.Infof("Starting ReplicaSet controller")
go replicaset.NewReplicaSetController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "replicaset-controller")), s.resyncPeriod, replicaset.BurstReplicas, s.LookupCacheSizeForRS). go replicaset.NewReplicaSetController(clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "replicaset-controller")), s.resyncPeriod, replicaset.BurstReplicas, int(s.LookupCacheSizeForRS)).
Run(s.ConcurrentRSSyncs, wait.NeverStop) Run(int(s.ConcurrentRSSyncs), wait.NeverStop)
} }
} }
...@@ -286,7 +286,7 @@ func (s *CMServer) Run(_ []string) error { ...@@ -286,7 +286,7 @@ func (s *CMServer) Run(_ []string) error {
pvRecycler, err := persistentvolumecontroller.NewPersistentVolumeRecycler( pvRecycler, err := persistentvolumecontroller.NewPersistentVolumeRecycler(
clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "persistent-volume-recycler")), clientset.NewForConfigOrDie(restclient.AddUserAgent(kubeconfig, "persistent-volume-recycler")),
s.PVClaimBinderSyncPeriod.Duration, s.PVClaimBinderSyncPeriod.Duration,
s.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.MaximumRetry, int(s.VolumeConfiguration.PersistentVolumeRecyclerConfiguration.MaximumRetry),
kubecontrollermanager.ProbeRecyclableVolumePlugins(s.VolumeConfiguration), kubecontrollermanager.ProbeRecyclableVolumePlugins(s.VolumeConfiguration),
cloud, cloud,
) )
......
...@@ -514,7 +514,7 @@ func NewTestPod(i int) *api.Pod { ...@@ -514,7 +514,7 @@ func NewTestPod(i int) *api.Pod {
Name: "foo", Name: "foo",
Ports: []api.ContainerPort{ Ports: []api.ContainerPort{
{ {
ContainerPort: 8000 + i, ContainerPort: int32(8000 + i),
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
}, },
}, },
......
...@@ -191,7 +191,7 @@ func (s *KubeletExecutorServer) runKubelet( ...@@ -191,7 +191,7 @@ func (s *KubeletExecutorServer) runKubelet(
// make a separate client for events // make a separate client for events
eventClientConfig.QPS = s.EventRecordQPS eventClientConfig.QPS = s.EventRecordQPS
eventClientConfig.Burst = s.EventBurst eventClientConfig.Burst = int(s.EventBurst)
kcfg.EventClient, err = clientset.NewForConfig(eventClientConfig) kcfg.EventClient, err = clientset.NewForConfig(eventClientConfig)
if err != nil { if err != nil {
return err return err
......
...@@ -140,7 +140,7 @@ func (b *binder) prepareTaskForLaunch(ctx api.Context, machine string, task *pod ...@@ -140,7 +140,7 @@ func (b *binder) prepareTaskForLaunch(ctx api.Context, machine string, task *pod
oemPorts := pod.Spec.Containers[entry.ContainerIdx].Ports oemPorts := pod.Spec.Containers[entry.ContainerIdx].Ports
ports := append([]api.ContainerPort{}, oemPorts...) ports := append([]api.ContainerPort{}, oemPorts...)
p := &ports[entry.PortIdx] p := &ports[entry.PortIdx]
p.HostPort = int(entry.OfferPort) p.HostPort = int32(entry.OfferPort)
op := strconv.FormatUint(entry.OfferPort, 10) op := strconv.FormatUint(entry.OfferPort, 10)
pod.Annotations[fmt.Sprintf(annotation.PortMappingKeyFormat, p.Protocol, p.ContainerPort)] = op pod.Annotations[fmt.Sprintf(annotation.PortMappingKeyFormat, p.Protocol, p.ContainerPort)] = op
if p.Name != "" { if p.Name != "" {
......
...@@ -293,7 +293,7 @@ func NewTestPod() (*api.Pod, int) { ...@@ -293,7 +293,7 @@ func NewTestPod() (*api.Pod, int) {
{ {
Ports: []api.ContainerPort{ Ports: []api.ContainerPort{
{ {
ContainerPort: 8000 + currentPodNum, ContainerPort: int32(8000 + currentPodNum),
Protocol: api.ProtocolTCP, Protocol: api.ProtocolTCP,
}, },
}, },
......
...@@ -73,7 +73,7 @@ func (m *SchedulerServer) createSchedulerServiceIfNeeded(serviceName string, ser ...@@ -73,7 +73,7 @@ func (m *SchedulerServer) createSchedulerServiceIfNeeded(serviceName string, ser
Labels: map[string]string{"provider": "k8sm", "component": "scheduler"}, Labels: map[string]string{"provider": "k8sm", "component": "scheduler"},
}, },
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Ports: []api.ServicePort{{Port: servicePort, Protocol: api.ProtocolTCP}}, Ports: []api.ServicePort{{Port: int32(servicePort), Protocol: api.ProtocolTCP}},
// maintained by this code, not by the pod selector // maintained by this code, not by the pod selector
Selector: nil, Selector: nil,
SessionAffinity: api.ServiceAffinityNone, SessionAffinity: api.ServiceAffinityNone,
...@@ -96,7 +96,7 @@ func (m *SchedulerServer) setEndpoints(serviceName string, ip net.IP, port int) ...@@ -96,7 +96,7 @@ func (m *SchedulerServer) setEndpoints(serviceName string, ip net.IP, port int)
// The setting we want to find. // The setting we want to find.
want := []api.EndpointSubset{{ want := []api.EndpointSubset{{
Addresses: []api.EndpointAddress{{IP: ip.String()}}, Addresses: []api.EndpointAddress{{IP: ip.String()}},
Ports: []api.EndpointPort{{Port: port, Protocol: api.ProtocolTCP}}, Ports: []api.EndpointPort{{Port: int32(port), Protocol: api.ProtocolTCP}},
}} }}
ctx := api.NewDefaultContext() ctx := api.NewDefaultContext()
......
...@@ -320,7 +320,7 @@ func (e *endpointController) syncService(key string) { ...@@ -320,7 +320,7 @@ func (e *endpointController) syncService(key string) {
} }
// HACK(jdef): use HostIP instead of pod.CurrentState.PodIP for generic mesos compat // HACK(jdef): use HostIP instead of pod.CurrentState.PodIP for generic mesos compat
epp := api.EndpointPort{Name: portName, Port: portNum, Protocol: portProto} epp := api.EndpointPort{Name: portName, Port: int32(portNum), Protocol: portProto}
epa := api.EndpointAddress{IP: pod.Status.HostIP, TargetRef: &api.ObjectReference{ epa := api.EndpointAddress{IP: pod.Status.HostIP, TargetRef: &api.ObjectReference{
Kind: "Pod", Kind: "Pod",
Namespace: pod.ObjectMeta.Namespace, Namespace: pod.ObjectMeta.Namespace,
...@@ -416,7 +416,7 @@ func findPort(pod *api.Pod, svcPort *api.ServicePort) (int, int, error) { ...@@ -416,7 +416,7 @@ func findPort(pod *api.Pod, svcPort *api.ServicePort) (int, int, error) {
for _, port := range container.Ports { for _, port := range container.Ports {
if port.Name == name && port.Protocol == svcPort.Protocol { if port.Name == name && port.Protocol == svcPort.Protocol {
hostPort, err := findMappedPortName(pod, port.Protocol, name) hostPort, err := findMappedPortName(pod, port.Protocol, name)
return hostPort, port.ContainerPort, err return hostPort, int(port.ContainerPort), err
} }
} }
} }
...@@ -429,9 +429,9 @@ func findPort(pod *api.Pod, svcPort *api.ServicePort) (int, int, error) { ...@@ -429,9 +429,9 @@ func findPort(pod *api.Pod, svcPort *api.ServicePort) (int, int, error) {
p := portName.IntValue() p := portName.IntValue()
for _, container := range pod.Spec.Containers { for _, container := range pod.Spec.Containers {
for _, port := range container.Ports { for _, port := range container.Ports {
if port.ContainerPort == p && port.Protocol == svcPort.Protocol { if int(port.ContainerPort) == p && port.Protocol == svcPort.Protocol {
hostPort, err := findMappedPort(pod, port.Protocol, p) hostPort, err := findMappedPort(pod, port.Protocol, p)
return hostPort, port.ContainerPort, err return hostPort, int(port.ContainerPort), err
} }
} }
} }
......
...@@ -889,7 +889,7 @@ func DeepCopy_api_FCVolumeSource(in FCVolumeSource, out *FCVolumeSource, c *conv ...@@ -889,7 +889,7 @@ func DeepCopy_api_FCVolumeSource(in FCVolumeSource, out *FCVolumeSource, c *conv
} }
if in.Lun != nil { if in.Lun != nil {
in, out := in.Lun, &out.Lun in, out := in.Lun, &out.Lun
*out = new(int) *out = new(int32)
**out = *in **out = *in
} else { } else {
out.Lun = nil out.Lun = nil
......
...@@ -49,7 +49,7 @@ func FindPort(pod *api.Pod, svcPort *api.ServicePort) (int, error) { ...@@ -49,7 +49,7 @@ func FindPort(pod *api.Pod, svcPort *api.ServicePort) (int, error) {
for _, container := range pod.Spec.Containers { for _, container := range pod.Spec.Containers {
for _, port := range container.Ports { for _, port := range container.Ports {
if port.Name == name && port.Protocol == svcPort.Protocol { if port.Name == name && port.Protocol == svcPort.Protocol {
return port.ContainerPort, nil return int(port.ContainerPort), nil
} }
} }
} }
......
...@@ -159,8 +159,8 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source) ...@@ -159,8 +159,8 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source)
}, },
func(j *batch.JobSpec, c fuzz.Continue) { func(j *batch.JobSpec, c fuzz.Continue) {
c.FuzzNoCustom(j) // fuzz self without calling this function again c.FuzzNoCustom(j) // fuzz self without calling this function again
completions := int(c.Rand.Int31()) completions := int32(c.Rand.Int31())
parallelism := int(c.Rand.Int31()) parallelism := int32(c.Rand.Int31())
j.Completions = &completions j.Completions = &completions
j.Parallelism = &parallelism j.Parallelism = &parallelism
if c.Rand.Int31()%2 == 0 { if c.Rand.Int31()%2 == 0 {
...@@ -395,9 +395,9 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source) ...@@ -395,9 +395,9 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source)
}, },
func(s *extensions.HorizontalPodAutoscalerSpec, c fuzz.Continue) { func(s *extensions.HorizontalPodAutoscalerSpec, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again c.FuzzNoCustom(s) // fuzz self without calling this function again
minReplicas := int(c.Rand.Int31()) minReplicas := int32(c.Rand.Int31())
s.MinReplicas = &minReplicas s.MinReplicas = &minReplicas
s.CPUUtilization = &extensions.CPUTargetUtilization{TargetPercentage: int(int32(c.RandUint64()))} s.CPUUtilization = &extensions.CPUTargetUtilization{TargetPercentage: int32(c.RandUint64())}
}, },
func(s *extensions.SubresourceReference, c fuzz.Continue) { func(s *extensions.SubresourceReference, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again c.FuzzNoCustom(s) // fuzz self without calling this function again
......
...@@ -456,7 +456,7 @@ type GCEPersistentDiskVolumeSource struct { ...@@ -456,7 +456,7 @@ type GCEPersistentDiskVolumeSource struct {
// Optional: Partition on the disk to mount. // Optional: Partition on the disk to mount.
// If omitted, kubelet will attempt to mount the device name. // If omitted, kubelet will attempt to mount the device name.
// Ex. For /dev/sda1, this field is "1", for /dev/sda, this field is 0 or empty. // Ex. For /dev/sda1, this field is "1", for /dev/sda, this field is 0 or empty.
Partition int `json:"partition,omitempty"` Partition int32 `json:"partition,omitempty"`
// Optional: Defaults to false (read/write). ReadOnly here will force // Optional: Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts. // the ReadOnly setting in VolumeMounts.
ReadOnly bool `json:"readOnly,omitempty"` ReadOnly bool `json:"readOnly,omitempty"`
...@@ -472,7 +472,7 @@ type ISCSIVolumeSource struct { ...@@ -472,7 +472,7 @@ type ISCSIVolumeSource struct {
// Required: target iSCSI Qualified Name // Required: target iSCSI Qualified Name
IQN string `json:"iqn,omitempty"` IQN string `json:"iqn,omitempty"`
// Required: iSCSI target lun number // Required: iSCSI target lun number
Lun int `json:"lun,omitempty"` Lun int32 `json:"lun,omitempty"`
// Optional: Defaults to 'default' (tcp). iSCSI interface name that uses an iSCSI transport. // Optional: Defaults to 'default' (tcp). iSCSI interface name that uses an iSCSI transport.
ISCSIInterface string `json:"iscsiInterface,omitempty"` ISCSIInterface string `json:"iscsiInterface,omitempty"`
// Filesystem type to mount. // Filesystem type to mount.
...@@ -492,7 +492,7 @@ type FCVolumeSource struct { ...@@ -492,7 +492,7 @@ type FCVolumeSource struct {
// Required: FC target world wide names (WWNs) // Required: FC target world wide names (WWNs)
TargetWWNs []string `json:"targetWWNs"` TargetWWNs []string `json:"targetWWNs"`
// Required: FC target lun number // Required: FC target lun number
Lun *int `json:"lun"` Lun *int32 `json:"lun"`
// Filesystem type to mount. // Filesystem type to mount.
// Must be a filesystem type supported by the host operating system. // Must be a filesystem type supported by the host operating system.
// Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
...@@ -542,7 +542,7 @@ type AWSElasticBlockStoreVolumeSource struct { ...@@ -542,7 +542,7 @@ type AWSElasticBlockStoreVolumeSource struct {
// Optional: Partition on the disk to mount. // Optional: Partition on the disk to mount.
// If omitted, kubelet will attempt to mount the device name. // If omitted, kubelet will attempt to mount the device name.
// Ex. For /dev/sda1, this field is "1", for /dev/sda, this field is 0 or empty. // Ex. For /dev/sda1, this field is "1", for /dev/sda, this field is 0 or empty.
Partition int `json:"partition,omitempty"` Partition int32 `json:"partition,omitempty"`
// Optional: Defaults to false (read/write). ReadOnly here will force // Optional: Defaults to false (read/write). ReadOnly here will force
// the ReadOnly setting in VolumeMounts. // the ReadOnly setting in VolumeMounts.
ReadOnly bool `json:"readOnly,omitempty"` ReadOnly bool `json:"readOnly,omitempty"`
...@@ -731,9 +731,9 @@ type ContainerPort struct { ...@@ -731,9 +731,9 @@ type ContainerPort struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
// Optional: If specified, this must be a valid port number, 0 < x < 65536. // Optional: If specified, this must be a valid port number, 0 < x < 65536.
// If HostNetwork is specified, this must match ContainerPort. // If HostNetwork is specified, this must match ContainerPort.
HostPort int `json:"hostPort,omitempty"` HostPort int32 `json:"hostPort,omitempty"`
// Required: This must be a valid port number, 0 < x < 65536. // Required: This must be a valid port number, 0 < x < 65536.
ContainerPort int `json:"containerPort"` ContainerPort int32 `json:"containerPort"`
// Required: Supports "TCP" and "UDP". // Required: Supports "TCP" and "UDP".
Protocol Protocol `json:"protocol,omitempty"` Protocol Protocol `json:"protocol,omitempty"`
// Optional: What host IP to bind the external port to. // Optional: What host IP to bind the external port to.
...@@ -858,16 +858,16 @@ type Probe struct { ...@@ -858,16 +858,16 @@ type Probe struct {
// The action taken to determine the health of a container // The action taken to determine the health of a container
Handler `json:",inline"` Handler `json:",inline"`
// Length of time before health checking is activated. In seconds. // Length of time before health checking is activated. In seconds.
InitialDelaySeconds int `json:"initialDelaySeconds,omitempty"` InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
// Length of time before health checking times out. In seconds. // Length of time before health checking times out. In seconds.
TimeoutSeconds int `json:"timeoutSeconds,omitempty"` TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`
// How often (in seconds) to perform the probe. // How often (in seconds) to perform the probe.
PeriodSeconds int `json:"periodSeconds,omitempty"` PeriodSeconds int32 `json:"periodSeconds,omitempty"`
// Minimum consecutive successes for the probe to be considered successful after having failed. // Minimum consecutive successes for the probe to be considered successful after having failed.
// Must be 1 for liveness. // Must be 1 for liveness.
SuccessThreshold int `json:"successThreshold,omitempty"` SuccessThreshold int32 `json:"successThreshold,omitempty"`
// Minimum consecutive failures for the probe to be considered failed after having succeeded. // Minimum consecutive failures for the probe to be considered failed after having succeeded.
FailureThreshold int `json:"failureThreshold,omitempty"` FailureThreshold int32 `json:"failureThreshold,omitempty"`
} }
// PullPolicy describes a policy for if/when to pull a container image // PullPolicy describes a policy for if/when to pull a container image
...@@ -998,8 +998,8 @@ type ContainerStateRunning struct { ...@@ -998,8 +998,8 @@ type ContainerStateRunning struct {
} }
type ContainerStateTerminated struct { type ContainerStateTerminated struct {
ExitCode int `json:"exitCode"` ExitCode int32 `json:"exitCode"`
Signal int `json:"signal,omitempty"` Signal int32 `json:"signal,omitempty"`
Reason string `json:"reason,omitempty"` Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
StartedAt unversioned.Time `json:"startedAt,omitempty"` StartedAt unversioned.Time `json:"startedAt,omitempty"`
...@@ -1025,7 +1025,7 @@ type ContainerStatus struct { ...@@ -1025,7 +1025,7 @@ type ContainerStatus struct {
Ready bool `json:"ready"` Ready bool `json:"ready"`
// Note that this is calculated from dead containers. But those containers are subject to // Note that this is calculated from dead containers. But those containers are subject to
// garbage collection. This value will get capped at 5 by GC. // garbage collection. This value will get capped at 5 by GC.
RestartCount int `json:"restartCount"` RestartCount int32 `json:"restartCount"`
Image string `json:"image"` Image string `json:"image"`
ImageID string `json:"imageID"` ImageID string `json:"imageID"`
ContainerID string `json:"containerID,omitempty"` ContainerID string `json:"containerID,omitempty"`
...@@ -1188,7 +1188,7 @@ type NodeAffinity struct { ...@@ -1188,7 +1188,7 @@ type NodeAffinity struct {
// (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). // (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op).
type PreferredSchedulingTerm struct { type PreferredSchedulingTerm struct {
// Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. // Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100.
Weight int `json:"weight"` Weight int32 `json:"weight"`
// A node selector term, associated with the corresponding weight. // A node selector term, associated with the corresponding weight.
Preference NodeSelectorTerm `json:"preference"` Preference NodeSelectorTerm `json:"preference"`
} }
...@@ -1368,7 +1368,7 @@ type PodTemplateList struct { ...@@ -1368,7 +1368,7 @@ type PodTemplateList struct {
// a TemplateRef or a Template set. // a TemplateRef or a Template set.
type ReplicationControllerSpec struct { type ReplicationControllerSpec struct {
// Replicas is the number of desired replicas. // Replicas is the number of desired replicas.
Replicas int `json:"replicas"` Replicas int32 `json:"replicas"`
// Selector is a label query over pods that should match the Replicas count. // Selector is a label query over pods that should match the Replicas count.
Selector map[string]string `json:"selector"` Selector map[string]string `json:"selector"`
...@@ -1388,10 +1388,10 @@ type ReplicationControllerSpec struct { ...@@ -1388,10 +1388,10 @@ type ReplicationControllerSpec struct {
// controller. // controller.
type ReplicationControllerStatus struct { type ReplicationControllerStatus struct {
// Replicas is the number of actual replicas. // Replicas is the number of actual replicas.
Replicas int `json:"replicas"` Replicas int32 `json:"replicas"`
// The number of pods that have labels matching the labels of the pod template of the replication controller. // The number of pods that have labels matching the labels of the pod template of the replication controller.
FullyLabeledReplicas int `json:"fullyLabeledReplicas,omitempty"` FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty"`
// ObservedGeneration is the most recent generation observed by the controller. // ObservedGeneration is the most recent generation observed by the controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty"` ObservedGeneration int64 `json:"observedGeneration,omitempty"`
...@@ -1535,7 +1535,7 @@ type ServicePort struct { ...@@ -1535,7 +1535,7 @@ type ServicePort struct {
Protocol Protocol `json:"protocol"` Protocol Protocol `json:"protocol"`
// The port that will be exposed on the service. // The port that will be exposed on the service.
Port int `json:"port"` Port int32 `json:"port"`
// Optional: The target port on pods selected by this service. If this // Optional: The target port on pods selected by this service. If this
// is a string, it will be looked up as a named port in the target // is a string, it will be looked up as a named port in the target
...@@ -1547,7 +1547,7 @@ type ServicePort struct { ...@@ -1547,7 +1547,7 @@ type ServicePort struct {
// The port on each node on which this service is exposed. // The port on each node on which this service is exposed.
// Default is to auto-allocate a port if the ServiceType of this Service requires one. // Default is to auto-allocate a port if the ServiceType of this Service requires one.
NodePort int `json:"nodePort"` NodePort int32 `json:"nodePort"`
} }
// +genclient=true // +genclient=true
...@@ -1652,7 +1652,7 @@ type EndpointPort struct { ...@@ -1652,7 +1652,7 @@ type EndpointPort struct {
Name string Name string
// The port number. // The port number.
Port int Port int32
// The IP protocol for this port. // The IP protocol for this port.
Protocol Protocol Protocol Protocol
...@@ -1692,7 +1692,7 @@ type DaemonEndpoint struct { ...@@ -1692,7 +1692,7 @@ type DaemonEndpoint struct {
*/ */
// Port number of the given endpoint. // Port number of the given endpoint.
Port int `json:"Port"` Port int32 `json:"Port"`
} }
// NodeDaemonEndpoints lists ports opened by daemons running on the Node. // NodeDaemonEndpoints lists ports opened by daemons running on the Node.
...@@ -2134,7 +2134,7 @@ type Event struct { ...@@ -2134,7 +2134,7 @@ type Event struct {
LastTimestamp unversioned.Time `json:"lastTimestamp,omitempty"` LastTimestamp unversioned.Time `json:"lastTimestamp,omitempty"`
// The number of times this event has occurred. // The number of times this event has occurred.
Count int `json:"count,omitempty"` Count int32 `json:"count,omitempty"`
// Type of this event (Normal, Warning), new types could be added in the future. // Type of this event (Normal, Warning), new types could be added in the future.
Type string `json:"type,omitempty"` Type string `json:"type,omitempty"`
......
...@@ -236,7 +236,7 @@ func Convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *R ...@@ -236,7 +236,7 @@ func Convert_v1_ReplicationControllerSpec_To_api_ReplicationControllerSpec(in *R
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*ReplicationControllerSpec))(in) defaulting.(func(*ReplicationControllerSpec))(in)
} }
out.Replicas = int(*in.Replicas) out.Replicas = *in.Replicas
if in.Selector != nil { if in.Selector != nil {
out.Selector = make(map[string]string) out.Selector = make(map[string]string)
for key, val := range in.Selector { for key, val := range in.Selector {
......
...@@ -994,10 +994,10 @@ func validateContainerPorts(ports []api.ContainerPort, fldPath *field.Path) fiel ...@@ -994,10 +994,10 @@ func validateContainerPorts(ports []api.ContainerPort, fldPath *field.Path) fiel
} }
if port.ContainerPort == 0 { if port.ContainerPort == 0 {
allErrs = append(allErrs, field.Invalid(idxPath.Child("containerPort"), port.ContainerPort, PortRangeErrorMsg)) allErrs = append(allErrs, field.Invalid(idxPath.Child("containerPort"), port.ContainerPort, PortRangeErrorMsg))
} else if !validation.IsValidPortNum(port.ContainerPort) { } else if !validation.IsValidPortNum(int(port.ContainerPort)) {
allErrs = append(allErrs, field.Invalid(idxPath.Child("containerPort"), port.ContainerPort, PortRangeErrorMsg)) allErrs = append(allErrs, field.Invalid(idxPath.Child("containerPort"), port.ContainerPort, PortRangeErrorMsg))
} }
if port.HostPort != 0 && !validation.IsValidPortNum(port.HostPort) { if port.HostPort != 0 && !validation.IsValidPortNum(int(port.HostPort)) {
allErrs = append(allErrs, field.Invalid(idxPath.Child("hostPort"), port.HostPort, PortRangeErrorMsg)) allErrs = append(allErrs, field.Invalid(idxPath.Child("hostPort"), port.HostPort, PortRangeErrorMsg))
} }
if len(port.Protocol) == 0 { if len(port.Protocol) == 0 {
...@@ -1808,7 +1808,7 @@ func validateServicePort(sp *api.ServicePort, requireName, isHeadlessService boo ...@@ -1808,7 +1808,7 @@ func validateServicePort(sp *api.ServicePort, requireName, isHeadlessService boo
} }
} }
if !validation.IsValidPortNum(sp.Port) { if !validation.IsValidPortNum(int(sp.Port)) {
allErrs = append(allErrs, field.Invalid(fldPath.Child("port"), sp.Port, PortRangeErrorMsg)) allErrs = append(allErrs, field.Invalid(fldPath.Child("port"), sp.Port, PortRangeErrorMsg))
} }
...@@ -1891,7 +1891,7 @@ func ValidateNonEmptySelector(selectorMap map[string]string, fldPath *field.Path ...@@ -1891,7 +1891,7 @@ func ValidateNonEmptySelector(selectorMap map[string]string, fldPath *field.Path
} }
// Validates the given template and ensures that it is in accordance with the desrired selector and replicas. // Validates the given template and ensures that it is in accordance with the desrired selector and replicas.
func ValidatePodTemplateSpecForRC(template *api.PodTemplateSpec, selectorMap map[string]string, replicas int, fldPath *field.Path) field.ErrorList { func ValidatePodTemplateSpecForRC(template *api.PodTemplateSpec, selectorMap map[string]string, replicas int32, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if template == nil { if template == nil {
allErrs = append(allErrs, field.Required(fldPath, "")) allErrs = append(allErrs, field.Required(fldPath, ""))
...@@ -2656,7 +2656,7 @@ func validateEndpointPort(port *api.EndpointPort, requireName bool, fldPath *fie ...@@ -2656,7 +2656,7 @@ func validateEndpointPort(port *api.EndpointPort, requireName bool, fldPath *fie
allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), port.Name, DNS1123LabelErrorMsg)) allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), port.Name, DNS1123LabelErrorMsg))
} }
} }
if !validation.IsValidPortNum(port.Port) { if !validation.IsValidPortNum(int(port.Port)) {
allErrs = append(allErrs, field.Invalid(fldPath.Child("port"), port.Port, PortRangeErrorMsg)) allErrs = append(allErrs, field.Invalid(fldPath.Child("port"), port.Port, PortRangeErrorMsg))
} }
if len(port.Protocol) == 0 { if len(port.Protocol) == 0 {
......
...@@ -631,7 +631,7 @@ func TestValidatePersistentVolumeClaimUpdate(t *testing.T) { ...@@ -631,7 +631,7 @@ func TestValidatePersistentVolumeClaimUpdate(t *testing.T) {
} }
func TestValidateVolumes(t *testing.T) { func TestValidateVolumes(t *testing.T) {
lun := 1 lun := int32(1)
successCase := []api.Volume{ successCase := []api.Volume{
{Name: "abc", VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/mnt/path1"}}}, {Name: "abc", VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/mnt/path1"}}},
{Name: "123", VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/mnt/path2"}}}, {Name: "123", VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/mnt/path2"}}},
......
...@@ -535,7 +535,7 @@ func (x *ScaleSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { ...@@ -535,7 +535,7 @@ func (x *ScaleSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Replicas = 0 x.Replicas = 0
} else { } else {
x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) x.Replicas = int32(r.DecodeInt(32))
} }
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
...@@ -565,7 +565,7 @@ func (x *ScaleSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { ...@@ -565,7 +565,7 @@ func (x *ScaleSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Replicas = 0 x.Replicas = 0
} else { } else {
x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) x.Replicas = int32(r.DecodeInt(32))
} }
for { for {
yyj5++ yyj5++
...@@ -723,7 +723,7 @@ func (x *ScaleStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { ...@@ -723,7 +723,7 @@ func (x *ScaleStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Replicas = 0 x.Replicas = 0
} else { } else {
x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) x.Replicas = int32(r.DecodeInt(32))
} }
case "selector": case "selector":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
...@@ -759,7 +759,7 @@ func (x *ScaleStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { ...@@ -759,7 +759,7 @@ func (x *ScaleStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Replicas = 0 x.Replicas = 0
} else { } else {
x.Replicas = int(r.DecodeInt(codecSelferBitsize1234)) x.Replicas = int32(r.DecodeInt(32))
} }
yyj6++ yyj6++
if yyhl6 { if yyhl6 {
......
...@@ -37,13 +37,13 @@ type Scale struct { ...@@ -37,13 +37,13 @@ type Scale struct {
// ScaleSpec describes the attributes of a scale subresource. // ScaleSpec describes the attributes of a scale subresource.
type ScaleSpec struct { type ScaleSpec struct {
// desired number of instances for the scaled object. // desired number of instances for the scaled object.
Replicas int `json:"replicas,omitempty"` Replicas int32 `json:"replicas,omitempty"`
} }
// ScaleStatus represents the current status of a scale subresource. // ScaleStatus represents the current status of a scale subresource.
type ScaleStatus struct { type ScaleStatus struct {
// actual number of observed instances of the scaled object. // actual number of observed instances of the scaled object.
Replicas int `json:"replicas"` Replicas int32 `json:"replicas"`
// label query over pods that should match the replicas count. This is same // label query over pods that should match the replicas count. This is same
// as the label selector but in the string format to avoid introspection // as the label selector but in the string format to avoid introspection
......
...@@ -88,14 +88,14 @@ func Convert_v1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscale ...@@ -88,14 +88,14 @@ func Convert_v1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPodAutoscale
return err return err
} }
if in.MinReplicas != nil { if in.MinReplicas != nil {
out.MinReplicas = new(int) out.MinReplicas = new(int32)
*out.MinReplicas = int(*in.MinReplicas) *out.MinReplicas = *in.MinReplicas
} else { } else {
out.MinReplicas = nil out.MinReplicas = nil
} }
out.MaxReplicas = int(in.MaxReplicas) out.MaxReplicas = in.MaxReplicas
if in.TargetCPUUtilizationPercentage != nil { if in.TargetCPUUtilizationPercentage != nil {
out.CPUUtilization = &extensions.CPUTargetUtilization{TargetPercentage: int(*in.TargetCPUUtilizationPercentage)} out.CPUUtilization = &extensions.CPUTargetUtilization{TargetPercentage: *in.TargetCPUUtilizationPercentage}
} }
return nil return nil
} }
...@@ -175,12 +175,12 @@ func autoConvert_v1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAut ...@@ -175,12 +175,12 @@ func autoConvert_v1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalPodAut
} else { } else {
out.LastScaleTime = nil out.LastScaleTime = nil
} }
out.CurrentReplicas = int(in.CurrentReplicas) out.CurrentReplicas = in.CurrentReplicas
out.DesiredReplicas = int(in.DesiredReplicas) out.DesiredReplicas = in.DesiredReplicas
if in.CurrentCPUUtilizationPercentage != nil { if in.CurrentCPUUtilizationPercentage != nil {
in, out := &in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage in, out := &in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage
*out = new(int) *out = new(int32)
**out = int(**in) **out = **in
} else { } else {
out.CurrentCPUUtilizationPercentage = nil out.CurrentCPUUtilizationPercentage = nil
} }
...@@ -211,12 +211,12 @@ func autoConvert_extensions_HorizontalPodAutoscalerStatus_To_v1_HorizontalPodAut ...@@ -211,12 +211,12 @@ func autoConvert_extensions_HorizontalPodAutoscalerStatus_To_v1_HorizontalPodAut
} else { } else {
out.LastScaleTime = nil out.LastScaleTime = nil
} }
out.CurrentReplicas = int32(in.CurrentReplicas) out.CurrentReplicas = in.CurrentReplicas
out.DesiredReplicas = int32(in.DesiredReplicas) out.DesiredReplicas = in.DesiredReplicas
if in.CurrentCPUUtilizationPercentage != nil { if in.CurrentCPUUtilizationPercentage != nil {
in, out := &in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage in, out := &in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage
*out = new(int32) *out = new(int32)
**out = int32(**in) **out = **in
} else { } else {
out.CurrentCPUUtilizationPercentage = nil out.CurrentCPUUtilizationPercentage = nil
} }
...@@ -279,7 +279,7 @@ func autoConvert_v1_ScaleSpec_To_autoscaling_ScaleSpec(in *ScaleSpec, out *autos ...@@ -279,7 +279,7 @@ func autoConvert_v1_ScaleSpec_To_autoscaling_ScaleSpec(in *ScaleSpec, out *autos
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*ScaleSpec))(in) defaulting.(func(*ScaleSpec))(in)
} }
out.Replicas = int(in.Replicas) out.Replicas = in.Replicas
return nil return nil
} }
...@@ -291,7 +291,7 @@ func autoConvert_autoscaling_ScaleSpec_To_v1_ScaleSpec(in *autoscaling.ScaleSpec ...@@ -291,7 +291,7 @@ func autoConvert_autoscaling_ScaleSpec_To_v1_ScaleSpec(in *autoscaling.ScaleSpec
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*autoscaling.ScaleSpec))(in) defaulting.(func(*autoscaling.ScaleSpec))(in)
} }
out.Replicas = int32(in.Replicas) out.Replicas = in.Replicas
return nil return nil
} }
...@@ -303,7 +303,7 @@ func autoConvert_v1_ScaleStatus_To_autoscaling_ScaleStatus(in *ScaleStatus, out ...@@ -303,7 +303,7 @@ func autoConvert_v1_ScaleStatus_To_autoscaling_ScaleStatus(in *ScaleStatus, out
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*ScaleStatus))(in) defaulting.(func(*ScaleStatus))(in)
} }
out.Replicas = int(in.Replicas) out.Replicas = in.Replicas
out.Selector = in.Selector out.Selector = in.Selector
return nil return nil
} }
...@@ -316,7 +316,7 @@ func autoConvert_autoscaling_ScaleStatus_To_v1_ScaleStatus(in *autoscaling.Scale ...@@ -316,7 +316,7 @@ func autoConvert_autoscaling_ScaleStatus_To_v1_ScaleStatus(in *autoscaling.Scale
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*autoscaling.ScaleStatus))(in) defaulting.(func(*autoscaling.ScaleStatus))(in)
} }
out.Replicas = int32(in.Replicas) out.Replicas = in.Replicas
out.Selector = in.Selector out.Selector = in.Selector
return nil return nil
} }
......
...@@ -93,14 +93,14 @@ func DeepCopy_batch_JobList(in JobList, out *JobList, c *conversion.Cloner) erro ...@@ -93,14 +93,14 @@ func DeepCopy_batch_JobList(in JobList, out *JobList, c *conversion.Cloner) erro
func DeepCopy_batch_JobSpec(in JobSpec, out *JobSpec, c *conversion.Cloner) error { func DeepCopy_batch_JobSpec(in JobSpec, out *JobSpec, c *conversion.Cloner) error {
if in.Parallelism != nil { if in.Parallelism != nil {
in, out := in.Parallelism, &out.Parallelism in, out := in.Parallelism, &out.Parallelism
*out = new(int) *out = new(int32)
**out = *in **out = *in
} else { } else {
out.Parallelism = nil out.Parallelism = nil
} }
if in.Completions != nil { if in.Completions != nil {
in, out := in.Completions, &out.Completions in, out := in.Completions, &out.Completions
*out = new(int) *out = new(int32)
**out = *in **out = *in
} else { } else {
out.Completions = nil out.Completions = nil
......
...@@ -1053,13 +1053,13 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { ...@@ -1053,13 +1053,13 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
} }
} else { } else {
if x.Parallelism == nil { if x.Parallelism == nil {
x.Parallelism = new(int) x.Parallelism = new(int32)
} }
yym5 := z.DecBinary() yym5 := z.DecBinary()
_ = yym5 _ = yym5
if false { if false {
} else { } else {
*((*int)(x.Parallelism)) = int(r.DecodeInt(codecSelferBitsize1234)) *((*int32)(x.Parallelism)) = int32(r.DecodeInt(32))
} }
} }
case "completions": case "completions":
...@@ -1069,13 +1069,13 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { ...@@ -1069,13 +1069,13 @@ func (x *JobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
} }
} else { } else {
if x.Completions == nil { if x.Completions == nil {
x.Completions = new(int) x.Completions = new(int32)
} }
yym7 := z.DecBinary() yym7 := z.DecBinary()
_ = yym7 _ = yym7
if false { if false {
} else { } else {
*((*int)(x.Completions)) = int(r.DecodeInt(codecSelferBitsize1234)) *((*int32)(x.Completions)) = int32(r.DecodeInt(32))
} }
} }
case "activeDeadlineSeconds": case "activeDeadlineSeconds":
...@@ -1165,13 +1165,13 @@ func (x *JobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { ...@@ -1165,13 +1165,13 @@ func (x *JobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} }
} else { } else {
if x.Parallelism == nil { if x.Parallelism == nil {
x.Parallelism = new(int) x.Parallelism = new(int32)
} }
yym17 := z.DecBinary() yym17 := z.DecBinary()
_ = yym17 _ = yym17
if false { if false {
} else { } else {
*((*int)(x.Parallelism)) = int(r.DecodeInt(codecSelferBitsize1234)) *((*int32)(x.Parallelism)) = int32(r.DecodeInt(32))
} }
} }
yyj15++ yyj15++
...@@ -1191,13 +1191,13 @@ func (x *JobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { ...@@ -1191,13 +1191,13 @@ func (x *JobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} }
} else { } else {
if x.Completions == nil { if x.Completions == nil {
x.Completions = new(int) x.Completions = new(int32)
} }
yym19 := z.DecBinary() yym19 := z.DecBinary()
_ = yym19 _ = yym19
if false { if false {
} else { } else {
*((*int)(x.Completions)) = int(r.DecodeInt(codecSelferBitsize1234)) *((*int32)(x.Completions)) = int32(r.DecodeInt(32))
} }
} }
yyj15++ yyj15++
...@@ -1661,19 +1661,19 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { ...@@ -1661,19 +1661,19 @@ func (x *JobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Active = 0 x.Active = 0
} else { } else {
x.Active = int(r.DecodeInt(codecSelferBitsize1234)) x.Active = int32(r.DecodeInt(32))
} }
case "succeeded": case "succeeded":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Succeeded = 0 x.Succeeded = 0
} else { } else {
x.Succeeded = int(r.DecodeInt(codecSelferBitsize1234)) x.Succeeded = int32(r.DecodeInt(32))
} }
case "failed": case "failed":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Failed = 0 x.Failed = 0
} else { } else {
x.Failed = int(r.DecodeInt(codecSelferBitsize1234)) x.Failed = int32(r.DecodeInt(32))
} }
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
...@@ -1787,7 +1787,7 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { ...@@ -1787,7 +1787,7 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Active = 0 x.Active = 0
} else { } else {
x.Active = int(r.DecodeInt(codecSelferBitsize1234)) x.Active = int32(r.DecodeInt(32))
} }
yyj13++ yyj13++
if yyhl13 { if yyhl13 {
...@@ -1803,7 +1803,7 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { ...@@ -1803,7 +1803,7 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Succeeded = 0 x.Succeeded = 0
} else { } else {
x.Succeeded = int(r.DecodeInt(codecSelferBitsize1234)) x.Succeeded = int32(r.DecodeInt(32))
} }
yyj13++ yyj13++
if yyhl13 { if yyhl13 {
...@@ -1819,7 +1819,7 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { ...@@ -1819,7 +1819,7 @@ func (x *JobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Failed = 0 x.Failed = 0
} else { } else {
x.Failed = int(r.DecodeInt(codecSelferBitsize1234)) x.Failed = int32(r.DecodeInt(32))
} }
for { for {
yyj13++ yyj13++
...@@ -2347,7 +2347,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) { ...@@ -2347,7 +2347,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
yyrg1 := len(yyv1) > 0 yyrg1 := len(yyv1) > 0
yyv21 := yyv1 yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 656) yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 648)
if yyrt1 { if yyrt1 {
if yyrl1 <= cap(yyv1) { if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1] yyv1 = yyv1[:yyrl1]
......
...@@ -57,14 +57,14 @@ type JobSpec struct { ...@@ -57,14 +57,14 @@ type JobSpec struct {
// run at any given time. The actual number of pods running in steady state will // run at any given time. The actual number of pods running in steady state will
// be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism), // be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism),
// i.e. when the work left to do is less than max parallelism. // i.e. when the work left to do is less than max parallelism.
Parallelism *int `json:"parallelism,omitempty"` Parallelism *int32 `json:"parallelism,omitempty"`
// Completions specifies the desired number of successfully finished pods the // Completions specifies the desired number of successfully finished pods the
// job should be run with. Setting to nil means that the success of any // job should be run with. Setting to nil means that the success of any
// pod signals the success of all pods, and allows parallelism to have any positive // pod signals the success of all pods, and allows parallelism to have any positive
// value. Setting to 1 means that parallelism is limited to 1 and the success of that // value. Setting to 1 means that parallelism is limited to 1 and the success of that
// pod signals the success of the job. // pod signals the success of the job.
Completions *int `json:"completions,omitempty"` Completions *int32 `json:"completions,omitempty"`
// Optional duration in seconds relative to the startTime that the job may be active // Optional duration in seconds relative to the startTime that the job may be active
// before the system tries to terminate it; value must be positive integer // before the system tries to terminate it; value must be positive integer
...@@ -107,13 +107,13 @@ type JobStatus struct { ...@@ -107,13 +107,13 @@ type JobStatus struct {
CompletionTime *unversioned.Time `json:"completionTime,omitempty"` CompletionTime *unversioned.Time `json:"completionTime,omitempty"`
// Active is the number of actively running pods. // Active is the number of actively running pods.
Active int `json:"active,omitempty"` Active int32 `json:"active,omitempty"`
// Succeeded is the number of pods which reached Phase Succeeded. // Succeeded is the number of pods which reached Phase Succeeded.
Succeeded int `json:"succeeded,omitempty"` Succeeded int32 `json:"succeeded,omitempty"`
// Failed is the number of pods which reached Phase Failed. // Failed is the number of pods which reached Phase Failed.
Failed int `json:"failed,omitempty"` Failed int32 `json:"failed,omitempty"`
} }
type JobConditionType string type JobConditionType string
......
...@@ -58,24 +58,9 @@ func Convert_batch_JobSpec_To_v1_JobSpec(in *batch.JobSpec, out *JobSpec, s conv ...@@ -58,24 +58,9 @@ func Convert_batch_JobSpec_To_v1_JobSpec(in *batch.JobSpec, out *JobSpec, s conv
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*batch.JobSpec))(in) defaulting.(func(*batch.JobSpec))(in)
} }
if in.Parallelism != nil { out.Parallelism = in.Parallelism
out.Parallelism = new(int32) out.Completions = in.Completions
*out.Parallelism = int32(*in.Parallelism) out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
} else {
out.Parallelism = nil
}
if in.Completions != nil {
out.Completions = new(int32)
*out.Completions = int32(*in.Completions)
} else {
out.Completions = nil
}
if in.ActiveDeadlineSeconds != nil {
out.ActiveDeadlineSeconds = new(int64)
*out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds
} else {
out.ActiveDeadlineSeconds = nil
}
// unable to generate simple pointer conversion for unversioned.LabelSelector -> v1.LabelSelector // unable to generate simple pointer conversion for unversioned.LabelSelector -> v1.LabelSelector
if in.Selector != nil { if in.Selector != nil {
out.Selector = new(LabelSelector) out.Selector = new(LabelSelector)
...@@ -102,24 +87,9 @@ func Convert_v1_JobSpec_To_batch_JobSpec(in *JobSpec, out *batch.JobSpec, s conv ...@@ -102,24 +87,9 @@ func Convert_v1_JobSpec_To_batch_JobSpec(in *JobSpec, out *batch.JobSpec, s conv
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*JobSpec))(in) defaulting.(func(*JobSpec))(in)
} }
if in.Parallelism != nil { out.Parallelism = in.Parallelism
out.Parallelism = new(int) out.Completions = in.Completions
*out.Parallelism = int(*in.Parallelism) out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
} else {
out.Parallelism = nil
}
if in.Completions != nil {
out.Completions = new(int)
*out.Completions = int(*in.Completions)
} else {
out.Completions = nil
}
if in.ActiveDeadlineSeconds != nil {
out.ActiveDeadlineSeconds = new(int64)
*out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds
} else {
out.ActiveDeadlineSeconds = nil
}
// unable to generate simple pointer conversion for v1.LabelSelector -> unversioned.LabelSelector // unable to generate simple pointer conversion for v1.LabelSelector -> unversioned.LabelSelector
if in.Selector != nil { if in.Selector != nil {
out.Selector = new(unversioned.LabelSelector) out.Selector = new(unversioned.LabelSelector)
......
...@@ -203,15 +203,15 @@ func autoConvert_v1_JobSpec_To_batch_JobSpec(in *JobSpec, out *batch.JobSpec, s ...@@ -203,15 +203,15 @@ func autoConvert_v1_JobSpec_To_batch_JobSpec(in *JobSpec, out *batch.JobSpec, s
} }
if in.Parallelism != nil { if in.Parallelism != nil {
in, out := &in.Parallelism, &out.Parallelism in, out := &in.Parallelism, &out.Parallelism
*out = new(int) *out = new(int32)
**out = int(**in) **out = **in
} else { } else {
out.Parallelism = nil out.Parallelism = nil
} }
if in.Completions != nil { if in.Completions != nil {
in, out := &in.Completions, &out.Completions in, out := &in.Completions, &out.Completions
*out = new(int) *out = new(int32)
**out = int(**in) **out = **in
} else { } else {
out.Completions = nil out.Completions = nil
} }
...@@ -252,14 +252,14 @@ func autoConvert_batch_JobSpec_To_v1_JobSpec(in *batch.JobSpec, out *JobSpec, s ...@@ -252,14 +252,14 @@ func autoConvert_batch_JobSpec_To_v1_JobSpec(in *batch.JobSpec, out *JobSpec, s
if in.Parallelism != nil { if in.Parallelism != nil {
in, out := &in.Parallelism, &out.Parallelism in, out := &in.Parallelism, &out.Parallelism
*out = new(int32) *out = new(int32)
**out = int32(**in) **out = **in
} else { } else {
out.Parallelism = nil out.Parallelism = nil
} }
if in.Completions != nil { if in.Completions != nil {
in, out := &in.Completions, &out.Completions in, out := &in.Completions, &out.Completions
*out = new(int32) *out = new(int32)
**out = int32(**in) **out = **in
} else { } else {
out.Completions = nil out.Completions = nil
} }
...@@ -326,9 +326,9 @@ func autoConvert_v1_JobStatus_To_batch_JobStatus(in *JobStatus, out *batch.JobSt ...@@ -326,9 +326,9 @@ func autoConvert_v1_JobStatus_To_batch_JobStatus(in *JobStatus, out *batch.JobSt
} else { } else {
out.CompletionTime = nil out.CompletionTime = nil
} }
out.Active = int(in.Active) out.Active = in.Active
out.Succeeded = int(in.Succeeded) out.Succeeded = in.Succeeded
out.Failed = int(in.Failed) out.Failed = in.Failed
return nil return nil
} }
...@@ -369,9 +369,9 @@ func autoConvert_batch_JobStatus_To_v1_JobStatus(in *batch.JobStatus, out *JobSt ...@@ -369,9 +369,9 @@ func autoConvert_batch_JobStatus_To_v1_JobStatus(in *batch.JobStatus, out *JobSt
} else { } else {
out.CompletionTime = nil out.CompletionTime = nil
} }
out.Active = int32(in.Active) out.Active = in.Active
out.Succeeded = int32(in.Succeeded) out.Succeeded = in.Succeeded
out.Failed = int32(in.Failed) out.Failed = in.Failed
return nil return nil
} }
......
...@@ -84,7 +84,7 @@ func TestValidateJob(t *testing.T) { ...@@ -84,7 +84,7 @@ func TestValidateJob(t *testing.T) {
t.Errorf("expected success for %s: %v", k, errs) t.Errorf("expected success for %s: %v", k, errs)
} }
} }
negative := -1 negative := int32(-1)
negative64 := int64(-1) negative64 := int64(-1)
errorCases := map[string]batch.Job{ errorCases := map[string]batch.Job{
"spec.parallelism:must be greater than or equal to 0": { "spec.parallelism:must be greater than or equal to 0": {
......
...@@ -145,7 +145,7 @@ func DeepCopy_componentconfig_KubeProxyConfiguration(in KubeProxyConfiguration, ...@@ -145,7 +145,7 @@ func DeepCopy_componentconfig_KubeProxyConfiguration(in KubeProxyConfiguration,
out.HostnameOverride = in.HostnameOverride out.HostnameOverride = in.HostnameOverride
if in.IPTablesMasqueradeBit != nil { if in.IPTablesMasqueradeBit != nil {
in, out := in.IPTablesMasqueradeBit, &out.IPTablesMasqueradeBit in, out := in.IPTablesMasqueradeBit, &out.IPTablesMasqueradeBit
*out = new(int) *out = new(int32)
**out = *in **out = *in
} else { } else {
out.IPTablesMasqueradeBit = nil out.IPTablesMasqueradeBit = nil
...@@ -158,7 +158,7 @@ func DeepCopy_componentconfig_KubeProxyConfiguration(in KubeProxyConfiguration, ...@@ -158,7 +158,7 @@ func DeepCopy_componentconfig_KubeProxyConfiguration(in KubeProxyConfiguration,
out.Master = in.Master out.Master = in.Master
if in.OOMScoreAdj != nil { if in.OOMScoreAdj != nil {
in, out := in.OOMScoreAdj, &out.OOMScoreAdj in, out := in.OOMScoreAdj, &out.OOMScoreAdj
*out = new(int) *out = new(int32)
**out = *in **out = *in
} else { } else {
out.OOMScoreAdj = nil out.OOMScoreAdj = nil
......
...@@ -51,12 +51,12 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyCon ...@@ -51,12 +51,12 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyCon
out.BindAddress = in.BindAddress out.BindAddress = in.BindAddress
out.ClusterCIDR = in.ClusterCIDR out.ClusterCIDR = in.ClusterCIDR
out.HealthzBindAddress = in.HealthzBindAddress out.HealthzBindAddress = in.HealthzBindAddress
out.HealthzPort = int(in.HealthzPort) out.HealthzPort = in.HealthzPort
out.HostnameOverride = in.HostnameOverride out.HostnameOverride = in.HostnameOverride
if in.IPTablesMasqueradeBit != nil { if in.IPTablesMasqueradeBit != nil {
in, out := &in.IPTablesMasqueradeBit, &out.IPTablesMasqueradeBit in, out := &in.IPTablesMasqueradeBit, &out.IPTablesMasqueradeBit
*out = new(int) *out = new(int32)
**out = int(**in) **out = **in
} else { } else {
out.IPTablesMasqueradeBit = nil out.IPTablesMasqueradeBit = nil
} }
...@@ -69,8 +69,8 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyCon ...@@ -69,8 +69,8 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyCon
out.Master = in.Master out.Master = in.Master
if in.OOMScoreAdj != nil { if in.OOMScoreAdj != nil {
in, out := &in.OOMScoreAdj, &out.OOMScoreAdj in, out := &in.OOMScoreAdj, &out.OOMScoreAdj
*out = new(int) *out = new(int32)
**out = int(**in) **out = **in
} else { } else {
out.OOMScoreAdj = nil out.OOMScoreAdj = nil
} }
...@@ -81,7 +81,7 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyCon ...@@ -81,7 +81,7 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyCon
if err := s.Convert(&in.UDPIdleTimeout, &out.UDPIdleTimeout, 0); err != nil { if err := s.Convert(&in.UDPIdleTimeout, &out.UDPIdleTimeout, 0); err != nil {
return err return err
} }
out.ConntrackMax = int(in.ConntrackMax) out.ConntrackMax = in.ConntrackMax
// TODO: Inefficient conversion - can we improve it? // TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ConntrackTCPEstablishedTimeout, &out.ConntrackTCPEstablishedTimeout, 0); err != nil { if err := s.Convert(&in.ConntrackTCPEstablishedTimeout, &out.ConntrackTCPEstablishedTimeout, 0); err != nil {
return err return err
...@@ -103,12 +103,12 @@ func autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyCon ...@@ -103,12 +103,12 @@ func autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyCon
out.BindAddress = in.BindAddress out.BindAddress = in.BindAddress
out.ClusterCIDR = in.ClusterCIDR out.ClusterCIDR = in.ClusterCIDR
out.HealthzBindAddress = in.HealthzBindAddress out.HealthzBindAddress = in.HealthzBindAddress
out.HealthzPort = int32(in.HealthzPort) out.HealthzPort = in.HealthzPort
out.HostnameOverride = in.HostnameOverride out.HostnameOverride = in.HostnameOverride
if in.IPTablesMasqueradeBit != nil { if in.IPTablesMasqueradeBit != nil {
in, out := &in.IPTablesMasqueradeBit, &out.IPTablesMasqueradeBit in, out := &in.IPTablesMasqueradeBit, &out.IPTablesMasqueradeBit
*out = new(int32) *out = new(int32)
**out = int32(**in) **out = **in
} else { } else {
out.IPTablesMasqueradeBit = nil out.IPTablesMasqueradeBit = nil
} }
...@@ -122,7 +122,7 @@ func autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyCon ...@@ -122,7 +122,7 @@ func autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyCon
if in.OOMScoreAdj != nil { if in.OOMScoreAdj != nil {
in, out := &in.OOMScoreAdj, &out.OOMScoreAdj in, out := &in.OOMScoreAdj, &out.OOMScoreAdj
*out = new(int32) *out = new(int32)
**out = int32(**in) **out = **in
} else { } else {
out.OOMScoreAdj = nil out.OOMScoreAdj = nil
} }
...@@ -133,7 +133,7 @@ func autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyCon ...@@ -133,7 +133,7 @@ func autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyCon
if err := s.Convert(&in.UDPIdleTimeout, &out.UDPIdleTimeout, 0); err != nil { if err := s.Convert(&in.UDPIdleTimeout, &out.UDPIdleTimeout, 0); err != nil {
return err return err
} }
out.ConntrackMax = int32(in.ConntrackMax) out.ConntrackMax = in.ConntrackMax
// TODO: Inefficient conversion - can we improve it? // TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ConntrackTCPEstablishedTimeout, &out.ConntrackTCPEstablishedTimeout, 0); err != nil { if err := s.Convert(&in.ConntrackTCPEstablishedTimeout, &out.ConntrackTCPEstablishedTimeout, 0); err != nil {
return err return err
...@@ -152,7 +152,7 @@ func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSche ...@@ -152,7 +152,7 @@ func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSche
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err return err
} }
out.Port = in.Port out.Port = int32(in.Port)
out.Address = in.Address out.Address = in.Address
out.AlgorithmProvider = in.AlgorithmProvider out.AlgorithmProvider = in.AlgorithmProvider
out.PolicyConfigFile = in.PolicyConfigFile out.PolicyConfigFile = in.PolicyConfigFile
...@@ -161,7 +161,7 @@ func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSche ...@@ -161,7 +161,7 @@ func autoConvert_v1alpha1_KubeSchedulerConfiguration_To_componentconfig_KubeSche
} }
out.ContentType = in.ContentType out.ContentType = in.ContentType
out.KubeAPIQPS = in.KubeAPIQPS out.KubeAPIQPS = in.KubeAPIQPS
out.KubeAPIBurst = in.KubeAPIBurst out.KubeAPIBurst = int32(in.KubeAPIBurst)
out.SchedulerName = in.SchedulerName out.SchedulerName = in.SchedulerName
if err := Convert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { if err := Convert_v1alpha1_LeaderElectionConfiguration_To_componentconfig_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil {
return err return err
...@@ -180,7 +180,7 @@ func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSche ...@@ -180,7 +180,7 @@ func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSche
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil { if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err return err
} }
out.Port = in.Port out.Port = int(in.Port)
out.Address = in.Address out.Address = in.Address
out.AlgorithmProvider = in.AlgorithmProvider out.AlgorithmProvider = in.AlgorithmProvider
out.PolicyConfigFile = in.PolicyConfigFile out.PolicyConfigFile = in.PolicyConfigFile
...@@ -189,7 +189,7 @@ func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSche ...@@ -189,7 +189,7 @@ func autoConvert_componentconfig_KubeSchedulerConfiguration_To_v1alpha1_KubeSche
} }
out.ContentType = in.ContentType out.ContentType = in.ContentType
out.KubeAPIQPS = in.KubeAPIQPS out.KubeAPIQPS = in.KubeAPIQPS
out.KubeAPIBurst = in.KubeAPIBurst out.KubeAPIBurst = int(in.KubeAPIBurst)
out.SchedulerName = in.SchedulerName out.SchedulerName = in.SchedulerName
if err := Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil { if err := Convert_componentconfig_LeaderElectionConfiguration_To_v1alpha1_LeaderElectionConfiguration(&in.LeaderElection, &out.LeaderElection, s); err != nil {
return err return err
......
...@@ -281,7 +281,7 @@ func DeepCopy_extensions_DeploymentSpec(in DeploymentSpec, out *DeploymentSpec, ...@@ -281,7 +281,7 @@ func DeepCopy_extensions_DeploymentSpec(in DeploymentSpec, out *DeploymentSpec,
out.MinReadySeconds = in.MinReadySeconds out.MinReadySeconds = in.MinReadySeconds
if in.RevisionHistoryLimit != nil { if in.RevisionHistoryLimit != nil {
in, out := in.RevisionHistoryLimit, &out.RevisionHistoryLimit in, out := in.RevisionHistoryLimit, &out.RevisionHistoryLimit
*out = new(int) *out = new(int32)
**out = *in **out = *in
} else { } else {
out.RevisionHistoryLimit = nil out.RevisionHistoryLimit = nil
...@@ -388,7 +388,7 @@ func DeepCopy_extensions_HorizontalPodAutoscalerSpec(in HorizontalPodAutoscalerS ...@@ -388,7 +388,7 @@ func DeepCopy_extensions_HorizontalPodAutoscalerSpec(in HorizontalPodAutoscalerS
} }
if in.MinReplicas != nil { if in.MinReplicas != nil {
in, out := in.MinReplicas, &out.MinReplicas in, out := in.MinReplicas, &out.MinReplicas
*out = new(int) *out = new(int32)
**out = *in **out = *in
} else { } else {
out.MinReplicas = nil out.MinReplicas = nil
...@@ -427,7 +427,7 @@ func DeepCopy_extensions_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscale ...@@ -427,7 +427,7 @@ func DeepCopy_extensions_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscale
out.DesiredReplicas = in.DesiredReplicas out.DesiredReplicas = in.DesiredReplicas
if in.CurrentCPUUtilizationPercentage != nil { if in.CurrentCPUUtilizationPercentage != nil {
in, out := in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage in, out := in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage
*out = new(int) *out = new(int32)
**out = *in **out = *in
} else { } else {
out.CurrentCPUUtilizationPercentage = nil out.CurrentCPUUtilizationPercentage = nil
......
...@@ -38,13 +38,13 @@ import ( ...@@ -38,13 +38,13 @@ import (
// describes the attributes of a scale subresource // describes the attributes of a scale subresource
type ScaleSpec struct { type ScaleSpec struct {
// desired number of instances for the scaled object. // desired number of instances for the scaled object.
Replicas int `json:"replicas,omitempty"` Replicas int32 `json:"replicas,omitempty"`
} }
// represents the current status of a scale subresource. // represents the current status of a scale subresource.
type ScaleStatus struct { type ScaleStatus struct {
// actual number of observed instances of the scaled object. // actual number of observed instances of the scaled object.
Replicas int `json:"replicas"` Replicas int32 `json:"replicas"`
// label query over pods that should match the replicas count. // label query over pods that should match the replicas count.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors // More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors
...@@ -86,7 +86,7 @@ type SubresourceReference struct { ...@@ -86,7 +86,7 @@ type SubresourceReference struct {
type CPUTargetUtilization struct { type CPUTargetUtilization struct {
// fraction of the requested CPU that should be utilized/used, // fraction of the requested CPU that should be utilized/used,
// e.g. 70 means that 70% of the requested CPU should be in use. // e.g. 70 means that 70% of the requested CPU should be in use.
TargetPercentage int `json:"targetPercentage"` TargetPercentage int32 `json:"targetPercentage"`
} }
// Alpha-level support for Custom Metrics in HPA (as annotations). // Alpha-level support for Custom Metrics in HPA (as annotations).
...@@ -118,9 +118,9 @@ type HorizontalPodAutoscalerSpec struct { ...@@ -118,9 +118,9 @@ type HorizontalPodAutoscalerSpec struct {
// and will set the desired number of pods by modifying its spec. // and will set the desired number of pods by modifying its spec.
ScaleRef SubresourceReference `json:"scaleRef"` ScaleRef SubresourceReference `json:"scaleRef"`
// lower limit for the number of pods that can be set by the autoscaler, default 1. // lower limit for the number of pods that can be set by the autoscaler, default 1.
MinReplicas *int `json:"minReplicas,omitempty"` MinReplicas *int32 `json:"minReplicas,omitempty"`
// upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinReplicas. // upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinReplicas.
MaxReplicas int `json:"maxReplicas"` MaxReplicas int32 `json:"maxReplicas"`
// target average CPU utilization (represented as a percentage of requested CPU) over all the pods; // target average CPU utilization (represented as a percentage of requested CPU) over all the pods;
// if not specified it defaults to the target CPU utilization at 80% of the requested resources. // if not specified it defaults to the target CPU utilization at 80% of the requested resources.
CPUUtilization *CPUTargetUtilization `json:"cpuUtilization,omitempty"` CPUUtilization *CPUTargetUtilization `json:"cpuUtilization,omitempty"`
...@@ -136,14 +136,14 @@ type HorizontalPodAutoscalerStatus struct { ...@@ -136,14 +136,14 @@ type HorizontalPodAutoscalerStatus struct {
LastScaleTime *unversioned.Time `json:"lastScaleTime,omitempty"` LastScaleTime *unversioned.Time `json:"lastScaleTime,omitempty"`
// current number of replicas of pods managed by this autoscaler. // current number of replicas of pods managed by this autoscaler.
CurrentReplicas int `json:"currentReplicas"` CurrentReplicas int32 `json:"currentReplicas"`
// desired number of replicas of pods managed by this autoscaler. // desired number of replicas of pods managed by this autoscaler.
DesiredReplicas int `json:"desiredReplicas"` DesiredReplicas int32 `json:"desiredReplicas"`
// current average CPU utilization over all pods, represented as a percentage of requested CPU, // current average CPU utilization over all pods, represented as a percentage of requested CPU,
// e.g. 70 means that an average pod is using now 70% of its requested CPU. // e.g. 70 means that an average pod is using now 70% of its requested CPU.
CurrentCPUUtilizationPercentage *int `json:"currentCPUUtilizationPercentage,omitempty"` CurrentCPUUtilizationPercentage *int32 `json:"currentCPUUtilizationPercentage,omitempty"`
} }
// +genclient=true // +genclient=true
...@@ -229,7 +229,7 @@ type Deployment struct { ...@@ -229,7 +229,7 @@ type Deployment struct {
type DeploymentSpec struct { type DeploymentSpec struct {
// Number of desired pods. This is a pointer to distinguish between explicit // Number of desired pods. This is a pointer to distinguish between explicit
// zero and not specified. Defaults to 1. // zero and not specified. Defaults to 1.
Replicas int `json:"replicas,omitempty"` Replicas int32 `json:"replicas,omitempty"`
// Label selector for pods. Existing ReplicaSets whose pods are // Label selector for pods. Existing ReplicaSets whose pods are
// selected by this will be the ones affected by this deployment. // selected by this will be the ones affected by this deployment.
...@@ -244,11 +244,11 @@ type DeploymentSpec struct { ...@@ -244,11 +244,11 @@ type DeploymentSpec struct {
// Minimum number of seconds for which a newly created pod should be ready // Minimum number of seconds for which a newly created pod should be ready
// without any of its container crashing, for it to be considered available. // without any of its container crashing, for it to be considered available.
// Defaults to 0 (pod will be considered available as soon as it is ready) // Defaults to 0 (pod will be considered available as soon as it is ready)
MinReadySeconds int `json:"minReadySeconds,omitempty"` MinReadySeconds int32 `json:"minReadySeconds,omitempty"`
// The number of old ReplicaSets to retain to allow rollback. // The number of old ReplicaSets to retain to allow rollback.
// This is a pointer to distinguish between explicit zero and not specified. // This is a pointer to distinguish between explicit zero and not specified.
RevisionHistoryLimit *int `json:"revisionHistoryLimit,omitempty"` RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"`
// Indicates that the deployment is paused and will not be processed by the // Indicates that the deployment is paused and will not be processed by the
// deployment controller. // deployment controller.
...@@ -334,16 +334,16 @@ type DeploymentStatus struct { ...@@ -334,16 +334,16 @@ type DeploymentStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"` ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Total number of non-terminated pods targeted by this deployment (their labels match the selector). // Total number of non-terminated pods targeted by this deployment (their labels match the selector).
Replicas int `json:"replicas,omitempty"` Replicas int32 `json:"replicas,omitempty"`
// Total number of non-terminated pods targeted by this deployment that have the desired template spec. // Total number of non-terminated pods targeted by this deployment that have the desired template spec.
UpdatedReplicas int `json:"updatedReplicas,omitempty"` UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment. // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
AvailableReplicas int `json:"availableReplicas,omitempty"` AvailableReplicas int32 `json:"availableReplicas,omitempty"`
// Total number of unavailable pods targeted by this deployment. // Total number of unavailable pods targeted by this deployment.
UnavailableReplicas int `json:"unavailableReplicas,omitempty"` UnavailableReplicas int32 `json:"unavailableReplicas,omitempty"`
} }
type DeploymentList struct { type DeploymentList struct {
...@@ -442,15 +442,15 @@ const ( ...@@ -442,15 +442,15 @@ const (
type DaemonSetStatus struct { type DaemonSetStatus struct {
// CurrentNumberScheduled is the number of nodes that are running at least 1 // CurrentNumberScheduled is the number of nodes that are running at least 1
// daemon pod and are supposed to run the daemon pod. // daemon pod and are supposed to run the daemon pod.
CurrentNumberScheduled int `json:"currentNumberScheduled"` CurrentNumberScheduled int32 `json:"currentNumberScheduled"`
// NumberMisscheduled is the number of nodes that are running the daemon pod, but are // NumberMisscheduled is the number of nodes that are running the daemon pod, but are
// not supposed to run the daemon pod. // not supposed to run the daemon pod.
NumberMisscheduled int `json:"numberMisscheduled"` NumberMisscheduled int32 `json:"numberMisscheduled"`
// DesiredNumberScheduled is the total number of nodes that should be running the daemon // DesiredNumberScheduled is the total number of nodes that should be running the daemon
// pod (including nodes correctly running the daemon pod). // pod (including nodes correctly running the daemon pod).
DesiredNumberScheduled int `json:"desiredNumberScheduled"` DesiredNumberScheduled int32 `json:"desiredNumberScheduled"`
} }
// +genclient=true // +genclient=true
...@@ -674,7 +674,7 @@ type ReplicaSetList struct { ...@@ -674,7 +674,7 @@ type ReplicaSetList struct {
// a Template set. // a Template set.
type ReplicaSetSpec struct { type ReplicaSetSpec struct {
// Replicas is the number of desired replicas. // Replicas is the number of desired replicas.
Replicas int `json:"replicas"` Replicas int32 `json:"replicas"`
// Selector is a label query over pods that should match the replica count. // Selector is a label query over pods that should match the replica count.
// Must match in order to be controlled. // Must match in order to be controlled.
...@@ -690,10 +690,10 @@ type ReplicaSetSpec struct { ...@@ -690,10 +690,10 @@ type ReplicaSetSpec struct {
// ReplicaSetStatus represents the current status of a ReplicaSet. // ReplicaSetStatus represents the current status of a ReplicaSet.
type ReplicaSetStatus struct { type ReplicaSetStatus struct {
// Replicas is the number of actual replicas. // Replicas is the number of actual replicas.
Replicas int `json:"replicas"` Replicas int32 `json:"replicas"`
// The number of pods that have labels matching the labels of the pod template of the replicaset. // The number of pods that have labels matching the labels of the pod template of the replicaset.
FullyLabeledReplicas int `json:"fullyLabeledReplicas,omitempty"` FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty"`
// ObservedGeneration is the most recent generation observed by the controller. // ObservedGeneration is the most recent generation observed by the controller.
ObservedGeneration int64 `json:"observedGeneration,omitempty"` ObservedGeneration int64 `json:"observedGeneration,omitempty"`
......
...@@ -110,7 +110,7 @@ func Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *ScaleStatus, out ...@@ -110,7 +110,7 @@ func Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *ScaleStatus, out
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*ScaleStatus))(in) defaulting.(func(*ScaleStatus))(in)
} }
out.Replicas = int(in.Replicas) out.Replicas = in.Replicas
// Normally when 2 fields map to the same internal value we favor the old field, since // Normally when 2 fields map to the same internal value we favor the old field, since
// old clients can't be expected to know about new fields but clients that know about the // old clients can't be expected to know about new fields but clients that know about the
...@@ -140,8 +140,7 @@ func Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions. ...@@ -140,8 +140,7 @@ func Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec(in *extensions.
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*extensions.DeploymentSpec))(in) defaulting.(func(*extensions.DeploymentSpec))(in)
} }
out.Replicas = new(int32) out.Replicas = &in.Replicas
*out.Replicas = int32(in.Replicas)
if in.Selector != nil { if in.Selector != nil {
out.Selector = new(LabelSelector) out.Selector = new(LabelSelector)
if err := Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil { if err := Convert_unversioned_LabelSelector_To_v1beta1_LabelSelector(in.Selector, out.Selector, s); err != nil {
...@@ -176,7 +175,7 @@ func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentS ...@@ -176,7 +175,7 @@ func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentS
defaulting.(func(*DeploymentSpec))(in) defaulting.(func(*DeploymentSpec))(in)
} }
if in.Replicas != nil { if in.Replicas != nil {
out.Replicas = int(*in.Replicas) out.Replicas = *in.Replicas
} }
if in.Selector != nil { if in.Selector != nil {
...@@ -193,11 +192,8 @@ func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentS ...@@ -193,11 +192,8 @@ func Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec(in *DeploymentS
if err := Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil { if err := Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy(&in.Strategy, &out.Strategy, s); err != nil {
return err return err
} }
if in.RevisionHistoryLimit != nil { out.RevisionHistoryLimit = in.RevisionHistoryLimit
out.RevisionHistoryLimit = new(int) out.MinReadySeconds = in.MinReadySeconds
*out.RevisionHistoryLimit = int(*in.RevisionHistoryLimit)
}
out.MinReadySeconds = int(in.MinReadySeconds)
out.Paused = in.Paused out.Paused = in.Paused
if in.RollbackTo != nil { if in.RollbackTo != nil {
out.RollbackTo = new(extensions.RollbackConfig) out.RollbackTo = new(extensions.RollbackConfig)
...@@ -298,7 +294,7 @@ func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetS ...@@ -298,7 +294,7 @@ func Convert_v1beta1_ReplicaSetSpec_To_extensions_ReplicaSetSpec(in *ReplicaSetS
defaulting.(func(*ReplicaSetSpec))(in) defaulting.(func(*ReplicaSetSpec))(in)
} }
if in.Replicas != nil { if in.Replicas != nil {
out.Replicas = int(*in.Replicas) out.Replicas = *in.Replicas
} }
if in.Selector != nil { if in.Selector != nil {
out.Selector = new(unversioned.LabelSelector) out.Selector = new(unversioned.LabelSelector)
...@@ -318,24 +314,9 @@ func Convert_batch_JobSpec_To_v1beta1_JobSpec(in *batch.JobSpec, out *JobSpec, s ...@@ -318,24 +314,9 @@ func Convert_batch_JobSpec_To_v1beta1_JobSpec(in *batch.JobSpec, out *JobSpec, s
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*batch.JobSpec))(in) defaulting.(func(*batch.JobSpec))(in)
} }
if in.Parallelism != nil { out.Parallelism = in.Parallelism
out.Parallelism = new(int32) out.Completions = in.Completions
*out.Parallelism = int32(*in.Parallelism) out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
} else {
out.Parallelism = nil
}
if in.Completions != nil {
out.Completions = new(int32)
*out.Completions = int32(*in.Completions)
} else {
out.Completions = nil
}
if in.ActiveDeadlineSeconds != nil {
out.ActiveDeadlineSeconds = new(int64)
*out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds
} else {
out.ActiveDeadlineSeconds = nil
}
// unable to generate simple pointer conversion for unversioned.LabelSelector -> v1beta1.LabelSelector // unable to generate simple pointer conversion for unversioned.LabelSelector -> v1beta1.LabelSelector
if in.Selector != nil { if in.Selector != nil {
out.Selector = new(LabelSelector) out.Selector = new(LabelSelector)
...@@ -370,24 +351,9 @@ func Convert_v1beta1_JobSpec_To_batch_JobSpec(in *JobSpec, out *batch.JobSpec, s ...@@ -370,24 +351,9 @@ func Convert_v1beta1_JobSpec_To_batch_JobSpec(in *JobSpec, out *batch.JobSpec, s
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*JobSpec))(in) defaulting.(func(*JobSpec))(in)
} }
if in.Parallelism != nil { out.Parallelism = in.Parallelism
out.Parallelism = new(int) out.Completions = in.Completions
*out.Parallelism = int(*in.Parallelism) out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
} else {
out.Parallelism = nil
}
if in.Completions != nil {
out.Completions = new(int)
*out.Completions = int(*in.Completions)
} else {
out.Completions = nil
}
if in.ActiveDeadlineSeconds != nil {
out.ActiveDeadlineSeconds = new(int64)
*out.ActiveDeadlineSeconds = *in.ActiveDeadlineSeconds
} else {
out.ActiveDeadlineSeconds = nil
}
// unable to generate simple pointer conversion for v1beta1.LabelSelector -> unversioned.LabelSelector // unable to generate simple pointer conversion for v1beta1.LabelSelector -> unversioned.LabelSelector
if in.Selector != nil { if in.Selector != nil {
out.Selector = new(unversioned.LabelSelector) out.Selector = new(unversioned.LabelSelector)
......
...@@ -184,7 +184,7 @@ func autoConvert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization ...@@ -184,7 +184,7 @@ func autoConvert_v1beta1_CPUTargetUtilization_To_extensions_CPUTargetUtilization
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*CPUTargetUtilization))(in) defaulting.(func(*CPUTargetUtilization))(in)
} }
out.TargetPercentage = int(in.TargetPercentage) out.TargetPercentage = in.TargetPercentage
return nil return nil
} }
...@@ -196,7 +196,7 @@ func autoConvert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization ...@@ -196,7 +196,7 @@ func autoConvert_extensions_CPUTargetUtilization_To_v1beta1_CPUTargetUtilization
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*extensions.CPUTargetUtilization))(in) defaulting.(func(*extensions.CPUTargetUtilization))(in)
} }
out.TargetPercentage = int32(in.TargetPercentage) out.TargetPercentage = in.TargetPercentage
return nil return nil
} }
...@@ -508,9 +508,9 @@ func autoConvert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(in *Daemo ...@@ -508,9 +508,9 @@ func autoConvert_v1beta1_DaemonSetStatus_To_extensions_DaemonSetStatus(in *Daemo
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*DaemonSetStatus))(in) defaulting.(func(*DaemonSetStatus))(in)
} }
out.CurrentNumberScheduled = int(in.CurrentNumberScheduled) out.CurrentNumberScheduled = in.CurrentNumberScheduled
out.NumberMisscheduled = int(in.NumberMisscheduled) out.NumberMisscheduled = in.NumberMisscheduled
out.DesiredNumberScheduled = int(in.DesiredNumberScheduled) out.DesiredNumberScheduled = in.DesiredNumberScheduled
return nil return nil
} }
...@@ -522,9 +522,9 @@ func autoConvert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(in *exten ...@@ -522,9 +522,9 @@ func autoConvert_extensions_DaemonSetStatus_To_v1beta1_DaemonSetStatus(in *exten
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*extensions.DaemonSetStatus))(in) defaulting.(func(*extensions.DaemonSetStatus))(in)
} }
out.CurrentNumberScheduled = int32(in.CurrentNumberScheduled) out.CurrentNumberScheduled = in.CurrentNumberScheduled
out.NumberMisscheduled = int32(in.NumberMisscheduled) out.NumberMisscheduled = in.NumberMisscheduled
out.DesiredNumberScheduled = int32(in.DesiredNumberScheduled) out.DesiredNumberScheduled = in.DesiredNumberScheduled
return nil return nil
} }
...@@ -695,10 +695,10 @@ func autoConvert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(in *Dep ...@@ -695,10 +695,10 @@ func autoConvert_v1beta1_DeploymentStatus_To_extensions_DeploymentStatus(in *Dep
defaulting.(func(*DeploymentStatus))(in) defaulting.(func(*DeploymentStatus))(in)
} }
out.ObservedGeneration = in.ObservedGeneration out.ObservedGeneration = in.ObservedGeneration
out.Replicas = int(in.Replicas) out.Replicas = in.Replicas
out.UpdatedReplicas = int(in.UpdatedReplicas) out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = int(in.AvailableReplicas) out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = int(in.UnavailableReplicas) out.UnavailableReplicas = in.UnavailableReplicas
return nil return nil
} }
...@@ -711,10 +711,10 @@ func autoConvert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(in *ext ...@@ -711,10 +711,10 @@ func autoConvert_extensions_DeploymentStatus_To_v1beta1_DeploymentStatus(in *ext
defaulting.(func(*extensions.DeploymentStatus))(in) defaulting.(func(*extensions.DeploymentStatus))(in)
} }
out.ObservedGeneration = in.ObservedGeneration out.ObservedGeneration = in.ObservedGeneration
out.Replicas = int32(in.Replicas) out.Replicas = in.Replicas
out.UpdatedReplicas = int32(in.UpdatedReplicas) out.UpdatedReplicas = in.UpdatedReplicas
out.AvailableReplicas = int32(in.AvailableReplicas) out.AvailableReplicas = in.AvailableReplicas
out.UnavailableReplicas = int32(in.UnavailableReplicas) out.UnavailableReplicas = in.UnavailableReplicas
return nil return nil
} }
...@@ -943,12 +943,12 @@ func autoConvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPod ...@@ -943,12 +943,12 @@ func autoConvert_v1beta1_HorizontalPodAutoscalerSpec_To_extensions_HorizontalPod
} }
if in.MinReplicas != nil { if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas in, out := &in.MinReplicas, &out.MinReplicas
*out = new(int) *out = new(int32)
**out = int(**in) **out = **in
} else { } else {
out.MinReplicas = nil out.MinReplicas = nil
} }
out.MaxReplicas = int(in.MaxReplicas) out.MaxReplicas = in.MaxReplicas
if in.CPUUtilization != nil { if in.CPUUtilization != nil {
in, out := &in.CPUUtilization, &out.CPUUtilization in, out := &in.CPUUtilization, &out.CPUUtilization
*out = new(extensions.CPUTargetUtilization) *out = new(extensions.CPUTargetUtilization)
...@@ -975,11 +975,11 @@ func autoConvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPod ...@@ -975,11 +975,11 @@ func autoConvert_extensions_HorizontalPodAutoscalerSpec_To_v1beta1_HorizontalPod
if in.MinReplicas != nil { if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas in, out := &in.MinReplicas, &out.MinReplicas
*out = new(int32) *out = new(int32)
**out = int32(**in) **out = **in
} else { } else {
out.MinReplicas = nil out.MinReplicas = nil
} }
out.MaxReplicas = int32(in.MaxReplicas) out.MaxReplicas = in.MaxReplicas
if in.CPUUtilization != nil { if in.CPUUtilization != nil {
in, out := &in.CPUUtilization, &out.CPUUtilization in, out := &in.CPUUtilization, &out.CPUUtilization
*out = new(CPUTargetUtilization) *out = new(CPUTargetUtilization)
...@@ -1016,12 +1016,12 @@ func autoConvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalP ...@@ -1016,12 +1016,12 @@ func autoConvert_v1beta1_HorizontalPodAutoscalerStatus_To_extensions_HorizontalP
} else { } else {
out.LastScaleTime = nil out.LastScaleTime = nil
} }
out.CurrentReplicas = int(in.CurrentReplicas) out.CurrentReplicas = in.CurrentReplicas
out.DesiredReplicas = int(in.DesiredReplicas) out.DesiredReplicas = in.DesiredReplicas
if in.CurrentCPUUtilizationPercentage != nil { if in.CurrentCPUUtilizationPercentage != nil {
in, out := &in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage in, out := &in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage
*out = new(int) *out = new(int32)
**out = int(**in) **out = **in
} else { } else {
out.CurrentCPUUtilizationPercentage = nil out.CurrentCPUUtilizationPercentage = nil
} }
...@@ -1052,12 +1052,12 @@ func autoConvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalP ...@@ -1052,12 +1052,12 @@ func autoConvert_extensions_HorizontalPodAutoscalerStatus_To_v1beta1_HorizontalP
} else { } else {
out.LastScaleTime = nil out.LastScaleTime = nil
} }
out.CurrentReplicas = int32(in.CurrentReplicas) out.CurrentReplicas = in.CurrentReplicas
out.DesiredReplicas = int32(in.DesiredReplicas) out.DesiredReplicas = in.DesiredReplicas
if in.CurrentCPUUtilizationPercentage != nil { if in.CurrentCPUUtilizationPercentage != nil {
in, out := &in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage in, out := &in.CurrentCPUUtilizationPercentage, &out.CurrentCPUUtilizationPercentage
*out = new(int32) *out = new(int32)
**out = int32(**in) **out = **in
} else { } else {
out.CurrentCPUUtilizationPercentage = nil out.CurrentCPUUtilizationPercentage = nil
} }
...@@ -1655,9 +1655,9 @@ func autoConvert_v1beta1_JobStatus_To_batch_JobStatus(in *JobStatus, out *batch. ...@@ -1655,9 +1655,9 @@ func autoConvert_v1beta1_JobStatus_To_batch_JobStatus(in *JobStatus, out *batch.
} else { } else {
out.CompletionTime = nil out.CompletionTime = nil
} }
out.Active = int(in.Active) out.Active = in.Active
out.Succeeded = int(in.Succeeded) out.Succeeded = in.Succeeded
out.Failed = int(in.Failed) out.Failed = in.Failed
return nil return nil
} }
...@@ -1698,9 +1698,9 @@ func autoConvert_batch_JobStatus_To_v1beta1_JobStatus(in *batch.JobStatus, out * ...@@ -1698,9 +1698,9 @@ func autoConvert_batch_JobStatus_To_v1beta1_JobStatus(in *batch.JobStatus, out *
} else { } else {
out.CompletionTime = nil out.CompletionTime = nil
} }
out.Active = int32(in.Active) out.Active = in.Active
out.Succeeded = int32(in.Succeeded) out.Succeeded = in.Succeeded
out.Failed = int32(in.Failed) out.Failed = in.Failed
return nil return nil
} }
...@@ -2116,8 +2116,8 @@ func autoConvert_v1beta1_ReplicaSetStatus_To_extensions_ReplicaSetStatus(in *Rep ...@@ -2116,8 +2116,8 @@ func autoConvert_v1beta1_ReplicaSetStatus_To_extensions_ReplicaSetStatus(in *Rep
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*ReplicaSetStatus))(in) defaulting.(func(*ReplicaSetStatus))(in)
} }
out.Replicas = int(in.Replicas) out.Replicas = in.Replicas
out.FullyLabeledReplicas = int(in.FullyLabeledReplicas) out.FullyLabeledReplicas = in.FullyLabeledReplicas
out.ObservedGeneration = in.ObservedGeneration out.ObservedGeneration = in.ObservedGeneration
return nil return nil
} }
...@@ -2130,8 +2130,8 @@ func autoConvert_extensions_ReplicaSetStatus_To_v1beta1_ReplicaSetStatus(in *ext ...@@ -2130,8 +2130,8 @@ func autoConvert_extensions_ReplicaSetStatus_To_v1beta1_ReplicaSetStatus(in *ext
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*extensions.ReplicaSetStatus))(in) defaulting.(func(*extensions.ReplicaSetStatus))(in)
} }
out.Replicas = int32(in.Replicas) out.Replicas = in.Replicas
out.FullyLabeledReplicas = int32(in.FullyLabeledReplicas) out.FullyLabeledReplicas = in.FullyLabeledReplicas
out.ObservedGeneration = in.ObservedGeneration out.ObservedGeneration = in.ObservedGeneration
return nil return nil
} }
...@@ -2334,7 +2334,7 @@ func autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *ScaleSpec, out *e ...@@ -2334,7 +2334,7 @@ func autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *ScaleSpec, out *e
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*ScaleSpec))(in) defaulting.(func(*ScaleSpec))(in)
} }
out.Replicas = int(in.Replicas) out.Replicas = in.Replicas
return nil return nil
} }
...@@ -2346,7 +2346,7 @@ func autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleS ...@@ -2346,7 +2346,7 @@ func autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleS
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*extensions.ScaleSpec))(in) defaulting.(func(*extensions.ScaleSpec))(in)
} }
out.Replicas = int32(in.Replicas) out.Replicas = in.Replicas
return nil return nil
} }
......
...@@ -583,7 +583,7 @@ func ValidateReplicaSetSpec(spec *extensions.ReplicaSetSpec, fldPath *field.Path ...@@ -583,7 +583,7 @@ func ValidateReplicaSetSpec(spec *extensions.ReplicaSetSpec, fldPath *field.Path
} }
// Validates the given template and ensures that it is in accordance with the desired selector and replicas. // Validates the given template and ensures that it is in accordance with the desired selector and replicas.
func ValidatePodTemplateSpecForReplicaSet(template *api.PodTemplateSpec, selector labels.Selector, replicas int, fldPath *field.Path) field.ErrorList { func ValidatePodTemplateSpecForReplicaSet(template *api.PodTemplateSpec, selector labels.Selector, replicas int32, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if template == nil { if template == nil {
allErrs = append(allErrs, field.Required(fldPath, "")) allErrs = append(allErrs, field.Required(fldPath, ""))
......
...@@ -41,7 +41,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -41,7 +41,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myrc", Name: "myrc",
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70},
}, },
...@@ -57,7 +57,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -57,7 +57,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myrc", Name: "myrc",
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
}, },
}, },
...@@ -75,7 +75,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -75,7 +75,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myrc", Name: "myrc",
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
}, },
}, },
...@@ -95,7 +95,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -95,7 +95,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault},
Spec: extensions.HorizontalPodAutoscalerSpec{ Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: extensions.SubresourceReference{Name: "myrc", Subresource: "scale"}, ScaleRef: extensions.SubresourceReference{Name: "myrc", Subresource: "scale"},
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70},
}, },
...@@ -107,7 +107,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -107,7 +107,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault},
Spec: extensions.HorizontalPodAutoscalerSpec{ Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: extensions.SubresourceReference{Kind: "..", Name: "myrc", Subresource: "scale"}, ScaleRef: extensions.SubresourceReference{Kind: "..", Name: "myrc", Subresource: "scale"},
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70},
}, },
...@@ -119,7 +119,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -119,7 +119,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault},
Spec: extensions.HorizontalPodAutoscalerSpec{ Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Subresource: "scale"}, ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Subresource: "scale"},
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70},
}, },
...@@ -131,7 +131,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -131,7 +131,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault},
Spec: extensions.HorizontalPodAutoscalerSpec{ Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "..", Subresource: "scale"}, ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "..", Subresource: "scale"},
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70},
}, },
...@@ -143,7 +143,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -143,7 +143,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault},
Spec: extensions.HorizontalPodAutoscalerSpec{ Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: ""}, ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: ""},
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70},
}, },
...@@ -155,7 +155,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -155,7 +155,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault},
Spec: extensions.HorizontalPodAutoscalerSpec{ Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: ".."}, ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: ".."},
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70},
}, },
...@@ -167,7 +167,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -167,7 +167,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault}, ObjectMeta: api.ObjectMeta{Name: "myautoscaler", Namespace: api.NamespaceDefault},
Spec: extensions.HorizontalPodAutoscalerSpec{ Spec: extensions.HorizontalPodAutoscalerSpec{
ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: "randomsubresource"}, ScaleRef: extensions.SubresourceReference{Kind: "ReplicationController", Name: "myrc", Subresource: "randomsubresource"},
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: 70},
}, },
...@@ -184,7 +184,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -184,7 +184,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ScaleRef: extensions.SubresourceReference{ ScaleRef: extensions.SubresourceReference{
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(-1), MinReplicas: newInt32(-1),
MaxReplicas: 5, MaxReplicas: 5,
}, },
}, },
...@@ -200,7 +200,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -200,7 +200,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ScaleRef: extensions.SubresourceReference{ ScaleRef: extensions.SubresourceReference{
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(7), MinReplicas: newInt32(7),
MaxReplicas: 5, MaxReplicas: 5,
}, },
}, },
...@@ -216,7 +216,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -216,7 +216,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
ScaleRef: extensions.SubresourceReference{ ScaleRef: extensions.SubresourceReference{
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: -70}, CPUUtilization: &extensions.CPUTargetUtilization{TargetPercentage: -70},
}, },
...@@ -238,7 +238,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -238,7 +238,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myrc", Name: "myrc",
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
}, },
}, },
...@@ -259,7 +259,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -259,7 +259,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myrc", Name: "myrc",
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
}, },
}, },
...@@ -280,7 +280,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -280,7 +280,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myrc", Name: "myrc",
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
}, },
}, },
...@@ -301,7 +301,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) { ...@@ -301,7 +301,7 @@ func TestValidateHorizontalPodAutoscaler(t *testing.T) {
Name: "myrc", Name: "myrc",
Subresource: "scale", Subresource: "scale",
}, },
MinReplicas: newInt(1), MinReplicas: newInt32(1),
MaxReplicas: 5, MaxReplicas: 5,
}, },
}, },
...@@ -1709,8 +1709,8 @@ func TestValidateReplicaSet(t *testing.T) { ...@@ -1709,8 +1709,8 @@ func TestValidateReplicaSet(t *testing.T) {
} }
} }
func newInt(val int) *int { func newInt32(val int32) *int32 {
p := new(int) p := new(int32)
*p = val *p = val
return p return p
} }
......
...@@ -236,7 +236,7 @@ func (e *eventLogger) eventObserve(newEvent *api.Event) (*api.Event, []byte, err ...@@ -236,7 +236,7 @@ func (e *eventLogger) eventObserve(newEvent *api.Event) (*api.Event, []byte, err
event.Name = lastObservation.name event.Name = lastObservation.name
event.ResourceVersion = lastObservation.resourceVersion event.ResourceVersion = lastObservation.resourceVersion
event.FirstTimestamp = lastObservation.firstTimestamp event.FirstTimestamp = lastObservation.firstTimestamp
event.Count = lastObservation.count + 1 event.Count = int32(lastObservation.count) + 1
eventCopy2 := *event eventCopy2 := *event
eventCopy2.Count = 0 eventCopy2.Count = 0
...@@ -251,7 +251,7 @@ func (e *eventLogger) eventObserve(newEvent *api.Event) (*api.Event, []byte, err ...@@ -251,7 +251,7 @@ func (e *eventLogger) eventObserve(newEvent *api.Event) (*api.Event, []byte, err
e.cache.Add( e.cache.Add(
key, key,
eventLog{ eventLog{
count: event.Count, count: int(event.Count),
firstTimestamp: event.FirstTimestamp, firstTimestamp: event.FirstTimestamp,
name: event.Name, name: event.Name,
resourceVersion: event.ResourceVersion, resourceVersion: event.ResourceVersion,
...@@ -269,7 +269,7 @@ func (e *eventLogger) updateState(event *api.Event) { ...@@ -269,7 +269,7 @@ func (e *eventLogger) updateState(event *api.Event) {
e.cache.Add( e.cache.Add(
key, key,
eventLog{ eventLog{
count: event.Count, count: int(event.Count),
firstTimestamp: event.FirstTimestamp, firstTimestamp: event.FirstTimestamp,
name: event.Name, name: event.Name,
resourceVersion: event.ResourceVersion, resourceVersion: event.ResourceVersion,
......
...@@ -87,7 +87,7 @@ func makeSimilarEvents(num int, template api.Event, messagePrefix string) []api. ...@@ -87,7 +87,7 @@ func makeSimilarEvents(num int, template api.Event, messagePrefix string) []api.
} }
func setCount(event api.Event, count int) api.Event { func setCount(event api.Event, count int) api.Event {
event.Count = count event.Count = int32(count)
return event return event
} }
......
...@@ -717,8 +717,8 @@ func loadBalancerPortRange(ports []api.ServicePort) (string, error) { ...@@ -717,8 +717,8 @@ func loadBalancerPortRange(ports []api.ServicePort) (string, error) {
return "", fmt.Errorf("Invalid protocol %s, only TCP and UDP are supported", string(ports[0].Protocol)) return "", fmt.Errorf("Invalid protocol %s, only TCP and UDP are supported", string(ports[0].Protocol))
} }
minPort := 65536 minPort := int32(65536)
maxPort := 0 maxPort := int32(0)
for i := range ports { for i := range ports {
if ports[i].Port < minPort { if ports[i].Port < minPort {
minPort = ports[i].Port minPort = ports[i].Port
...@@ -776,7 +776,7 @@ func (gce *GCECloud) firewallNeedsUpdate(name, serviceName, region, ipAddress st ...@@ -776,7 +776,7 @@ func (gce *GCECloud) firewallNeedsUpdate(name, serviceName, region, ipAddress st
// Make sure the allowed ports match. // Make sure the allowed ports match.
allowedPorts := make([]string, len(ports)) allowedPorts := make([]string, len(ports))
for ix := range ports { for ix := range ports {
allowedPorts[ix] = strconv.Itoa(ports[ix].Port) allowedPorts[ix] = strconv.Itoa(int(ports[ix].Port))
} }
if !slicesEqual(allowedPorts, fw.Allowed[0].Ports) { if !slicesEqual(allowedPorts, fw.Allowed[0].Ports) {
return true, true, nil return true, true, nil
...@@ -910,7 +910,7 @@ func (gce *GCECloud) updateFirewall(name, region, desc string, sourceRanges nets ...@@ -910,7 +910,7 @@ func (gce *GCECloud) updateFirewall(name, region, desc string, sourceRanges nets
func (gce *GCECloud) firewallObject(name, region, desc string, sourceRanges netsets.IPNet, ports []api.ServicePort, hosts []*gceInstance) (*compute.Firewall, error) { func (gce *GCECloud) firewallObject(name, region, desc string, sourceRanges netsets.IPNet, ports []api.ServicePort, hosts []*gceInstance) (*compute.Firewall, error) {
allowedPorts := make([]string, len(ports)) allowedPorts := make([]string, len(ports))
for ix := range ports { for ix := range ports {
allowedPorts[ix] = strconv.Itoa(ports[ix].Port) allowedPorts[ix] = strconv.Itoa(int(ports[ix].Port))
} }
hostTags, err := gce.computeHostTags(hosts) hostTags, err := gce.computeHostTags(hosts)
if err != nil { if err != nil {
...@@ -1248,7 +1248,7 @@ func (gce *GCECloud) CreateFirewall(name, desc string, sourceRanges netsets.IPNe ...@@ -1248,7 +1248,7 @@ func (gce *GCECloud) CreateFirewall(name, desc string, sourceRanges netsets.IPNe
// if UDP ports are required. This means the method signature will change // if UDP ports are required. This means the method signature will change
// forcing downstream clients to refactor interfaces. // forcing downstream clients to refactor interfaces.
for _, p := range ports { for _, p := range ports {
svcPorts = append(svcPorts, api.ServicePort{Port: int(p), Protocol: api.ProtocolTCP}) svcPorts = append(svcPorts, api.ServicePort{Port: int32(p), Protocol: api.ProtocolTCP})
} }
hosts, err := gce.getInstancesByNames(hostNames) hosts, err := gce.getInstancesByNames(hostNames)
if err != nil { if err != nil {
...@@ -1282,7 +1282,7 @@ func (gce *GCECloud) UpdateFirewall(name, desc string, sourceRanges netsets.IPNe ...@@ -1282,7 +1282,7 @@ func (gce *GCECloud) UpdateFirewall(name, desc string, sourceRanges netsets.IPNe
// if UDP ports are required. This means the method signature will change, // if UDP ports are required. This means the method signature will change,
// forcing downstream clients to refactor interfaces. // forcing downstream clients to refactor interfaces.
for _, p := range ports { for _, p := range ports {
svcPorts = append(svcPorts, api.ServicePort{Port: int(p), Protocol: api.ProtocolTCP}) svcPorts = append(svcPorts, api.ServicePort{Port: int32(p), Protocol: api.ProtocolTCP})
} }
hosts, err := gce.getInstancesByNames(hostNames) hosts, err := gce.getInstancesByNames(hostNames)
if err != nil { if err != nil {
......
...@@ -740,7 +740,7 @@ func (lb *LoadBalancer) EnsureLoadBalancer(apiService *api.Service, hosts []stri ...@@ -740,7 +740,7 @@ func (lb *LoadBalancer) EnsureLoadBalancer(apiService *api.Service, hosts []stri
_, err = members.Create(lb.network, members.CreateOpts{ _, err = members.Create(lb.network, members.CreateOpts{
PoolID: pool.ID, PoolID: pool.ID,
ProtocolPort: ports[0].NodePort, //TODO: need to handle multi-port ProtocolPort: int(ports[0].NodePort), //TODO: need to handle multi-port
Address: addr, Address: addr,
}).Extract() }).Extract()
if err != nil { if err != nil {
...@@ -774,7 +774,7 @@ func (lb *LoadBalancer) EnsureLoadBalancer(apiService *api.Service, hosts []stri ...@@ -774,7 +774,7 @@ func (lb *LoadBalancer) EnsureLoadBalancer(apiService *api.Service, hosts []stri
Name: name, Name: name,
Description: fmt.Sprintf("Kubernetes external service %s", name), Description: fmt.Sprintf("Kubernetes external service %s", name),
Protocol: "TCP", Protocol: "TCP",
ProtocolPort: ports[0].Port, //TODO: need to handle multi-port ProtocolPort: int(ports[0].Port), //TODO: need to handle multi-port
PoolID: pool.ID, PoolID: pool.ID,
SubnetID: lb.opts.SubnetId, SubnetID: lb.opts.SubnetId,
Persistence: persistence, Persistence: persistence,
......
...@@ -576,7 +576,7 @@ func podReadyTime(pod *api.Pod) unversioned.Time { ...@@ -576,7 +576,7 @@ func podReadyTime(pod *api.Pod) unversioned.Time {
func maxContainerRestarts(pod *api.Pod) int { func maxContainerRestarts(pod *api.Pod) int {
maxRestarts := 0 maxRestarts := 0
for _, c := range pod.Status.ContainerStatuses { for _, c := range pod.Status.ContainerStatuses {
maxRestarts = integer.IntMax(maxRestarts, c.RestartCount) maxRestarts = integer.IntMax(maxRestarts, int(c.RestartCount))
} }
return maxRestarts return maxRestarts
} }
......
...@@ -60,7 +60,7 @@ func newReplicationController(replicas int) *api.ReplicationController { ...@@ -60,7 +60,7 @@ func newReplicationController(replicas int) *api.ReplicationController {
ResourceVersion: "18", ResourceVersion: "18",
}, },
Spec: api.ReplicationControllerSpec{ Spec: api.ReplicationControllerSpec{
Replicas: replicas, Replicas: int32(replicas),
Selector: map[string]string{"foo": "bar"}, Selector: map[string]string{"foo": "bar"},
Template: &api.PodTemplateSpec{ Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
......
...@@ -553,15 +553,15 @@ func (dsc *DaemonSetsController) manage(ds *extensions.DaemonSet) { ...@@ -553,15 +553,15 @@ func (dsc *DaemonSetsController) manage(ds *extensions.DaemonSet) {
} }
func storeDaemonSetStatus(dsClient unversionedextensions.DaemonSetInterface, ds *extensions.DaemonSet, desiredNumberScheduled, currentNumberScheduled, numberMisscheduled int) error { func storeDaemonSetStatus(dsClient unversionedextensions.DaemonSetInterface, ds *extensions.DaemonSet, desiredNumberScheduled, currentNumberScheduled, numberMisscheduled int) error {
if ds.Status.DesiredNumberScheduled == desiredNumberScheduled && ds.Status.CurrentNumberScheduled == currentNumberScheduled && ds.Status.NumberMisscheduled == numberMisscheduled { if int(ds.Status.DesiredNumberScheduled) == desiredNumberScheduled && int(ds.Status.CurrentNumberScheduled) == currentNumberScheduled && int(ds.Status.NumberMisscheduled) == numberMisscheduled {
return nil return nil
} }
var updateErr, getErr error var updateErr, getErr error
for i := 0; i <= StatusUpdateRetries; i++ { for i := 0; i <= StatusUpdateRetries; i++ {
ds.Status.DesiredNumberScheduled = desiredNumberScheduled ds.Status.DesiredNumberScheduled = int32(desiredNumberScheduled)
ds.Status.CurrentNumberScheduled = currentNumberScheduled ds.Status.CurrentNumberScheduled = int32(currentNumberScheduled)
ds.Status.NumberMisscheduled = numberMisscheduled ds.Status.NumberMisscheduled = int32(numberMisscheduled)
_, updateErr = dsClient.UpdateStatus(ds) _, updateErr = dsClient.UpdateStatus(ds)
if updateErr == nil { if updateErr == nil {
......
...@@ -1065,12 +1065,12 @@ func (dc *DeploymentController) reconcileOldReplicaSets(allRSs []*extensions.Rep ...@@ -1065,12 +1065,12 @@ func (dc *DeploymentController) reconcileOldReplicaSets(allRSs []*extensions.Rep
} }
// cleanupUnhealthyReplicas will scale down old replica sets with unhealthy replicas, so that all unhealthy replicas will be deleted. // cleanupUnhealthyReplicas will scale down old replica sets with unhealthy replicas, so that all unhealthy replicas will be deleted.
func (dc *DeploymentController) cleanupUnhealthyReplicas(oldRSs []*extensions.ReplicaSet, deployment *extensions.Deployment, maxCleanupCount int) ([]*extensions.ReplicaSet, int, error) { func (dc *DeploymentController) cleanupUnhealthyReplicas(oldRSs []*extensions.ReplicaSet, deployment *extensions.Deployment, maxCleanupCount int32) ([]*extensions.ReplicaSet, int32, error) {
sort.Sort(controller.ReplicaSetsByCreationTimestamp(oldRSs)) sort.Sort(controller.ReplicaSetsByCreationTimestamp(oldRSs))
// Safely scale down all old replica sets with unhealthy replicas. Replica set will sort the pods in the order // Safely scale down all old replica sets with unhealthy replicas. Replica set will sort the pods in the order
// such that not-ready < ready, unscheduled < scheduled, and pending < running. This ensures that unhealthy replicas will // such that not-ready < ready, unscheduled < scheduled, and pending < running. This ensures that unhealthy replicas will
// been deleted first and won't increase unavailability. // been deleted first and won't increase unavailability.
totalScaledDown := 0 totalScaledDown := int32(0)
for i, targetRS := range oldRSs { for i, targetRS := range oldRSs {
if totalScaledDown >= maxCleanupCount { if totalScaledDown >= maxCleanupCount {
break break
...@@ -1088,7 +1088,7 @@ func (dc *DeploymentController) cleanupUnhealthyReplicas(oldRSs []*extensions.Re ...@@ -1088,7 +1088,7 @@ func (dc *DeploymentController) cleanupUnhealthyReplicas(oldRSs []*extensions.Re
continue continue
} }
scaledDownCount := integer.IntMin(maxCleanupCount-totalScaledDown, targetRS.Spec.Replicas-readyPodCount) scaledDownCount := int32(integer.IntMin(int(maxCleanupCount-totalScaledDown), int(targetRS.Spec.Replicas-readyPodCount)))
newReplicasCount := targetRS.Spec.Replicas - scaledDownCount newReplicasCount := targetRS.Spec.Replicas - scaledDownCount
if newReplicasCount > targetRS.Spec.Replicas { if newReplicasCount > targetRS.Spec.Replicas {
return nil, 0, fmt.Errorf("when cleaning up unhealthy replicas, got invalid request to scale down %s/%s %d -> %d", targetRS.Namespace, targetRS.Name, targetRS.Spec.Replicas, newReplicasCount) return nil, 0, fmt.Errorf("when cleaning up unhealthy replicas, got invalid request to scale down %s/%s %d -> %d", targetRS.Namespace, targetRS.Name, targetRS.Spec.Replicas, newReplicasCount)
...@@ -1105,7 +1105,7 @@ func (dc *DeploymentController) cleanupUnhealthyReplicas(oldRSs []*extensions.Re ...@@ -1105,7 +1105,7 @@ func (dc *DeploymentController) cleanupUnhealthyReplicas(oldRSs []*extensions.Re
// scaleDownOldReplicaSetsForRollingUpdate scales down old replica sets when deployment strategy is "RollingUpdate". // scaleDownOldReplicaSetsForRollingUpdate scales down old replica sets when deployment strategy is "RollingUpdate".
// Need check maxUnavailable to ensure availability // Need check maxUnavailable to ensure availability
func (dc *DeploymentController) scaleDownOldReplicaSetsForRollingUpdate(allRSs []*extensions.ReplicaSet, oldRSs []*extensions.ReplicaSet, deployment *extensions.Deployment) (int, error) { func (dc *DeploymentController) scaleDownOldReplicaSetsForRollingUpdate(allRSs []*extensions.ReplicaSet, oldRSs []*extensions.ReplicaSet, deployment *extensions.Deployment) (int32, error) {
_, maxUnavailable, err := deploymentutil.ResolveFenceposts(&deployment.Spec.Strategy.RollingUpdate.MaxSurge, &deployment.Spec.Strategy.RollingUpdate.MaxUnavailable, deployment.Spec.Replicas) _, maxUnavailable, err := deploymentutil.ResolveFenceposts(&deployment.Spec.Strategy.RollingUpdate.MaxSurge, &deployment.Spec.Strategy.RollingUpdate.MaxUnavailable, deployment.Spec.Replicas)
if err != nil { if err != nil {
return 0, err return 0, err
...@@ -1126,7 +1126,7 @@ func (dc *DeploymentController) scaleDownOldReplicaSetsForRollingUpdate(allRSs [ ...@@ -1126,7 +1126,7 @@ func (dc *DeploymentController) scaleDownOldReplicaSetsForRollingUpdate(allRSs [
sort.Sort(controller.ReplicaSetsByCreationTimestamp(oldRSs)) sort.Sort(controller.ReplicaSetsByCreationTimestamp(oldRSs))
totalScaledDown := 0 totalScaledDown := int32(0)
totalScaleDownCount := readyPodCount - minAvailable totalScaleDownCount := readyPodCount - minAvailable
for _, targetRS := range oldRSs { for _, targetRS := range oldRSs {
if totalScaledDown >= totalScaleDownCount { if totalScaledDown >= totalScaleDownCount {
...@@ -1138,7 +1138,7 @@ func (dc *DeploymentController) scaleDownOldReplicaSetsForRollingUpdate(allRSs [ ...@@ -1138,7 +1138,7 @@ func (dc *DeploymentController) scaleDownOldReplicaSetsForRollingUpdate(allRSs [
continue continue
} }
// Scale down. // Scale down.
scaleDownCount := integer.IntMin(targetRS.Spec.Replicas, totalScaleDownCount-totalScaledDown) scaleDownCount := int32(integer.IntMin(int(targetRS.Spec.Replicas), int(totalScaleDownCount-totalScaledDown)))
newReplicasCount := targetRS.Spec.Replicas - scaleDownCount newReplicasCount := targetRS.Spec.Replicas - scaleDownCount
if newReplicasCount > targetRS.Spec.Replicas { if newReplicasCount > targetRS.Spec.Replicas {
return 0, fmt.Errorf("when scaling down old RS, got invalid request to scale down %s/%s %d -> %d", targetRS.Namespace, targetRS.Name, targetRS.Spec.Replicas, newReplicasCount) return 0, fmt.Errorf("when scaling down old RS, got invalid request to scale down %s/%s %d -> %d", targetRS.Namespace, targetRS.Name, targetRS.Spec.Replicas, newReplicasCount)
...@@ -1180,7 +1180,7 @@ func (dc *DeploymentController) scaleUpNewReplicaSetForRecreate(newRS *extension ...@@ -1180,7 +1180,7 @@ func (dc *DeploymentController) scaleUpNewReplicaSetForRecreate(newRS *extension
} }
func (dc *DeploymentController) cleanupOldReplicaSets(oldRSs []*extensions.ReplicaSet, deployment *extensions.Deployment) error { func (dc *DeploymentController) cleanupOldReplicaSets(oldRSs []*extensions.ReplicaSet, deployment *extensions.Deployment) error {
diff := len(oldRSs) - *deployment.Spec.RevisionHistoryLimit diff := int32(len(oldRSs)) - *deployment.Spec.RevisionHistoryLimit
if diff <= 0 { if diff <= 0 {
return nil return nil
} }
...@@ -1189,7 +1189,7 @@ func (dc *DeploymentController) cleanupOldReplicaSets(oldRSs []*extensions.Repli ...@@ -1189,7 +1189,7 @@ func (dc *DeploymentController) cleanupOldReplicaSets(oldRSs []*extensions.Repli
var errList []error var errList []error
// TODO: This should be parallelized. // TODO: This should be parallelized.
for i := 0; i < diff; i++ { for i := int32(0); i < diff; i++ {
rs := oldRSs[i] rs := oldRSs[i]
// Avoid delete replica set with non-zero replica counts // Avoid delete replica set with non-zero replica counts
if rs.Status.Replicas != 0 || rs.Spec.Replicas != 0 || rs.Generation > rs.Status.ObservedGeneration { if rs.Status.Replicas != 0 || rs.Spec.Replicas != 0 || rs.Generation > rs.Status.ObservedGeneration {
...@@ -1223,7 +1223,7 @@ func (dc *DeploymentController) updateDeploymentStatus(allRSs []*extensions.Repl ...@@ -1223,7 +1223,7 @@ func (dc *DeploymentController) updateDeploymentStatus(allRSs []*extensions.Repl
return err return err
} }
func (dc *DeploymentController) calculateStatus(allRSs []*extensions.ReplicaSet, newRS *extensions.ReplicaSet, deployment *extensions.Deployment) (totalActualReplicas, updatedReplicas, availableReplicas, unavailableReplicas int, err error) { func (dc *DeploymentController) calculateStatus(allRSs []*extensions.ReplicaSet, newRS *extensions.ReplicaSet, deployment *extensions.Deployment) (totalActualReplicas, updatedReplicas, availableReplicas, unavailableReplicas int32, err error) {
totalActualReplicas = deploymentutil.GetActualReplicaCountForReplicaSets(allRSs) totalActualReplicas = deploymentutil.GetActualReplicaCountForReplicaSets(allRSs)
updatedReplicas = deploymentutil.GetActualReplicaCountForReplicaSets([]*extensions.ReplicaSet{newRS}) updatedReplicas = deploymentutil.GetActualReplicaCountForReplicaSets([]*extensions.ReplicaSet{newRS})
minReadySeconds := deployment.Spec.MinReadySeconds minReadySeconds := deployment.Spec.MinReadySeconds
...@@ -1237,7 +1237,7 @@ func (dc *DeploymentController) calculateStatus(allRSs []*extensions.ReplicaSet, ...@@ -1237,7 +1237,7 @@ func (dc *DeploymentController) calculateStatus(allRSs []*extensions.ReplicaSet,
return return
} }
func (dc *DeploymentController) scaleReplicaSetAndRecordEvent(rs *extensions.ReplicaSet, newScale int, deployment *extensions.Deployment) (bool, *extensions.ReplicaSet, error) { func (dc *DeploymentController) scaleReplicaSetAndRecordEvent(rs *extensions.ReplicaSet, newScale int32, deployment *extensions.Deployment) (bool, *extensions.ReplicaSet, error) {
// No need to scale // No need to scale
if rs.Spec.Replicas == newScale { if rs.Spec.Replicas == newScale {
return false, rs, nil return false, rs, nil
...@@ -1257,7 +1257,7 @@ func (dc *DeploymentController) scaleReplicaSetAndRecordEvent(rs *extensions.Rep ...@@ -1257,7 +1257,7 @@ func (dc *DeploymentController) scaleReplicaSetAndRecordEvent(rs *extensions.Rep
return true, newRS, err return true, newRS, err
} }
func (dc *DeploymentController) scaleReplicaSet(rs *extensions.ReplicaSet, newScale int) (*extensions.ReplicaSet, error) { func (dc *DeploymentController) scaleReplicaSet(rs *extensions.ReplicaSet, newScale int32) (*extensions.ReplicaSet, error) {
// TODO: Using client for now, update to use store when it is ready. // TODO: Using client for now, update to use store when it is ready.
// NOTE: This mutates the ReplicaSet passed in. Not sure if that's a good idea. // NOTE: This mutates the ReplicaSet passed in. Not sure if that's a good idea.
rs.Spec.Replicas = newScale rs.Spec.Replicas = newScale
......
...@@ -39,7 +39,7 @@ func rs(name string, replicas int, selector map[string]string) *exp.ReplicaSet { ...@@ -39,7 +39,7 @@ func rs(name string, replicas int, selector map[string]string) *exp.ReplicaSet {
Name: name, Name: name,
}, },
Spec: exp.ReplicaSetSpec{ Spec: exp.ReplicaSetSpec{
Replicas: replicas, Replicas: int32(replicas),
Selector: &unversioned.LabelSelector{MatchLabels: selector}, Selector: &unversioned.LabelSelector{MatchLabels: selector},
Template: api.PodTemplateSpec{}, Template: api.PodTemplateSpec{},
}, },
...@@ -49,7 +49,7 @@ func rs(name string, replicas int, selector map[string]string) *exp.ReplicaSet { ...@@ -49,7 +49,7 @@ func rs(name string, replicas int, selector map[string]string) *exp.ReplicaSet {
func newRSWithStatus(name string, specReplicas, statusReplicas int, selector map[string]string) *exp.ReplicaSet { func newRSWithStatus(name string, specReplicas, statusReplicas int, selector map[string]string) *exp.ReplicaSet {
rs := rs(name, specReplicas, selector) rs := rs(name, specReplicas, selector)
rs.Status = exp.ReplicaSetStatus{ rs.Status = exp.ReplicaSetStatus{
Replicas: statusReplicas, Replicas: int32(statusReplicas),
} }
return rs return rs
} }
...@@ -60,7 +60,7 @@ func deployment(name string, replicas int, maxSurge, maxUnavailable intstr.IntOr ...@@ -60,7 +60,7 @@ func deployment(name string, replicas int, maxSurge, maxUnavailable intstr.IntOr
Name: name, Name: name,
}, },
Spec: exp.DeploymentSpec{ Spec: exp.DeploymentSpec{
Replicas: replicas, Replicas: int32(replicas),
Strategy: exp.DeploymentStrategy{ Strategy: exp.DeploymentStrategy{
Type: exp.RollingUpdateDeploymentStrategyType, Type: exp.RollingUpdateDeploymentStrategyType,
RollingUpdate: &exp.RollingUpdateDeployment{ RollingUpdate: &exp.RollingUpdateDeployment{
...@@ -75,6 +75,11 @@ func deployment(name string, replicas int, maxSurge, maxUnavailable intstr.IntOr ...@@ -75,6 +75,11 @@ func deployment(name string, replicas int, maxSurge, maxUnavailable intstr.IntOr
var alwaysReady = func() bool { return true } var alwaysReady = func() bool { return true }
func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment { func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment {
var v *int32
if revisionHistoryLimit != nil {
v = new(int32)
*v = int32(*revisionHistoryLimit)
}
d := exp.Deployment{ d := exp.Deployment{
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.GroupVersion().String()}, TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.GroupVersion().String()},
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
...@@ -88,7 +93,7 @@ func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment { ...@@ -88,7 +93,7 @@ func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment {
Type: exp.RollingUpdateDeploymentStrategyType, Type: exp.RollingUpdateDeploymentStrategyType,
RollingUpdate: &exp.RollingUpdateDeployment{}, RollingUpdate: &exp.RollingUpdateDeployment{},
}, },
Replicas: replicas, Replicas: int32(replicas),
Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}}, Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
...@@ -105,7 +110,7 @@ func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment { ...@@ -105,7 +110,7 @@ func newDeployment(replicas int, revisionHistoryLimit *int) *exp.Deployment {
}, },
}, },
}, },
RevisionHistoryLimit: revisionHistoryLimit, RevisionHistoryLimit: v,
}, },
} }
return &d return &d
...@@ -118,7 +123,7 @@ func newReplicaSet(d *exp.Deployment, name string, replicas int) *exp.ReplicaSet ...@@ -118,7 +123,7 @@ func newReplicaSet(d *exp.Deployment, name string, replicas int) *exp.ReplicaSet
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
}, },
Spec: exp.ReplicaSetSpec{ Spec: exp.ReplicaSetSpec{
Replicas: replicas, Replicas: int32(replicas),
Template: d.Spec.Template, Template: d.Spec.Template,
}, },
} }
...@@ -211,7 +216,7 @@ func TestDeploymentController_reconcileNewReplicaSet(t *testing.T) { ...@@ -211,7 +216,7 @@ func TestDeploymentController_reconcileNewReplicaSet(t *testing.T) {
continue continue
} }
updated := fake.Actions()[0].(core.UpdateAction).GetObject().(*exp.ReplicaSet) updated := fake.Actions()[0].(core.UpdateAction).GetObject().(*exp.ReplicaSet)
if e, a := test.expectedNewReplicas, updated.Spec.Replicas; e != a { if e, a := test.expectedNewReplicas, int(updated.Spec.Replicas); e != a {
t.Errorf("expected update to %d replicas, got %d", e, a) t.Errorf("expected update to %d replicas, got %d", e, a)
} }
} }
...@@ -470,12 +475,12 @@ func TestDeploymentController_cleanupUnhealthyReplicas(t *testing.T) { ...@@ -470,12 +475,12 @@ func TestDeploymentController_cleanupUnhealthyReplicas(t *testing.T) {
client: &fakeClientset, client: &fakeClientset,
eventRecorder: &record.FakeRecorder{}, eventRecorder: &record.FakeRecorder{},
} }
_, cleanupCount, err := controller.cleanupUnhealthyReplicas(oldRSs, &deployment, test.maxCleanupCount) _, cleanupCount, err := controller.cleanupUnhealthyReplicas(oldRSs, &deployment, int32(test.maxCleanupCount))
if err != nil { if err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
continue continue
} }
if cleanupCount != test.cleanupCountExpected { if int(cleanupCount) != test.cleanupCountExpected {
t.Errorf("expected %v unhealthy replicas been cleaned up, got %v", test.cleanupCountExpected, cleanupCount) t.Errorf("expected %v unhealthy replicas been cleaned up, got %v", test.cleanupCountExpected, cleanupCount)
continue continue
} }
...@@ -598,7 +603,7 @@ func TestDeploymentController_scaleDownOldReplicaSetsForRollingUpdate(t *testing ...@@ -598,7 +603,7 @@ func TestDeploymentController_scaleDownOldReplicaSetsForRollingUpdate(t *testing
continue continue
} }
updated := updateAction.GetObject().(*exp.ReplicaSet) updated := updateAction.GetObject().(*exp.ReplicaSet)
if e, a := test.expectedOldReplicas, updated.Spec.Replicas; e != a { if e, a := test.expectedOldReplicas, int(updated.Spec.Replicas); e != a {
t.Errorf("expected update to %d replicas, got %d", e, a) t.Errorf("expected update to %d replicas, got %d", e, a)
} }
} }
......
...@@ -378,7 +378,7 @@ func (e *EndpointController) syncService(key string) { ...@@ -378,7 +378,7 @@ func (e *EndpointController) syncService(key string) {
continue continue
} }
epp := api.EndpointPort{Name: portName, Port: portNum, Protocol: portProto} epp := api.EndpointPort{Name: portName, Port: int32(portNum), Protocol: portProto}
epa := api.EndpointAddress{ epa := api.EndpointAddress{
IP: pod.Status.PodIP, IP: pod.Status.PodIP,
TargetRef: &api.ObjectReference{ TargetRef: &api.ObjectReference{
......
...@@ -65,7 +65,7 @@ func addPods(store cache.Store, namespace string, nPods int, nPorts int, nNotRea ...@@ -65,7 +65,7 @@ func addPods(store cache.Store, namespace string, nPods int, nPorts int, nNotRea
} }
for j := 0; j < nPorts; j++ { for j := 0; j < nPorts; j++ {
p.Spec.Containers[0].Ports = append(p.Spec.Containers[0].Ports, p.Spec.Containers[0].Ports = append(p.Spec.Containers[0].Ports,
api.ContainerPort{Name: fmt.Sprintf("port%d", i), ContainerPort: 8080 + j}) api.ContainerPort{Name: fmt.Sprintf("port%d", i), ContainerPort: int32(8080 + j)})
} }
store.Add(p) store.Add(p)
} }
......
...@@ -339,7 +339,7 @@ func (jm *JobController) syncJob(key string) error { ...@@ -339,7 +339,7 @@ func (jm *JobController) syncJob(key string) error {
} }
activePods := controller.FilterActivePods(podList.Items) activePods := controller.FilterActivePods(podList.Items)
active := len(activePods) active := int32(len(activePods))
succeeded, failed := getStatus(podList.Items) succeeded, failed := getStatus(podList.Items)
conditions := len(job.Status.Conditions) conditions := len(job.Status.Conditions)
if job.Status.StartTime == nil { if job.Status.StartTime == nil {
...@@ -358,9 +358,9 @@ func (jm *JobController) syncJob(key string) error { ...@@ -358,9 +358,9 @@ func (jm *JobController) syncJob(key string) error {
// some sort of solution to above problem. // some sort of solution to above problem.
// kill remaining active pods // kill remaining active pods
wait := sync.WaitGroup{} wait := sync.WaitGroup{}
wait.Add(active) wait.Add(int(active))
for i := 0; i < active; i++ { for i := int32(0); i < active; i++ {
go func(ix int) { go func(ix int32) {
defer wait.Done() defer wait.Done()
if err := jm.podControl.DeletePod(job.Namespace, activePods[ix].Name, &job); err != nil { if err := jm.podControl.DeletePod(job.Namespace, activePods[ix].Name, &job); err != nil {
defer utilruntime.HandleError(err) defer utilruntime.HandleError(err)
...@@ -449,17 +449,17 @@ func newCondition(conditionType batch.JobConditionType, reason, message string) ...@@ -449,17 +449,17 @@ func newCondition(conditionType batch.JobConditionType, reason, message string)
} }
// getStatus returns no of succeeded and failed pods running a job // getStatus returns no of succeeded and failed pods running a job
func getStatus(pods []api.Pod) (succeeded, failed int) { func getStatus(pods []api.Pod) (succeeded, failed int32) {
succeeded = filterPods(pods, api.PodSucceeded) succeeded = int32(filterPods(pods, api.PodSucceeded))
failed = filterPods(pods, api.PodFailed) failed = int32(filterPods(pods, api.PodFailed))
return return
} }
// manageJob is the core method responsible for managing the number of running // manageJob is the core method responsible for managing the number of running
// pods according to what is specified in the job.Spec. // pods according to what is specified in the job.Spec.
func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *batch.Job) int { func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int32, job *batch.Job) int32 {
var activeLock sync.Mutex var activeLock sync.Mutex
active := len(activePods) active := int32(len(activePods))
parallelism := *job.Spec.Parallelism parallelism := *job.Spec.Parallelism
jobKey, err := controller.KeyFunc(job) jobKey, err := controller.KeyFunc(job)
if err != nil { if err != nil {
...@@ -469,7 +469,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ba ...@@ -469,7 +469,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ba
if active > parallelism { if active > parallelism {
diff := active - parallelism diff := active - parallelism
jm.expectations.ExpectDeletions(jobKey, diff) jm.expectations.ExpectDeletions(jobKey, int(diff))
glog.V(4).Infof("Too many pods running job %q, need %d, deleting %d", jobKey, parallelism, diff) glog.V(4).Infof("Too many pods running job %q, need %d, deleting %d", jobKey, parallelism, diff)
// Sort the pods in the order such that not-ready < ready, unscheduled // Sort the pods in the order such that not-ready < ready, unscheduled
// < scheduled, and pending < running. This ensures that we delete pods // < scheduled, and pending < running. This ensures that we delete pods
...@@ -478,9 +478,9 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ba ...@@ -478,9 +478,9 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ba
active -= diff active -= diff
wait := sync.WaitGroup{} wait := sync.WaitGroup{}
wait.Add(diff) wait.Add(int(diff))
for i := 0; i < diff; i++ { for i := int32(0); i < diff; i++ {
go func(ix int) { go func(ix int32) {
defer wait.Done() defer wait.Done()
if err := jm.podControl.DeletePod(job.Namespace, activePods[ix].Name, job); err != nil { if err := jm.podControl.DeletePod(job.Namespace, activePods[ix].Name, job); err != nil {
defer utilruntime.HandleError(err) defer utilruntime.HandleError(err)
...@@ -495,7 +495,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ba ...@@ -495,7 +495,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ba
wait.Wait() wait.Wait()
} else if active < parallelism { } else if active < parallelism {
wantActive := 0 wantActive := int32(0)
if job.Spec.Completions == nil { if job.Spec.Completions == nil {
// Job does not specify a number of completions. Therefore, number active // Job does not specify a number of completions. Therefore, number active
// should be equal to parallelism, unless the job has seen at least // should be equal to parallelism, unless the job has seen at least
...@@ -518,13 +518,13 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ba ...@@ -518,13 +518,13 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ba
glog.Errorf("More active than wanted: job %q, want %d, have %d", jobKey, wantActive, active) glog.Errorf("More active than wanted: job %q, want %d, have %d", jobKey, wantActive, active)
diff = 0 diff = 0
} }
jm.expectations.ExpectCreations(jobKey, diff) jm.expectations.ExpectCreations(jobKey, int(diff))
glog.V(4).Infof("Too few pods running job %q, need %d, creating %d", jobKey, wantActive, diff) glog.V(4).Infof("Too few pods running job %q, need %d, creating %d", jobKey, wantActive, diff)
active += diff active += diff
wait := sync.WaitGroup{} wait := sync.WaitGroup{}
wait.Add(diff) wait.Add(int(diff))
for i := 0; i < diff; i++ { for i := int32(0); i < diff; i++ {
go func() { go func() {
defer wait.Done() defer wait.Done()
if err := jm.podControl.CreatePods(job.Namespace, &job.Spec.Template, job); err != nil { if err := jm.podControl.CreatePods(job.Namespace, &job.Spec.Template, job); err != nil {
......
...@@ -37,7 +37,7 @@ import ( ...@@ -37,7 +37,7 @@ import (
var alwaysReady = func() bool { return true } var alwaysReady = func() bool { return true }
func newJob(parallelism, completions int) *batch.Job { func newJob(parallelism, completions int32) *batch.Job {
j := &batch.Job{ j := &batch.Job{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "foobar", Name: "foobar",
...@@ -86,9 +86,9 @@ func getKey(job *batch.Job, t *testing.T) string { ...@@ -86,9 +86,9 @@ func getKey(job *batch.Job, t *testing.T) string {
} }
// create count pods with the given phase for the given job // create count pods with the given phase for the given job
func newPodList(count int, status api.PodPhase, job *batch.Job) []api.Pod { func newPodList(count int32, status api.PodPhase, job *batch.Job) []api.Pod {
pods := []api.Pod{} pods := []api.Pod{}
for i := 0; i < count; i++ { for i := int32(0); i < count; i++ {
newPod := api.Pod{ newPod := api.Pod{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: fmt.Sprintf("pod-%v", rand.String(10)), Name: fmt.Sprintf("pod-%v", rand.String(10)),
...@@ -105,21 +105,21 @@ func newPodList(count int, status api.PodPhase, job *batch.Job) []api.Pod { ...@@ -105,21 +105,21 @@ func newPodList(count int, status api.PodPhase, job *batch.Job) []api.Pod {
func TestControllerSyncJob(t *testing.T) { func TestControllerSyncJob(t *testing.T) {
testCases := map[string]struct { testCases := map[string]struct {
// job setup // job setup
parallelism int parallelism int32
completions int completions int32
// pod setup // pod setup
podControllerError error podControllerError error
activePods int activePods int32
succeededPods int succeededPods int32
failedPods int failedPods int32
// expectations // expectations
expectedCreations int expectedCreations int32
expectedDeletions int expectedDeletions int32
expectedActive int expectedActive int32
expectedSucceeded int expectedSucceeded int32
expectedFailed int expectedFailed int32
expectedComplete bool expectedComplete bool
}{ }{
"job start": { "job start": {
...@@ -237,10 +237,10 @@ func TestControllerSyncJob(t *testing.T) { ...@@ -237,10 +237,10 @@ func TestControllerSyncJob(t *testing.T) {
} }
// validate created/deleted pods // validate created/deleted pods
if len(fakePodControl.Templates) != tc.expectedCreations { if int32(len(fakePodControl.Templates)) != tc.expectedCreations {
t.Errorf("%s: unexpected number of creates. Expected %d, saw %d\n", name, tc.expectedCreations, len(fakePodControl.Templates)) t.Errorf("%s: unexpected number of creates. Expected %d, saw %d\n", name, tc.expectedCreations, len(fakePodControl.Templates))
} }
if len(fakePodControl.DeletePodName) != tc.expectedDeletions { if int32(len(fakePodControl.DeletePodName)) != tc.expectedDeletions {
t.Errorf("%s: unexpected number of deletes. Expected %d, saw %d\n", name, tc.expectedDeletions, len(fakePodControl.DeletePodName)) t.Errorf("%s: unexpected number of deletes. Expected %d, saw %d\n", name, tc.expectedDeletions, len(fakePodControl.DeletePodName))
} }
// validate status // validate status
...@@ -266,21 +266,21 @@ func TestControllerSyncJob(t *testing.T) { ...@@ -266,21 +266,21 @@ func TestControllerSyncJob(t *testing.T) {
func TestSyncJobPastDeadline(t *testing.T) { func TestSyncJobPastDeadline(t *testing.T) {
testCases := map[string]struct { testCases := map[string]struct {
// job setup // job setup
parallelism int parallelism int32
completions int completions int32
activeDeadlineSeconds int64 activeDeadlineSeconds int64
startTime int64 startTime int64
// pod setup // pod setup
activePods int activePods int32
succeededPods int succeededPods int32
failedPods int failedPods int32
// expectations // expectations
expectedDeletions int expectedDeletions int32
expectedActive int expectedActive int32
expectedSucceeded int expectedSucceeded int32
expectedFailed int expectedFailed int32
}{ }{
"activeDeadlineSeconds less than single pod execution": { "activeDeadlineSeconds less than single pod execution": {
1, 1, 10, 15, 1, 1, 10, 15,
...@@ -335,10 +335,10 @@ func TestSyncJobPastDeadline(t *testing.T) { ...@@ -335,10 +335,10 @@ func TestSyncJobPastDeadline(t *testing.T) {
} }
// validate created/deleted pods // validate created/deleted pods
if len(fakePodControl.Templates) != 0 { if int32(len(fakePodControl.Templates)) != 0 {
t.Errorf("%s: unexpected number of creates. Expected 0, saw %d\n", name, len(fakePodControl.Templates)) t.Errorf("%s: unexpected number of creates. Expected 0, saw %d\n", name, len(fakePodControl.Templates))
} }
if len(fakePodControl.DeletePodName) != tc.expectedDeletions { if int32(len(fakePodControl.DeletePodName)) != tc.expectedDeletions {
t.Errorf("%s: unexpected number of deletes. Expected %d, saw %d\n", name, tc.expectedDeletions, len(fakePodControl.DeletePodName)) t.Errorf("%s: unexpected number of deletes. Expected %d, saw %d\n", name, tc.expectedDeletions, len(fakePodControl.DeletePodName))
} }
// validate status // validate status
......
...@@ -128,8 +128,8 @@ func (a *HorizontalController) Run(stopCh <-chan struct{}) { ...@@ -128,8 +128,8 @@ func (a *HorizontalController) Run(stopCh <-chan struct{}) {
glog.Infof("Shutting down HPA Controller") glog.Infof("Shutting down HPA Controller")
} }
func (a *HorizontalController) computeReplicasForCPUUtilization(hpa *extensions.HorizontalPodAutoscaler, scale *extensions.Scale) (int, *int, time.Time, error) { func (a *HorizontalController) computeReplicasForCPUUtilization(hpa *extensions.HorizontalPodAutoscaler, scale *extensions.Scale) (int32, *int32, time.Time, error) {
targetUtilization := defaultTargetCPUUtilizationPercentage targetUtilization := int32(defaultTargetCPUUtilizationPercentage)
if hpa.Spec.CPUUtilization != nil { if hpa.Spec.CPUUtilization != nil {
targetUtilization = hpa.Spec.CPUUtilization.TargetPercentage targetUtilization = hpa.Spec.CPUUtilization.TargetPercentage
} }
...@@ -155,11 +155,13 @@ func (a *HorizontalController) computeReplicasForCPUUtilization(hpa *extensions. ...@@ -155,11 +155,13 @@ func (a *HorizontalController) computeReplicasForCPUUtilization(hpa *extensions.
return 0, nil, time.Time{}, fmt.Errorf("failed to get CPU utilization: %v", err) return 0, nil, time.Time{}, fmt.Errorf("failed to get CPU utilization: %v", err)
} }
usageRatio := float64(*currentUtilization) / float64(targetUtilization) utilization := int32(*currentUtilization)
usageRatio := float64(utilization) / float64(targetUtilization)
if math.Abs(1.0-usageRatio) > tolerance { if math.Abs(1.0-usageRatio) > tolerance {
return int(math.Ceil(usageRatio * float64(currentReplicas))), currentUtilization, timestamp, nil return int32(math.Ceil(usageRatio * float64(currentReplicas))), &utilization, timestamp, nil
} else { } else {
return currentReplicas, currentUtilization, timestamp, nil return currentReplicas, &utilization, timestamp, nil
} }
} }
...@@ -169,7 +171,7 @@ func (a *HorizontalController) computeReplicasForCPUUtilization(hpa *extensions. ...@@ -169,7 +171,7 @@ func (a *HorizontalController) computeReplicasForCPUUtilization(hpa *extensions.
// status string (also json-serialized extensions.CustomMetricsCurrentStatusList), // status string (also json-serialized extensions.CustomMetricsCurrentStatusList),
// last timestamp of the metrics involved in computations or error, if occurred. // last timestamp of the metrics involved in computations or error, if occurred.
func (a *HorizontalController) computeReplicasForCustomMetrics(hpa *extensions.HorizontalPodAutoscaler, scale *extensions.Scale, func (a *HorizontalController) computeReplicasForCustomMetrics(hpa *extensions.HorizontalPodAutoscaler, scale *extensions.Scale,
cmAnnotation string) (replicas int, metric string, status string, timestamp time.Time, err error) { cmAnnotation string) (replicas int32, metric string, status string, timestamp time.Time, err error) {
currentReplicas := scale.Status.Replicas currentReplicas := scale.Status.Replicas
replicas = 0 replicas = 0
...@@ -216,9 +218,9 @@ func (a *HorizontalController) computeReplicasForCustomMetrics(hpa *extensions.H ...@@ -216,9 +218,9 @@ func (a *HorizontalController) computeReplicasForCustomMetrics(hpa *extensions.H
floatTarget := float64(customMetricTarget.TargetValue.MilliValue()) / 1000.0 floatTarget := float64(customMetricTarget.TargetValue.MilliValue()) / 1000.0
usageRatio := *value / floatTarget usageRatio := *value / floatTarget
replicaCountProposal := 0 replicaCountProposal := int32(0)
if math.Abs(1.0-usageRatio) > tolerance { if math.Abs(1.0-usageRatio) > tolerance {
replicaCountProposal = int(math.Ceil(usageRatio * float64(currentReplicas))) replicaCountProposal = int32(math.Ceil(usageRatio * float64(currentReplicas)))
} else { } else {
replicaCountProposal = currentReplicas replicaCountProposal = currentReplicas
} }
...@@ -254,16 +256,16 @@ func (a *HorizontalController) reconcileAutoscaler(hpa *extensions.HorizontalPod ...@@ -254,16 +256,16 @@ func (a *HorizontalController) reconcileAutoscaler(hpa *extensions.HorizontalPod
} }
currentReplicas := scale.Status.Replicas currentReplicas := scale.Status.Replicas
cpuDesiredReplicas := 0 cpuDesiredReplicas := int32(0)
var cpuCurrentUtilization *int = nil var cpuCurrentUtilization *int32 = nil
cpuTimestamp := time.Time{} cpuTimestamp := time.Time{}
cmDesiredReplicas := 0 cmDesiredReplicas := int32(0)
cmMetric := "" cmMetric := ""
cmStatus := "" cmStatus := ""
cmTimestamp := time.Time{} cmTimestamp := time.Time{}
desiredReplicas := 0 desiredReplicas := int32(0)
rescaleReason := "" rescaleReason := ""
timestamp := time.Now() timestamp := time.Now()
...@@ -347,7 +349,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa *extensions.HorizontalPod ...@@ -347,7 +349,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa *extensions.HorizontalPod
return a.updateStatus(hpa, currentReplicas, desiredReplicas, cpuCurrentUtilization, cmStatus, rescale) return a.updateStatus(hpa, currentReplicas, desiredReplicas, cpuCurrentUtilization, cmStatus, rescale)
} }
func shouldScale(hpa *extensions.HorizontalPodAutoscaler, currentReplicas, desiredReplicas int, timestamp time.Time) bool { func shouldScale(hpa *extensions.HorizontalPodAutoscaler, currentReplicas, desiredReplicas int32, timestamp time.Time) bool {
if desiredReplicas != currentReplicas { if desiredReplicas != currentReplicas {
// Going down only if the usageRatio dropped significantly below the target // Going down only if the usageRatio dropped significantly below the target
// and there was no rescaling in the last downscaleForbiddenWindow. // and there was no rescaling in the last downscaleForbiddenWindow.
...@@ -368,14 +370,14 @@ func shouldScale(hpa *extensions.HorizontalPodAutoscaler, currentReplicas, desir ...@@ -368,14 +370,14 @@ func shouldScale(hpa *extensions.HorizontalPodAutoscaler, currentReplicas, desir
return false return false
} }
func (a *HorizontalController) updateCurrentReplicasInStatus(hpa *extensions.HorizontalPodAutoscaler, currentReplicas int) { func (a *HorizontalController) updateCurrentReplicasInStatus(hpa *extensions.HorizontalPodAutoscaler, currentReplicas int32) {
err := a.updateStatus(hpa, currentReplicas, hpa.Status.DesiredReplicas, hpa.Status.CurrentCPUUtilizationPercentage, hpa.Annotations[HpaCustomMetricsStatusAnnotationName], false) err := a.updateStatus(hpa, currentReplicas, hpa.Status.DesiredReplicas, hpa.Status.CurrentCPUUtilizationPercentage, hpa.Annotations[HpaCustomMetricsStatusAnnotationName], false)
if err != nil { if err != nil {
glog.Errorf("%v", err) glog.Errorf("%v", err)
} }
} }
func (a *HorizontalController) updateStatus(hpa *extensions.HorizontalPodAutoscaler, currentReplicas, desiredReplicas int, cpuCurrentUtilization *int, cmStatus string, rescale bool) error { func (a *HorizontalController) updateStatus(hpa *extensions.HorizontalPodAutoscaler, currentReplicas, desiredReplicas int32, cpuCurrentUtilization *int32, cmStatus string, rescale bool) error {
hpa.Status = extensions.HorizontalPodAutoscalerStatus{ hpa.Status = extensions.HorizontalPodAutoscalerStatus{
CurrentReplicas: currentReplicas, CurrentReplicas: currentReplicas,
DesiredReplicas: desiredReplicas, DesiredReplicas: desiredReplicas,
......
...@@ -67,14 +67,14 @@ type fakeResource struct { ...@@ -67,14 +67,14 @@ type fakeResource struct {
type testCase struct { type testCase struct {
sync.Mutex sync.Mutex
minReplicas int minReplicas int32
maxReplicas int maxReplicas int32
initialReplicas int initialReplicas int32
desiredReplicas int desiredReplicas int32
// CPU target utilization as a percentage of the requested resources. // CPU target utilization as a percentage of the requested resources.
CPUTarget int CPUTarget int32
CPUCurrent int CPUCurrent int32
verifyCPUCurrent bool verifyCPUCurrent bool
reportedLevels []uint64 reportedLevels []uint64
reportedCPURequests []resource.Quantity reportedCPURequests []resource.Quantity
...@@ -103,7 +103,7 @@ func (tc *testCase) computeCPUCurrent() { ...@@ -103,7 +103,7 @@ func (tc *testCase) computeCPUCurrent() {
for _, req := range tc.reportedCPURequests { for _, req := range tc.reportedCPURequests {
requested += int(req.MilliValue()) requested += int(req.MilliValue())
} }
tc.CPUCurrent = 100 * reported / requested tc.CPUCurrent = int32(100 * reported / requested)
} }
func (tc *testCase) prepareTestClient(t *testing.T) *fake.Clientset { func (tc *testCase) prepareTestClient(t *testing.T) *fake.Clientset {
......
...@@ -421,7 +421,7 @@ func (rsc *ReplicaSetController) worker() { ...@@ -421,7 +421,7 @@ func (rsc *ReplicaSetController) worker() {
// manageReplicas checks and updates replicas for the given ReplicaSet. // manageReplicas checks and updates replicas for the given ReplicaSet.
func (rsc *ReplicaSetController) manageReplicas(filteredPods []*api.Pod, rs *extensions.ReplicaSet) { func (rsc *ReplicaSetController) manageReplicas(filteredPods []*api.Pod, rs *extensions.ReplicaSet) {
diff := len(filteredPods) - rs.Spec.Replicas diff := len(filteredPods) - int(rs.Spec.Replicas)
rsKey, err := controller.KeyFunc(rs) rsKey, err := controller.KeyFunc(rs)
if err != nil { if err != nil {
glog.Errorf("Couldn't get key for ReplicaSet %#v: %v", rs, err) glog.Errorf("Couldn't get key for ReplicaSet %#v: %v", rs, err)
......
...@@ -66,7 +66,7 @@ func newReplicaSet(replicas int, selectorMap map[string]string) *extensions.Repl ...@@ -66,7 +66,7 @@ func newReplicaSet(replicas int, selectorMap map[string]string) *extensions.Repl
ResourceVersion: "18", ResourceVersion: "18",
}, },
Spec: extensions.ReplicaSetSpec{ Spec: extensions.ReplicaSetSpec{
Replicas: replicas, Replicas: int32(replicas),
Selector: &unversioned.LabelSelector{MatchLabels: selectorMap}, Selector: &unversioned.LabelSelector{MatchLabels: selectorMap},
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
...@@ -237,7 +237,7 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) { ...@@ -237,7 +237,7 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) {
labelMap := map[string]string{"foo": "bar"} labelMap := map[string]string{"foo": "bar"}
rs := newReplicaSet(activePods, labelMap) rs := newReplicaSet(activePods, labelMap)
manager.rsStore.Store.Add(rs) manager.rsStore.Store.Add(rs)
rs.Status = extensions.ReplicaSetStatus{Replicas: activePods} rs.Status = extensions.ReplicaSetStatus{Replicas: int32(activePods)}
newPodList(manager.podStore.Store, activePods, api.PodRunning, labelMap, rs, "pod") newPodList(manager.podStore.Store, activePods, api.PodRunning, labelMap, rs, "pod")
fakePodControl := controller.FakePodControl{} fakePodControl := controller.FakePodControl{}
...@@ -643,7 +643,7 @@ func TestControllerUpdateStatusWithFailure(t *testing.T) { ...@@ -643,7 +643,7 @@ func TestControllerUpdateStatusWithFailure(t *testing.T) {
// returned a ReplicaSet with replicas=1. // returned a ReplicaSet with replicas=1.
if c, ok := action.GetObject().(*extensions.ReplicaSet); !ok { if c, ok := action.GetObject().(*extensions.ReplicaSet); !ok {
t.Errorf("Expected a ReplicaSet as the argument to update, got %T", c) t.Errorf("Expected a ReplicaSet as the argument to update, got %T", c)
} else if c.Status.Replicas != numReplicas { } else if int(c.Status.Replicas) != numReplicas {
t.Errorf("Expected update for ReplicaSet to contain replicas %v, got %v instead", t.Errorf("Expected update for ReplicaSet to contain replicas %v, got %v instead",
numReplicas, c.Status.Replicas) numReplicas, c.Status.Replicas)
} }
...@@ -669,7 +669,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -669,7 +669,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
rsSpec := newReplicaSet(numReplicas, labelMap) rsSpec := newReplicaSet(numReplicas, labelMap)
manager.rsStore.Store.Add(rsSpec) manager.rsStore.Store.Add(rsSpec)
expectedPods := 0 expectedPods := int32(0)
pods := newPodList(nil, numReplicas, api.PodPending, labelMap, rsSpec, "pod") pods := newPodList(nil, numReplicas, api.PodPending, labelMap, rsSpec, "pod")
rsKey, err := controller.KeyFunc(rsSpec) rsKey, err := controller.KeyFunc(rsSpec)
...@@ -678,7 +678,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -678,7 +678,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
} }
// Size up the controller, then size it down, and confirm the expected create/delete pattern // Size up the controller, then size it down, and confirm the expected create/delete pattern
for _, replicas := range []int{numReplicas, 0} { for _, replicas := range []int32{int32(numReplicas), 0} {
rsSpec.Spec.Replicas = replicas rsSpec.Spec.Replicas = replicas
manager.rsStore.Store.Add(rsSpec) manager.rsStore.Store.Add(rsSpec)
...@@ -688,21 +688,21 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -688,21 +688,21 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
// The store accrues active pods. It's also used by the ReplicaSet to determine how many // The store accrues active pods. It's also used by the ReplicaSet to determine how many
// replicas to create. // replicas to create.
activePods := len(manager.podStore.Store.List()) activePods := int32(len(manager.podStore.Store.List()))
if replicas != 0 { if replicas != 0 {
// This is the number of pods currently "in flight". They were created by the // This is the number of pods currently "in flight". They were created by the
// ReplicaSet controller above, which then puts the ReplicaSet to sleep till // ReplicaSet controller above, which then puts the ReplicaSet to sleep till
// all of them have been observed. // all of them have been observed.
expectedPods = replicas - activePods expectedPods = replicas - activePods
if expectedPods > burstReplicas { if expectedPods > int32(burstReplicas) {
expectedPods = burstReplicas expectedPods = int32(burstReplicas)
} }
// This validates the ReplicaSet manager sync actually created pods // This validates the ReplicaSet manager sync actually created pods
validateSyncReplicaSet(t, &fakePodControl, expectedPods, 0) validateSyncReplicaSet(t, &fakePodControl, int(expectedPods), 0)
// This simulates the watch events for all but 1 of the expected pods. // This simulates the watch events for all but 1 of the expected pods.
// None of these should wake the controller because it has expectations==BurstReplicas. // None of these should wake the controller because it has expectations==BurstReplicas.
for i := 0; i < expectedPods-1; i++ { for i := int32(0); i < expectedPods-1; i++ {
manager.podStore.Store.Add(&pods.Items[i]) manager.podStore.Store.Add(&pods.Items[i])
manager.addPod(&pods.Items[i]) manager.addPod(&pods.Items[i])
} }
...@@ -716,10 +716,10 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -716,10 +716,10 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
} }
} else { } else {
expectedPods = (replicas - activePods) * -1 expectedPods = (replicas - activePods) * -1
if expectedPods > burstReplicas { if expectedPods > int32(burstReplicas) {
expectedPods = burstReplicas expectedPods = int32(burstReplicas)
} }
validateSyncReplicaSet(t, &fakePodControl, 0, expectedPods) validateSyncReplicaSet(t, &fakePodControl, 0, int(expectedPods))
// To accurately simulate a watch we must delete the exact pods // To accurately simulate a watch we must delete the exact pods
// the rs is waiting for. // the rs is waiting for.
...@@ -782,12 +782,12 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -782,12 +782,12 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
} }
// Confirm that we've created the right number of replicas // Confirm that we've created the right number of replicas
activePods := len(manager.podStore.Store.List()) activePods := int32(len(manager.podStore.Store.List()))
if activePods != rsSpec.Spec.Replicas { if activePods != rsSpec.Spec.Replicas {
t.Fatalf("Unexpected number of active pods, expected %d, got %d", rsSpec.Spec.Replicas, activePods) t.Fatalf("Unexpected number of active pods, expected %d, got %d", rsSpec.Spec.Replicas, activePods)
} }
// Replenish the pod list, since we cut it down sizing up // Replenish the pod list, since we cut it down sizing up
pods = newPodList(nil, replicas, api.PodRunning, labelMap, rsSpec, "pod") pods = newPodList(nil, int(replicas), api.PodRunning, labelMap, rsSpec, "pod")
} }
} }
......
...@@ -31,8 +31,8 @@ func updateReplicaCount(rsClient client.ReplicaSetInterface, rs extensions.Repli ...@@ -31,8 +31,8 @@ func updateReplicaCount(rsClient client.ReplicaSetInterface, rs extensions.Repli
// This is the steady state. It happens when the ReplicaSet doesn't have any expectations, since // This is the steady state. It happens when the ReplicaSet doesn't have any expectations, since
// we do a periodic relist every 30s. If the generations differ but the replicas are // we do a periodic relist every 30s. If the generations differ but the replicas are
// the same, a caller might've resized to the same replica count. // the same, a caller might've resized to the same replica count.
if rs.Status.Replicas == numReplicas && if int(rs.Status.Replicas) == numReplicas &&
rs.Status.FullyLabeledReplicas == numFullyLabeledReplicas && int(rs.Status.FullyLabeledReplicas) == numFullyLabeledReplicas &&
rs.Generation == rs.Status.ObservedGeneration { rs.Generation == rs.Status.ObservedGeneration {
return nil return nil
} }
...@@ -49,7 +49,7 @@ func updateReplicaCount(rsClient client.ReplicaSetInterface, rs extensions.Repli ...@@ -49,7 +49,7 @@ func updateReplicaCount(rsClient client.ReplicaSetInterface, rs extensions.Repli
fmt.Sprintf("fullyLabeledReplicas %d->%d, ", rs.Status.FullyLabeledReplicas, numFullyLabeledReplicas) + fmt.Sprintf("fullyLabeledReplicas %d->%d, ", rs.Status.FullyLabeledReplicas, numFullyLabeledReplicas) +
fmt.Sprintf("sequence No: %v->%v", rs.Status.ObservedGeneration, generation)) fmt.Sprintf("sequence No: %v->%v", rs.Status.ObservedGeneration, generation))
rs.Status = extensions.ReplicaSetStatus{Replicas: numReplicas, FullyLabeledReplicas: numFullyLabeledReplicas, ObservedGeneration: generation} rs.Status = extensions.ReplicaSetStatus{Replicas: int32(numReplicas), FullyLabeledReplicas: int32(numFullyLabeledReplicas), ObservedGeneration: generation}
_, updateErr = rsClient.UpdateStatus(rs) _, updateErr = rsClient.UpdateStatus(rs)
if updateErr == nil || i >= statusUpdateRetries { if updateErr == nil || i >= statusUpdateRetries {
return updateErr return updateErr
......
...@@ -429,7 +429,7 @@ func (rm *ReplicationManager) worker() { ...@@ -429,7 +429,7 @@ func (rm *ReplicationManager) worker() {
// manageReplicas checks and updates replicas for the given replication controller. // manageReplicas checks and updates replicas for the given replication controller.
func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, rc *api.ReplicationController) { func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, rc *api.ReplicationController) {
diff := len(filteredPods) - rc.Spec.Replicas diff := len(filteredPods) - int(rc.Spec.Replicas)
rcKey, err := controller.KeyFunc(rc) rcKey, err := controller.KeyFunc(rc)
if err != nil { if err != nil {
glog.Errorf("Couldn't get key for replication controller %#v: %v", rc, err) glog.Errorf("Couldn't get key for replication controller %#v: %v", rc, err)
......
...@@ -65,7 +65,7 @@ func newReplicationController(replicas int) *api.ReplicationController { ...@@ -65,7 +65,7 @@ func newReplicationController(replicas int) *api.ReplicationController {
ResourceVersion: "18", ResourceVersion: "18",
}, },
Spec: api.ReplicationControllerSpec{ Spec: api.ReplicationControllerSpec{
Replicas: replicas, Replicas: int32(replicas),
Selector: map[string]string{"foo": "bar"}, Selector: map[string]string{"foo": "bar"},
Template: &api.PodTemplateSpec{ Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
...@@ -231,7 +231,7 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) { ...@@ -231,7 +231,7 @@ func TestStatusUpdatesWithoutReplicasChange(t *testing.T) {
activePods := 5 activePods := 5
rc := newReplicationController(activePods) rc := newReplicationController(activePods)
manager.rcStore.Store.Add(rc) manager.rcStore.Store.Add(rc)
rc.Status = api.ReplicationControllerStatus{Replicas: activePods} rc.Status = api.ReplicationControllerStatus{Replicas: int32(activePods)}
newPodList(manager.podStore.Store, activePods, api.PodRunning, rc, "pod") newPodList(manager.podStore.Store, activePods, api.PodRunning, rc, "pod")
fakePodControl := controller.FakePodControl{} fakePodControl := controller.FakePodControl{}
...@@ -628,7 +628,7 @@ func TestControllerUpdateStatusWithFailure(t *testing.T) { ...@@ -628,7 +628,7 @@ func TestControllerUpdateStatusWithFailure(t *testing.T) {
// returned an rc with replicas=1. // returned an rc with replicas=1.
if c, ok := action.GetObject().(*api.ReplicationController); !ok { if c, ok := action.GetObject().(*api.ReplicationController); !ok {
t.Errorf("Expected an rc as the argument to update, got %T", c) t.Errorf("Expected an rc as the argument to update, got %T", c)
} else if c.Status.Replicas != numReplicas { } else if c.Status.Replicas != int32(numReplicas) {
t.Errorf("Expected update for rc to contain replicas %v, got %v instead", t.Errorf("Expected update for rc to contain replicas %v, got %v instead",
numReplicas, c.Status.Replicas) numReplicas, c.Status.Replicas)
} }
...@@ -664,7 +664,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -664,7 +664,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
// Size up the controller, then size it down, and confirm the expected create/delete pattern // Size up the controller, then size it down, and confirm the expected create/delete pattern
for _, replicas := range []int{numReplicas, 0} { for _, replicas := range []int{numReplicas, 0} {
controllerSpec.Spec.Replicas = replicas controllerSpec.Spec.Replicas = int32(replicas)
manager.rcStore.Store.Add(controllerSpec) manager.rcStore.Store.Add(controllerSpec)
for i := 0; i < numReplicas; i += burstReplicas { for i := 0; i < numReplicas; i += burstReplicas {
...@@ -765,7 +765,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int) ...@@ -765,7 +765,7 @@ func doTestControllerBurstReplicas(t *testing.T, burstReplicas, numReplicas int)
} }
// Confirm that we've created the right number of replicas // Confirm that we've created the right number of replicas
activePods := len(manager.podStore.Store.List()) activePods := int32(len(manager.podStore.Store.List()))
if activePods != controllerSpec.Spec.Replicas { if activePods != controllerSpec.Spec.Replicas {
t.Fatalf("Unexpected number of active pods, expected %d, got %d", controllerSpec.Spec.Replicas, activePods) t.Fatalf("Unexpected number of active pods, expected %d, got %d", controllerSpec.Spec.Replicas, activePods)
} }
......
...@@ -31,8 +31,8 @@ func updateReplicaCount(rcClient unversionedcore.ReplicationControllerInterface, ...@@ -31,8 +31,8 @@ func updateReplicaCount(rcClient unversionedcore.ReplicationControllerInterface,
// This is the steady state. It happens when the rc doesn't have any expectations, since // This is the steady state. It happens when the rc doesn't have any expectations, since
// we do a periodic relist every 30s. If the generations differ but the replicas are // we do a periodic relist every 30s. If the generations differ but the replicas are
// the same, a caller might've resized to the same replica count. // the same, a caller might've resized to the same replica count.
if controller.Status.Replicas == numReplicas && if int(controller.Status.Replicas) == numReplicas &&
controller.Status.FullyLabeledReplicas == numFullyLabeledReplicas && int(controller.Status.FullyLabeledReplicas) == numFullyLabeledReplicas &&
controller.Generation == controller.Status.ObservedGeneration { controller.Generation == controller.Status.ObservedGeneration {
return nil return nil
} }
...@@ -49,7 +49,7 @@ func updateReplicaCount(rcClient unversionedcore.ReplicationControllerInterface, ...@@ -49,7 +49,7 @@ func updateReplicaCount(rcClient unversionedcore.ReplicationControllerInterface,
fmt.Sprintf("fullyLabeledReplicas %d->%d, ", controller.Status.FullyLabeledReplicas, numFullyLabeledReplicas) + fmt.Sprintf("fullyLabeledReplicas %d->%d, ", controller.Status.FullyLabeledReplicas, numFullyLabeledReplicas) +
fmt.Sprintf("sequence No: %v->%v", controller.Status.ObservedGeneration, generation)) fmt.Sprintf("sequence No: %v->%v", controller.Status.ObservedGeneration, generation))
rc.Status = api.ReplicationControllerStatus{Replicas: numReplicas, FullyLabeledReplicas: numFullyLabeledReplicas, ObservedGeneration: generation} rc.Status = api.ReplicationControllerStatus{Replicas: int32(numReplicas), FullyLabeledReplicas: int32(numFullyLabeledReplicas), ObservedGeneration: generation}
_, updateErr = rcClient.UpdateStatus(rc) _, updateErr = rcClient.UpdateStatus(rc)
if updateErr == nil || i >= statusUpdateRetries { if updateErr == nil || i >= statusUpdateRetries {
return updateErr return updateErr
......
...@@ -97,14 +97,15 @@ func (HorizontalPodAutoscalerV1Beta1) Generate(genericParams map[string]interfac ...@@ -97,14 +97,15 @@ func (HorizontalPodAutoscalerV1Beta1) Generate(genericParams map[string]interfac
APIVersion: params["scaleRef-apiVersion"], APIVersion: params["scaleRef-apiVersion"],
Subresource: scaleSubResource, Subresource: scaleSubResource,
}, },
MaxReplicas: max, MaxReplicas: int32(max),
}, },
} }
if min > 0 { if min > 0 {
scaler.Spec.MinReplicas = &min v := int32(min)
scaler.Spec.MinReplicas = &v
} }
if cpu >= 0 { if cpu >= 0 {
scaler.Spec.CPUUtilization = &extensions.CPUTargetUtilization{TargetPercentage: cpu} scaler.Spec.CPUUtilization = &extensions.CPUTargetUtilization{TargetPercentage: int32(cpu)}
} }
return &scaler, nil return &scaler, nil
} }
...@@ -83,7 +83,7 @@ func RunClusterInfo(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error ...@@ -83,7 +83,7 @@ func RunClusterInfo(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error
ip = ingress.Hostname ip = ingress.Hostname
} }
for _, port := range service.Spec.Ports { for _, port := range service.Spec.Ports {
link += "http://" + ip + ":" + strconv.Itoa(port.Port) + " " link += "http://" + ip + ":" + strconv.Itoa(int(port.Port)) + " "
} }
} else { } else {
if len(client.GroupVersion.Group) == 0 { if len(client.GroupVersion.Group) == 0 {
......
...@@ -173,7 +173,7 @@ See http://releases.k8s.io/HEAD/docs/user-guide/services-firewalls.md for more d ...@@ -173,7 +173,7 @@ See http://releases.k8s.io/HEAD/docs/user-guide/services-firewalls.md for more d
func makePortsString(ports []api.ServicePort, useNodePort bool) string { func makePortsString(ports []api.ServicePort, useNodePort bool) string {
pieces := make([]string, len(ports)) pieces := make([]string, len(ports))
for ix := range ports { for ix := range ports {
var port int var port int32
if useNodePort { if useNodePort {
port = ports[ix].NodePort port = ports[ix].NodePort
} else { } else {
......
...@@ -743,7 +743,7 @@ func getPorts(spec api.PodSpec) []string { ...@@ -743,7 +743,7 @@ func getPorts(spec api.PodSpec) []string {
result := []string{} result := []string{}
for _, container := range spec.Containers { for _, container := range spec.Containers {
for _, port := range container.Ports { for _, port := range container.Ports {
result = append(result, strconv.Itoa(port.ContainerPort)) result = append(result, strconv.Itoa(int(port.ContainerPort)))
} }
} }
return result return result
...@@ -753,7 +753,7 @@ func getPorts(spec api.PodSpec) []string { ...@@ -753,7 +753,7 @@ func getPorts(spec api.PodSpec) []string {
func getServicePorts(spec api.ServiceSpec) []string { func getServicePorts(spec api.ServiceSpec) []string {
result := []string{} result := []string{}
for _, servicePort := range spec.Ports { for _, servicePort := range spec.Ports {
result = append(result, strconv.Itoa(servicePort.Port)) result = append(result, strconv.Itoa(int(servicePort.Port)))
} }
return result return result
} }
......
...@@ -1233,7 +1233,7 @@ func (i *IngressDescriber) describeBackend(ns string, backend *extensions.Ingres ...@@ -1233,7 +1233,7 @@ func (i *IngressDescriber) describeBackend(ns string, backend *extensions.Ingres
spName = sp.Name spName = sp.Name
} }
case intstr.Int: case intstr.Int:
if int(backend.ServicePort.IntVal) == sp.Port { if int32(backend.ServicePort.IntVal) == sp.Port {
spName = sp.Name spName = sp.Name
} }
} }
......
...@@ -596,7 +596,7 @@ func printPodBase(pod *api.Pod, w io.Writer, options PrintOptions) error { ...@@ -596,7 +596,7 @@ func printPodBase(pod *api.Pod, w io.Writer, options PrintOptions) error {
for i := len(pod.Status.ContainerStatuses) - 1; i >= 0; i-- { for i := len(pod.Status.ContainerStatuses) - 1; i >= 0; i-- {
container := pod.Status.ContainerStatuses[i] container := pod.Status.ContainerStatuses[i]
restarts += container.RestartCount restarts += int(container.RestartCount)
if container.State.Waiting != nil && container.State.Waiting.Reason != "" { if container.State.Waiting != nil && container.State.Waiting.Reason != "" {
reason = container.State.Waiting.Reason reason = container.State.Waiting.Reason
} else if container.State.Terminated != nil && container.State.Terminated.Reason != "" { } else if container.State.Terminated != nil && container.State.Terminated.Reason != "" {
......
...@@ -1342,7 +1342,7 @@ func TestPrintDaemonSet(t *testing.T) { ...@@ -1342,7 +1342,7 @@ func TestPrintDaemonSet(t *testing.T) {
} }
func TestPrintJob(t *testing.T) { func TestPrintJob(t *testing.T) {
completions := 2 completions := int32(2)
tests := []struct { tests := []struct {
job batch.Job job batch.Job
expect string expect string
......
...@@ -114,7 +114,7 @@ type RollingUpdater struct { ...@@ -114,7 +114,7 @@ type RollingUpdater struct {
// cleanup performs post deployment cleanup tasks for newRc and oldRc. // cleanup performs post deployment cleanup tasks for newRc and oldRc.
cleanup func(oldRc, newRc *api.ReplicationController, config *RollingUpdaterConfig) error cleanup func(oldRc, newRc *api.ReplicationController, config *RollingUpdaterConfig) error
// getReadyPods returns the amount of old and new ready pods. // getReadyPods returns the amount of old and new ready pods.
getReadyPods func(oldRc, newRc *api.ReplicationController) (int, int, error) getReadyPods func(oldRc, newRc *api.ReplicationController) (int32, int32, error)
} }
// NewRollingUpdater creates a RollingUpdater from a client. // NewRollingUpdater creates a RollingUpdater from a client.
...@@ -169,11 +169,12 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error { ...@@ -169,11 +169,12 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error {
fmt.Fprintf(out, "Created %s\n", newRc.Name) fmt.Fprintf(out, "Created %s\n", newRc.Name)
} }
// Extract the desired replica count from the controller. // Extract the desired replica count from the controller.
desired, err := strconv.Atoi(newRc.Annotations[desiredReplicasAnnotation]) desiredAnnotation, err := strconv.Atoi(newRc.Annotations[desiredReplicasAnnotation])
if err != nil { if err != nil {
return fmt.Errorf("Unable to parse annotation for %s: %s=%s", return fmt.Errorf("Unable to parse annotation for %s: %s=%s",
newRc.Name, desiredReplicasAnnotation, newRc.Annotations[desiredReplicasAnnotation]) newRc.Name, desiredReplicasAnnotation, newRc.Annotations[desiredReplicasAnnotation])
} }
desired := int32(desiredAnnotation)
// Extract the original replica count from the old controller, adding the // Extract the original replica count from the old controller, adding the
// annotation if it doesn't yet exist. // annotation if it doesn't yet exist.
_, hasOriginalAnnotation := oldRc.Annotations[originalReplicasAnnotation] _, hasOriginalAnnotation := oldRc.Annotations[originalReplicasAnnotation]
...@@ -185,7 +186,7 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error { ...@@ -185,7 +186,7 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error {
if existing.Annotations == nil { if existing.Annotations == nil {
existing.Annotations = map[string]string{} existing.Annotations = map[string]string{}
} }
existing.Annotations[originalReplicasAnnotation] = strconv.Itoa(existing.Spec.Replicas) existing.Annotations[originalReplicasAnnotation] = strconv.Itoa(int(existing.Spec.Replicas))
updated, err := r.c.ReplicationControllers(existing.Namespace).Update(existing) updated, err := r.c.ReplicationControllers(existing.Namespace).Update(existing)
if err != nil { if err != nil {
return err return err
...@@ -204,7 +205,7 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error { ...@@ -204,7 +205,7 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error {
} }
// The minumum pods which must remain available througout the update // The minumum pods which must remain available througout the update
// calculated for internal convenience. // calculated for internal convenience.
minAvailable := integer.IntMax(0, desired-maxUnavailable) minAvailable := int32(integer.IntMax(0, int(desired-maxUnavailable)))
// If the desired new scale is 0, then the max unavailable is necessarily // If the desired new scale is 0, then the max unavailable is necessarily
// the effective scale of the old RC regardless of the configuration // the effective scale of the old RC regardless of the configuration
// (equivalent to 100% maxUnavailable). // (equivalent to 100% maxUnavailable).
...@@ -258,7 +259,7 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error { ...@@ -258,7 +259,7 @@ func (r *RollingUpdater) Update(config *RollingUpdaterConfig) error {
// scaleUp scales up newRc to desired by whatever increment is possible given // scaleUp scales up newRc to desired by whatever increment is possible given
// the configured surge threshold. scaleUp will safely no-op as necessary when // the configured surge threshold. scaleUp will safely no-op as necessary when
// it detects redundancy or other relevant conditions. // it detects redundancy or other relevant conditions.
func (r *RollingUpdater) scaleUp(newRc, oldRc *api.ReplicationController, desired, maxSurge, maxUnavailable int, scaleRetryParams *RetryParams, config *RollingUpdaterConfig) (*api.ReplicationController, error) { func (r *RollingUpdater) scaleUp(newRc, oldRc *api.ReplicationController, desired, maxSurge, maxUnavailable int32, scaleRetryParams *RetryParams, config *RollingUpdaterConfig) (*api.ReplicationController, error) {
// If we're already at the desired, do nothing. // If we're already at the desired, do nothing.
if newRc.Spec.Replicas == desired { if newRc.Spec.Replicas == desired {
return newRc, nil return newRc, nil
...@@ -291,7 +292,7 @@ func (r *RollingUpdater) scaleUp(newRc, oldRc *api.ReplicationController, desire ...@@ -291,7 +292,7 @@ func (r *RollingUpdater) scaleUp(newRc, oldRc *api.ReplicationController, desire
// scaleDown scales down oldRc to 0 at whatever decrement possible given the // scaleDown scales down oldRc to 0 at whatever decrement possible given the
// thresholds defined on the config. scaleDown will safely no-op as necessary // thresholds defined on the config. scaleDown will safely no-op as necessary
// when it detects redundancy or other relevant conditions. // when it detects redundancy or other relevant conditions.
func (r *RollingUpdater) scaleDown(newRc, oldRc *api.ReplicationController, desired, minAvailable, maxUnavailable, maxSurge int, config *RollingUpdaterConfig) (*api.ReplicationController, error) { func (r *RollingUpdater) scaleDown(newRc, oldRc *api.ReplicationController, desired, minAvailable, maxUnavailable, maxSurge int32, config *RollingUpdaterConfig) (*api.ReplicationController, error) {
// Already scaled down; do nothing. // Already scaled down; do nothing.
if oldRc.Spec.Replicas == 0 { if oldRc.Spec.Replicas == 0 {
return oldRc, nil return oldRc, nil
...@@ -356,10 +357,10 @@ func (r *RollingUpdater) scaleAndWaitWithScaler(rc *api.ReplicationController, r ...@@ -356,10 +357,10 @@ func (r *RollingUpdater) scaleAndWaitWithScaler(rc *api.ReplicationController, r
// readyPods returns the old and new ready counts for their pods. // readyPods returns the old and new ready counts for their pods.
// If a pod is observed as being ready, it's considered ready even // If a pod is observed as being ready, it's considered ready even
// if it later becomes notReady. // if it later becomes notReady.
func (r *RollingUpdater) readyPods(oldRc, newRc *api.ReplicationController) (int, int, error) { func (r *RollingUpdater) readyPods(oldRc, newRc *api.ReplicationController) (int32, int32, error) {
controllers := []*api.ReplicationController{oldRc, newRc} controllers := []*api.ReplicationController{oldRc, newRc}
oldReady := 0 oldReady := int32(0)
newReady := 0 newReady := int32(0)
for i := range controllers { for i := range controllers {
controller := controllers[i] controller := controllers[i]
......
...@@ -48,7 +48,7 @@ func oldRc(replicas int, original int) *api.ReplicationController { ...@@ -48,7 +48,7 @@ func oldRc(replicas int, original int) *api.ReplicationController {
}, },
}, },
Spec: api.ReplicationControllerSpec{ Spec: api.ReplicationControllerSpec{
Replicas: replicas, Replicas: int32(replicas),
Selector: map[string]string{"version": "v1"}, Selector: map[string]string{"version": "v1"},
Template: &api.PodTemplateSpec{ Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
...@@ -58,7 +58,7 @@ func oldRc(replicas int, original int) *api.ReplicationController { ...@@ -58,7 +58,7 @@ func oldRc(replicas int, original int) *api.ReplicationController {
}, },
}, },
Status: api.ReplicationControllerStatus{ Status: api.ReplicationControllerStatus{
Replicas: replicas, Replicas: int32(replicas),
}, },
} }
} }
...@@ -794,7 +794,7 @@ Scaling foo-v2 up to 2 ...@@ -794,7 +794,7 @@ Scaling foo-v2 up to 2
} }
if expected == -1 { if expected == -1 {
t.Fatalf("unexpected scale of %s to %d", rc.Name, rc.Spec.Replicas) t.Fatalf("unexpected scale of %s to %d", rc.Name, rc.Spec.Replicas)
} else if e, a := expected, rc.Spec.Replicas; e != a { } else if e, a := expected, int(rc.Spec.Replicas); e != a {
t.Fatalf("expected scale of %s to %d, got %d", rc.Name, e, a) t.Fatalf("expected scale of %s to %d, got %d", rc.Name, e, a)
} }
// Simulate the scale. // Simulate the scale.
...@@ -810,7 +810,7 @@ Scaling foo-v2 up to 2 ...@@ -810,7 +810,7 @@ Scaling foo-v2 up to 2
}, },
} }
// Set up a mock readiness check which handles the test assertions. // Set up a mock readiness check which handles the test assertions.
updater.getReadyPods = func(oldRc, newRc *api.ReplicationController) (int, int, error) { updater.getReadyPods = func(oldRc, newRc *api.ReplicationController) (int32, int32, error) {
// Return simulated readiness, and throw an error if this call has no // Return simulated readiness, and throw an error if this call has no
// expectations defined. // expectations defined.
oldReady := next(&oldReady) oldReady := next(&oldReady)
...@@ -818,7 +818,7 @@ Scaling foo-v2 up to 2 ...@@ -818,7 +818,7 @@ Scaling foo-v2 up to 2
if oldReady == -1 || newReady == -1 { if oldReady == -1 || newReady == -1 {
t.Fatalf("unexpected getReadyPods call for:\noldRc: %+v\nnewRc: %+v", oldRc, newRc) t.Fatalf("unexpected getReadyPods call for:\noldRc: %+v\nnewRc: %+v", oldRc, newRc)
} }
return oldReady, newReady, nil return int32(oldReady), int32(newReady), nil
} }
var buffer bytes.Buffer var buffer bytes.Buffer
config := &RollingUpdaterConfig{ config := &RollingUpdaterConfig{
...@@ -860,7 +860,7 @@ func TestUpdate_progressTimeout(t *testing.T) { ...@@ -860,7 +860,7 @@ func TestUpdate_progressTimeout(t *testing.T) {
return nil return nil
}, },
} }
updater.getReadyPods = func(oldRc, newRc *api.ReplicationController) (int, int, error) { updater.getReadyPods = func(oldRc, newRc *api.ReplicationController) (int32, int32, error) {
// Coerce a timeout by pods never becoming ready. // Coerce a timeout by pods never becoming ready.
return 0, 0, nil return 0, 0, nil
} }
...@@ -913,7 +913,7 @@ func TestUpdate_assignOriginalAnnotation(t *testing.T) { ...@@ -913,7 +913,7 @@ func TestUpdate_assignOriginalAnnotation(t *testing.T) {
cleanup: func(oldRc, newRc *api.ReplicationController, config *RollingUpdaterConfig) error { cleanup: func(oldRc, newRc *api.ReplicationController, config *RollingUpdaterConfig) error {
return nil return nil
}, },
getReadyPods: func(oldRc, newRc *api.ReplicationController) (int, int, error) { getReadyPods: func(oldRc, newRc *api.ReplicationController) (int32, int32, error) {
return 1, 1, nil return 1, 1, nil
}, },
} }
...@@ -1573,8 +1573,8 @@ func TestRollingUpdater_readyPods(t *testing.T) { ...@@ -1573,8 +1573,8 @@ func TestRollingUpdater_readyPods(t *testing.T) {
oldRc *api.ReplicationController oldRc *api.ReplicationController
newRc *api.ReplicationController newRc *api.ReplicationController
// expectated old/new ready counts // expectated old/new ready counts
oldReady int oldReady int32
newReady int newReady int32
// pods owned by the rcs; indicate whether they're ready // pods owned by the rcs; indicate whether they're ready
oldPods []bool oldPods []bool
newPods []bool newPods []bool
......
...@@ -105,7 +105,7 @@ func (DeploymentV1Beta1) Generate(genericParams map[string]interface{}) (runtime ...@@ -105,7 +105,7 @@ func (DeploymentV1Beta1) Generate(genericParams map[string]interface{}) (runtime
Labels: labels, Labels: labels,
}, },
Spec: extensions.DeploymentSpec{ Spec: extensions.DeploymentSpec{
Replicas: count, Replicas: int32(count),
Selector: &unversioned.LabelSelector{MatchLabels: labels}, Selector: &unversioned.LabelSelector{MatchLabels: labels},
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
...@@ -605,7 +605,7 @@ func (BasicReplicationController) Generate(genericParams map[string]interface{}) ...@@ -605,7 +605,7 @@ func (BasicReplicationController) Generate(genericParams map[string]interface{})
Labels: labels, Labels: labels,
}, },
Spec: api.ReplicationControllerSpec{ Spec: api.ReplicationControllerSpec{
Replicas: count, Replicas: int32(count),
Selector: labels, Selector: labels,
Template: &api.PodTemplateSpec{ Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
...@@ -680,11 +680,11 @@ func updatePodPorts(params map[string]string, podSpec *api.PodSpec) (err error) ...@@ -680,11 +680,11 @@ func updatePodPorts(params map[string]string, podSpec *api.PodSpec) (err error)
if port > 0 { if port > 0 {
podSpec.Containers[0].Ports = []api.ContainerPort{ podSpec.Containers[0].Ports = []api.ContainerPort{
{ {
ContainerPort: port, ContainerPort: int32(port),
}, },
} }
if hostPort > 0 { if hostPort > 0 {
podSpec.Containers[0].Ports[0].HostPort = hostPort podSpec.Containers[0].Ports[0].HostPort = int32(hostPort)
} }
} }
return nil return nil
......
...@@ -129,8 +129,8 @@ func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name s ...@@ -129,8 +129,8 @@ func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name s
// ValidateReplicationController ensures that the preconditions match. Returns nil if they are valid, an error otherwise // ValidateReplicationController ensures that the preconditions match. Returns nil if they are valid, an error otherwise
func (precondition *ScalePrecondition) ValidateReplicationController(controller *api.ReplicationController) error { func (precondition *ScalePrecondition) ValidateReplicationController(controller *api.ReplicationController) error {
if precondition.Size != -1 && controller.Spec.Replicas != precondition.Size { if precondition.Size != -1 && int(controller.Spec.Replicas) != precondition.Size {
return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(controller.Spec.Replicas)} return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(int(controller.Spec.Replicas))}
} }
if len(precondition.ResourceVersion) != 0 && controller.ResourceVersion != precondition.ResourceVersion { if len(precondition.ResourceVersion) != 0 && controller.ResourceVersion != precondition.ResourceVersion {
return PreconditionError{"resource version", precondition.ResourceVersion, controller.ResourceVersion} return PreconditionError{"resource version", precondition.ResourceVersion, controller.ResourceVersion}
...@@ -152,7 +152,7 @@ func (scaler *ReplicationControllerScaler) ScaleSimple(namespace, name string, p ...@@ -152,7 +152,7 @@ func (scaler *ReplicationControllerScaler) ScaleSimple(namespace, name string, p
return err return err
} }
} }
controller.Spec.Replicas = int(newSize) controller.Spec.Replicas = int32(newSize)
// TODO: do retry on 409 errors here? // TODO: do retry on 409 errors here?
if _, err := scaler.c.ReplicationControllers(namespace).Update(controller); err != nil { if _, err := scaler.c.ReplicationControllers(namespace).Update(controller); err != nil {
if errors.IsInvalid(err) { if errors.IsInvalid(err) {
...@@ -191,8 +191,8 @@ func (scaler *ReplicationControllerScaler) Scale(namespace, name string, newSize ...@@ -191,8 +191,8 @@ func (scaler *ReplicationControllerScaler) Scale(namespace, name string, newSize
// ValidateReplicaSet ensures that the preconditions match. Returns nil if they are valid, an error otherwise // ValidateReplicaSet ensures that the preconditions match. Returns nil if they are valid, an error otherwise
func (precondition *ScalePrecondition) ValidateReplicaSet(replicaSet *extensions.ReplicaSet) error { func (precondition *ScalePrecondition) ValidateReplicaSet(replicaSet *extensions.ReplicaSet) error {
if precondition.Size != -1 && replicaSet.Spec.Replicas != precondition.Size { if precondition.Size != -1 && int(replicaSet.Spec.Replicas) != precondition.Size {
return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(replicaSet.Spec.Replicas)} return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(int(replicaSet.Spec.Replicas))}
} }
if len(precondition.ResourceVersion) != 0 && replicaSet.ResourceVersion != precondition.ResourceVersion { if len(precondition.ResourceVersion) != 0 && replicaSet.ResourceVersion != precondition.ResourceVersion {
return PreconditionError{"resource version", precondition.ResourceVersion, replicaSet.ResourceVersion} return PreconditionError{"resource version", precondition.ResourceVersion, replicaSet.ResourceVersion}
...@@ -214,7 +214,7 @@ func (scaler *ReplicaSetScaler) ScaleSimple(namespace, name string, precondition ...@@ -214,7 +214,7 @@ func (scaler *ReplicaSetScaler) ScaleSimple(namespace, name string, precondition
return err return err
} }
} }
rs.Spec.Replicas = int(newSize) rs.Spec.Replicas = int32(newSize)
// TODO: do retry on 409 errors here? // TODO: do retry on 409 errors here?
if _, err := scaler.c.ReplicaSets(namespace).Update(rs); err != nil { if _, err := scaler.c.ReplicaSets(namespace).Update(rs); err != nil {
if errors.IsInvalid(err) { if errors.IsInvalid(err) {
...@@ -256,8 +256,8 @@ func (precondition *ScalePrecondition) ValidateJob(job *batch.Job) error { ...@@ -256,8 +256,8 @@ func (precondition *ScalePrecondition) ValidateJob(job *batch.Job) error {
if precondition.Size != -1 && job.Spec.Parallelism == nil { if precondition.Size != -1 && job.Spec.Parallelism == nil {
return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), "nil"} return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), "nil"}
} }
if precondition.Size != -1 && *job.Spec.Parallelism != precondition.Size { if precondition.Size != -1 && int(*job.Spec.Parallelism) != precondition.Size {
return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), strconv.Itoa(*job.Spec.Parallelism)} return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), strconv.Itoa(int(*job.Spec.Parallelism))}
} }
if len(precondition.ResourceVersion) != 0 && job.ResourceVersion != precondition.ResourceVersion { if len(precondition.ResourceVersion) != 0 && job.ResourceVersion != precondition.ResourceVersion {
return PreconditionError{"resource version", precondition.ResourceVersion, job.ResourceVersion} return PreconditionError{"resource version", precondition.ResourceVersion, job.ResourceVersion}
...@@ -280,7 +280,7 @@ func (scaler *JobScaler) ScaleSimple(namespace, name string, preconditions *Scal ...@@ -280,7 +280,7 @@ func (scaler *JobScaler) ScaleSimple(namespace, name string, preconditions *Scal
return err return err
} }
} }
parallelism := int(newSize) parallelism := int32(newSize)
job.Spec.Parallelism = &parallelism job.Spec.Parallelism = &parallelism
if _, err := scaler.c.Jobs(namespace).Update(job); err != nil { if _, err := scaler.c.Jobs(namespace).Update(job); err != nil {
if errors.IsInvalid(err) { if errors.IsInvalid(err) {
...@@ -319,8 +319,8 @@ func (scaler *JobScaler) Scale(namespace, name string, newSize uint, preconditio ...@@ -319,8 +319,8 @@ func (scaler *JobScaler) Scale(namespace, name string, newSize uint, preconditio
// ValidateDeployment ensures that the preconditions match. Returns nil if they are valid, an error otherwise. // ValidateDeployment ensures that the preconditions match. Returns nil if they are valid, an error otherwise.
func (precondition *ScalePrecondition) ValidateDeployment(deployment *extensions.Deployment) error { func (precondition *ScalePrecondition) ValidateDeployment(deployment *extensions.Deployment) error {
if precondition.Size != -1 && deployment.Spec.Replicas != precondition.Size { if precondition.Size != -1 && int(deployment.Spec.Replicas) != precondition.Size {
return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(deployment.Spec.Replicas)} return PreconditionError{"replicas", strconv.Itoa(precondition.Size), strconv.Itoa(int(deployment.Spec.Replicas))}
} }
if len(precondition.ResourceVersion) != 0 && deployment.ResourceVersion != precondition.ResourceVersion { if len(precondition.ResourceVersion) != 0 && deployment.ResourceVersion != precondition.ResourceVersion {
return PreconditionError{"resource version", precondition.ResourceVersion, deployment.ResourceVersion} return PreconditionError{"resource version", precondition.ResourceVersion, deployment.ResourceVersion}
...@@ -346,7 +346,7 @@ func (scaler *DeploymentScaler) ScaleSimple(namespace, name string, precondition ...@@ -346,7 +346,7 @@ func (scaler *DeploymentScaler) ScaleSimple(namespace, name string, precondition
// TODO(madhusudancs): Fix this when Scale group issues are resolved (see issue #18528). // TODO(madhusudancs): Fix this when Scale group issues are resolved (see issue #18528).
// For now I'm falling back to regular Deployment update operation. // For now I'm falling back to regular Deployment update operation.
deployment.Spec.Replicas = int(newSize) deployment.Spec.Replicas = int32(newSize)
if _, err := scaler.c.Deployments(namespace).Update(deployment); err != nil { if _, err := scaler.c.Deployments(namespace).Update(deployment); err != nil {
if errors.IsInvalid(err) { if errors.IsInvalid(err) {
return ScaleError{ScaleUpdateInvalidFailure, deployment.ResourceVersion, err} return ScaleError{ScaleUpdateInvalidFailure, deployment.ResourceVersion, err}
......
...@@ -107,7 +107,7 @@ func TestReplicationControllerScale(t *testing.T) { ...@@ -107,7 +107,7 @@ func TestReplicationControllerScale(t *testing.T) {
if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "replicationcontrollers" || action.GetName() != name { if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "replicationcontrollers" || action.GetName() != name {
t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name) t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name)
} }
if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "replicationcontrollers" || action.GetObject().(*api.ReplicationController).Spec.Replicas != int(count) { if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "replicationcontrollers" || action.GetObject().(*api.ReplicationController).Spec.Replicas != int32(count) {
t.Errorf("unexpected action %v, expected update-replicationController with replicas = %d", actions[1], count) t.Errorf("unexpected action %v, expected update-replicationController with replicas = %d", actions[1], count)
} }
} }
...@@ -261,7 +261,7 @@ func (c *ErrorJobs) Update(job *batch.Job) (*batch.Job, error) { ...@@ -261,7 +261,7 @@ func (c *ErrorJobs) Update(job *batch.Job) (*batch.Job, error) {
} }
func (c *ErrorJobs) Get(name string) (*batch.Job, error) { func (c *ErrorJobs) Get(name string) (*batch.Job, error) {
zero := 0 zero := int32(0)
return &batch.Job{ return &batch.Job{
Spec: batch.JobSpec{ Spec: batch.JobSpec{
Parallelism: &zero, Parallelism: &zero,
...@@ -317,7 +317,7 @@ func TestJobScale(t *testing.T) { ...@@ -317,7 +317,7 @@ func TestJobScale(t *testing.T) {
if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "jobs" || action.GetName() != name { if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "jobs" || action.GetName() != name {
t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name) t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name)
} }
if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "jobs" || *action.GetObject().(*batch.Job).Spec.Parallelism != int(count) { if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "jobs" || *action.GetObject().(*batch.Job).Spec.Parallelism != int32(count) {
t.Errorf("unexpected action %v, expected update-job with parallelism = %d", actions[1], count) t.Errorf("unexpected action %v, expected update-job with parallelism = %d", actions[1], count)
} }
} }
...@@ -342,7 +342,7 @@ func TestJobScaleInvalid(t *testing.T) { ...@@ -342,7 +342,7 @@ func TestJobScaleInvalid(t *testing.T) {
} }
func TestJobScaleFailsPreconditions(t *testing.T) { func TestJobScaleFailsPreconditions(t *testing.T) {
ten := 10 ten := int32(10)
fake := testclient.NewSimpleFake(&batch.Job{ fake := testclient.NewSimpleFake(&batch.Job{
Spec: batch.JobSpec{ Spec: batch.JobSpec{
Parallelism: &ten, Parallelism: &ten,
...@@ -364,7 +364,7 @@ func TestJobScaleFailsPreconditions(t *testing.T) { ...@@ -364,7 +364,7 @@ func TestJobScaleFailsPreconditions(t *testing.T) {
} }
func TestValidateJob(t *testing.T) { func TestValidateJob(t *testing.T) {
zero, ten, twenty := 0, 10, 20 zero, ten, twenty := int32(0), int32(10), int32(20)
tests := []struct { tests := []struct {
preconditions ScalePrecondition preconditions ScalePrecondition
job batch.Job job batch.Job
...@@ -557,7 +557,7 @@ func TestDeploymentScale(t *testing.T) { ...@@ -557,7 +557,7 @@ func TestDeploymentScale(t *testing.T) {
if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "deployments" || action.GetName() != name { if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "deployments" || action.GetName() != name {
t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name) t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name)
} }
if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "deployments" || action.GetObject().(*extensions.Deployment).Spec.Replicas != int(count) { if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "deployments" || action.GetObject().(*extensions.Deployment).Spec.Replicas != int32(count) {
t.Errorf("unexpected action %v, expected update-deployment with replicas = %d", actions[1], count) t.Errorf("unexpected action %v, expected update-deployment with replicas = %d", actions[1], count)
} }
} }
...@@ -603,7 +603,7 @@ func TestDeploymentScaleFailsPreconditions(t *testing.T) { ...@@ -603,7 +603,7 @@ func TestDeploymentScaleFailsPreconditions(t *testing.T) {
} }
func TestValidateDeployment(t *testing.T) { func TestValidateDeployment(t *testing.T) {
zero, ten, twenty := 0, 10, 20 zero, ten, twenty := int32(0), int32(10), int32(20)
tests := []struct { tests := []struct {
preconditions ScalePrecondition preconditions ScalePrecondition
deployment extensions.Deployment deployment extensions.Deployment
......
...@@ -136,7 +136,7 @@ func generate(genericParams map[string]interface{}) (runtime.Object, error) { ...@@ -136,7 +136,7 @@ func generate(genericParams map[string]interface{}) (runtime.Object, error) {
} }
ports = append(ports, api.ServicePort{ ports = append(ports, api.ServicePort{
Name: name, Name: name,
Port: port, Port: int32(port),
Protocol: api.Protocol(params["protocol"]), Protocol: api.Protocol(params["protocol"]),
}) })
} }
...@@ -171,7 +171,7 @@ func generate(genericParams map[string]interface{}) (runtime.Object, error) { ...@@ -171,7 +171,7 @@ func generate(genericParams map[string]interface{}) (runtime.Object, error) {
// should be the same as Port // should be the same as Port
for i := range service.Spec.Ports { for i := range service.Spec.Ports {
port := service.Spec.Ports[i].Port port := service.Spec.Ports[i].Port
service.Spec.Ports[i].TargetPort = intstr.FromInt(port) service.Spec.Ports[i].TargetPort = intstr.FromInt(int(port))
} }
} }
if params["create-external-load-balancer"] == "true" { if params["create-external-load-balancer"] == "true" {
......
...@@ -367,7 +367,7 @@ func (reaper *DeploymentReaper) Stop(namespace, name string, timeout time.Durati ...@@ -367,7 +367,7 @@ func (reaper *DeploymentReaper) Stop(namespace, name string, timeout time.Durati
deployment, err := reaper.updateDeploymentWithRetries(namespace, name, func(d *extensions.Deployment) { deployment, err := reaper.updateDeploymentWithRetries(namespace, name, func(d *extensions.Deployment) {
// set deployment's history and scale to 0 // set deployment's history and scale to 0
// TODO replace with patch when available: https://github.com/kubernetes/kubernetes/issues/20527 // TODO replace with patch when available: https://github.com/kubernetes/kubernetes/issues/20527
d.Spec.RevisionHistoryLimit = util.IntPtr(0) d.Spec.RevisionHistoryLimit = util.Int32Ptr(0)
d.Spec.Replicas = 0 d.Spec.Replicas = 0
d.Spec.Paused = true d.Spec.Paused = true
}) })
......
...@@ -379,7 +379,7 @@ func TestReplicaSetStop(t *testing.T) { ...@@ -379,7 +379,7 @@ func TestReplicaSetStop(t *testing.T) {
func TestJobStop(t *testing.T) { func TestJobStop(t *testing.T) {
name := "foo" name := "foo"
ns := "default" ns := "default"
zero := 0 zero := int32(0)
tests := []struct { tests := []struct {
Name string Name string
Objs []runtime.Object Objs []runtime.Object
......
...@@ -44,13 +44,13 @@ func FromServices(services *api.ServiceList) []api.EnvVar { ...@@ -44,13 +44,13 @@ func FromServices(services *api.ServiceList) []api.EnvVar {
result = append(result, api.EnvVar{Name: name, Value: service.Spec.ClusterIP}) result = append(result, api.EnvVar{Name: name, Value: service.Spec.ClusterIP})
// First port - give it the backwards-compatible name // First port - give it the backwards-compatible name
name = makeEnvVariableName(service.Name) + "_SERVICE_PORT" name = makeEnvVariableName(service.Name) + "_SERVICE_PORT"
result = append(result, api.EnvVar{Name: name, Value: strconv.Itoa(service.Spec.Ports[0].Port)}) result = append(result, api.EnvVar{Name: name, Value: strconv.Itoa(int(service.Spec.Ports[0].Port))})
// All named ports (only the first may be unnamed, checked in validation) // All named ports (only the first may be unnamed, checked in validation)
for i := range service.Spec.Ports { for i := range service.Spec.Ports {
sp := &service.Spec.Ports[i] sp := &service.Spec.Ports[i]
if sp.Name != "" { if sp.Name != "" {
pn := name + "_" + makeEnvVariableName(sp.Name) pn := name + "_" + makeEnvVariableName(sp.Name)
result = append(result, api.EnvVar{Name: pn, Value: strconv.Itoa(sp.Port)}) result = append(result, api.EnvVar{Name: pn, Value: strconv.Itoa(int(sp.Port))})
} }
} }
// Docker-compatible vars. // Docker-compatible vars.
...@@ -96,7 +96,7 @@ func makeLinkVariables(service *api.Service) []api.EnvVar { ...@@ -96,7 +96,7 @@ func makeLinkVariables(service *api.Service) []api.EnvVar {
}, },
{ {
Name: portPrefix + "_PORT", Name: portPrefix + "_PORT",
Value: strconv.Itoa(sp.Port), Value: strconv.Itoa(int(sp.Port)),
}, },
{ {
Name: portPrefix + "_ADDR", Name: portPrefix + "_ADDR",
......
...@@ -1353,8 +1353,8 @@ func makePortMappings(container *api.Container) (ports []kubecontainer.PortMappi ...@@ -1353,8 +1353,8 @@ func makePortMappings(container *api.Container) (ports []kubecontainer.PortMappi
names := make(map[string]struct{}) names := make(map[string]struct{})
for _, p := range container.Ports { for _, p := range container.Ports {
pm := kubecontainer.PortMapping{ pm := kubecontainer.PortMapping{
HostPort: p.HostPort, HostPort: int(p.HostPort),
ContainerPort: p.ContainerPort, ContainerPort: int(p.ContainerPort),
Protocol: p.Protocol, Protocol: p.Protocol,
HostIP: p.HostIP, HostIP: p.HostIP,
} }
...@@ -3506,7 +3506,7 @@ func (kl *Kubelet) convertStatusToAPIStatus(pod *api.Pod, podStatus *kubecontain ...@@ -3506,7 +3506,7 @@ func (kl *Kubelet) convertStatusToAPIStatus(pod *api.Pod, podStatus *kubecontain
cid := cs.ID.String() cid := cs.ID.String()
status := &api.ContainerStatus{ status := &api.ContainerStatus{
Name: cs.Name, Name: cs.Name,
RestartCount: cs.RestartCount, RestartCount: int32(cs.RestartCount),
Image: cs.Image, Image: cs.Image,
ImageID: cs.ImageID, ImageID: cs.ImageID,
ContainerID: cid, ContainerID: cid,
...@@ -3516,7 +3516,7 @@ func (kl *Kubelet) convertStatusToAPIStatus(pod *api.Pod, podStatus *kubecontain ...@@ -3516,7 +3516,7 @@ func (kl *Kubelet) convertStatusToAPIStatus(pod *api.Pod, podStatus *kubecontain
status.State.Running = &api.ContainerStateRunning{StartedAt: unversioned.NewTime(cs.StartedAt)} status.State.Running = &api.ContainerStateRunning{StartedAt: unversioned.NewTime(cs.StartedAt)}
case kubecontainer.ContainerStateExited: case kubecontainer.ContainerStateExited:
status.State.Terminated = &api.ContainerStateTerminated{ status.State.Terminated = &api.ContainerStateTerminated{
ExitCode: cs.ExitCode, ExitCode: int32(cs.ExitCode),
Reason: cs.Reason, Reason: cs.Reason,
Message: cs.Message, Message: cs.Message,
StartedAt: unversioned.NewTime(cs.StartedAt), StartedAt: unversioned.NewTime(cs.StartedAt),
......
...@@ -78,7 +78,7 @@ func resolvePort(portReference intstr.IntOrString, container *api.Container) (in ...@@ -78,7 +78,7 @@ func resolvePort(portReference intstr.IntOrString, container *api.Container) (in
} }
for _, portSpec := range container.Ports { for _, portSpec := range container.Ports {
if portSpec.Name == portName { if portSpec.Name == portName {
return portSpec.ContainerPort, nil return int(portSpec.ContainerPort), nil
} }
} }
return -1, fmt.Errorf("couldn't find port: %v in %v", portReference, container) return -1, fmt.Errorf("couldn't find port: %v in %v", portReference, container)
......
...@@ -43,7 +43,7 @@ func TestResolvePortString(t *testing.T) { ...@@ -43,7 +43,7 @@ func TestResolvePortString(t *testing.T) {
name := "foo" name := "foo"
container := &api.Container{ container := &api.Container{
Ports: []api.ContainerPort{ Ports: []api.ContainerPort{
{Name: name, ContainerPort: expected}, {Name: name, ContainerPort: int32(expected)},
}, },
} }
port, err := resolvePort(intstr.FromString(name), container) port, err := resolvePort(intstr.FromString(name), container)
...@@ -56,7 +56,7 @@ func TestResolvePortString(t *testing.T) { ...@@ -56,7 +56,7 @@ func TestResolvePortString(t *testing.T) {
} }
func TestResolvePortStringUnknown(t *testing.T) { func TestResolvePortStringUnknown(t *testing.T) {
expected := 80 expected := int32(80)
name := "foo" name := "foo"
container := &api.Container{ container := &api.Container{
Ports: []api.ContainerPort{ Ports: []api.ContainerPort{
......
...@@ -198,7 +198,7 @@ func extractPort(param intstr.IntOrString, container api.Container) (int, error) ...@@ -198,7 +198,7 @@ func extractPort(param intstr.IntOrString, container api.Container) (int, error)
func findPortByName(container api.Container, portName string) (int, error) { func findPortByName(container api.Container, portName string) (int, error) {
for _, port := range container.Ports { for _, port := range container.Ports {
if port.Name == portName { if port.Name == portName {
return port.ContainerPort, nil return int(port.ContainerPort), nil
} }
} }
return 0, fmt.Errorf("port %s not found", portName) return 0, fmt.Errorf("port %s not found", portName)
......
...@@ -188,7 +188,7 @@ func (w *worker) doProbe() (keepGoing bool) { ...@@ -188,7 +188,7 @@ func (w *worker) doProbe() (keepGoing bool) {
w.pod.Spec.RestartPolicy != api.RestartPolicyNever w.pod.Spec.RestartPolicy != api.RestartPolicyNever
} }
if int(time.Since(c.State.Running.StartedAt.Time).Seconds()) < w.spec.InitialDelaySeconds { if int32(time.Since(c.State.Running.StartedAt.Time).Seconds()) < w.spec.InitialDelaySeconds {
return true return true
} }
...@@ -205,8 +205,8 @@ func (w *worker) doProbe() (keepGoing bool) { ...@@ -205,8 +205,8 @@ func (w *worker) doProbe() (keepGoing bool) {
w.resultRun = 1 w.resultRun = 1
} }
if (result == results.Failure && w.resultRun < w.spec.FailureThreshold) || if (result == results.Failure && w.resultRun < int(w.spec.FailureThreshold)) ||
(result == results.Success && w.resultRun < w.spec.SuccessThreshold) { (result == results.Success && w.resultRun < int(w.spec.SuccessThreshold)) {
// Success or failure is below threshold - leave the probe state unchanged. // Success or failure is below threshold - leave the probe state unchanged.
return true return true
} }
......
...@@ -60,7 +60,7 @@ func NewHollowProxyOrDie( ...@@ -60,7 +60,7 @@ func NewHollowProxyOrDie(
) *HollowProxy { ) *HollowProxy {
// Create and start Hollow Proxy // Create and start Hollow Proxy
config := options.NewProxyConfig() config := options.NewProxyConfig()
config.OOMScoreAdj = util.IntPtr(0) config.OOMScoreAdj = util.Int32Ptr(0)
config.ResourceContainer = "" config.ResourceContainer = ""
config.NodeRef = &api.ObjectReference{ config.NodeRef = &api.ObjectReference{
Kind: "Node", Kind: "Node",
......
...@@ -158,12 +158,12 @@ func createPortAndServiceSpec(servicePort int, nodePort int, servicePortName str ...@@ -158,12 +158,12 @@ func createPortAndServiceSpec(servicePort int, nodePort int, servicePortName str
//Use the Cluster IP type for the service port if NodePort isn't provided. //Use the Cluster IP type for the service port if NodePort isn't provided.
//Otherwise, we will be binding the master service to a NodePort. //Otherwise, we will be binding the master service to a NodePort.
servicePorts := []api.ServicePort{{Protocol: api.ProtocolTCP, servicePorts := []api.ServicePort{{Protocol: api.ProtocolTCP,
Port: servicePort, Port: int32(servicePort),
Name: servicePortName, Name: servicePortName,
TargetPort: intstr.FromInt(servicePort)}} TargetPort: intstr.FromInt(servicePort)}}
serviceType := api.ServiceTypeClusterIP serviceType := api.ServiceTypeClusterIP
if nodePort > 0 { if nodePort > 0 {
servicePorts[0].NodePort = nodePort servicePorts[0].NodePort = int32(nodePort)
serviceType = api.ServiceTypeNodePort serviceType = api.ServiceTypeNodePort
} }
if extraServicePorts != nil { if extraServicePorts != nil {
...@@ -175,7 +175,7 @@ func createPortAndServiceSpec(servicePort int, nodePort int, servicePortName str ...@@ -175,7 +175,7 @@ func createPortAndServiceSpec(servicePort int, nodePort int, servicePortName str
// createEndpointPortSpec creates an array of endpoint ports // createEndpointPortSpec creates an array of endpoint ports
func createEndpointPortSpec(endpointPort int, endpointPortName string, extraEndpointPorts []api.EndpointPort) []api.EndpointPort { func createEndpointPortSpec(endpointPort int, endpointPortName string, extraEndpointPorts []api.EndpointPort) []api.EndpointPort {
endpointPorts := []api.EndpointPort{{Protocol: api.ProtocolTCP, endpointPorts := []api.EndpointPort{{Protocol: api.ProtocolTCP,
Port: endpointPort, Port: int32(endpointPort),
Name: endpointPortName, Name: endpointPortName,
}} }}
if extraEndpointPorts != nil { if extraEndpointPorts != nil {
......
...@@ -285,8 +285,8 @@ func TestControllerServicePorts(t *testing.T) { ...@@ -285,8 +285,8 @@ func TestControllerServicePorts(t *testing.T) {
controller := master.NewBootstrapController() controller := master.NewBootstrapController()
assert.Equal(1000, controller.ExtraServicePorts[0].Port) assert.Equal(int32(1000), controller.ExtraServicePorts[0].Port)
assert.Equal(1010, controller.ExtraServicePorts[1].Port) assert.Equal(int32(1010), controller.ExtraServicePorts[1].Port)
} }
// TestGetNodeAddresses verifies that proper results are returned // TestGetNodeAddresses verifies that proper results are returned
......
...@@ -94,14 +94,14 @@ func (g *MetricsGrabber) GrabFromKubelet(nodeName string) (KubeletMetrics, error ...@@ -94,14 +94,14 @@ func (g *MetricsGrabber) GrabFromKubelet(nodeName string) (KubeletMetrics, error
return KubeletMetrics{}, fmt.Errorf("Error listing nodes with name %v, got %v", nodeName, nodes.Items) return KubeletMetrics{}, fmt.Errorf("Error listing nodes with name %v, got %v", nodeName, nodes.Items)
} }
kubeletPort := nodes.Items[0].Status.DaemonEndpoints.KubeletEndpoint.Port kubeletPort := nodes.Items[0].Status.DaemonEndpoints.KubeletEndpoint.Port
return g.grabFromKubeletInternal(nodeName, kubeletPort) return g.grabFromKubeletInternal(nodeName, int(kubeletPort))
} }
func (g *MetricsGrabber) grabFromKubeletInternal(nodeName string, kubeletPort int) (KubeletMetrics, error) { func (g *MetricsGrabber) grabFromKubeletInternal(nodeName string, kubeletPort int) (KubeletMetrics, error) {
if kubeletPort <= 0 || kubeletPort > 65535 { if kubeletPort <= 0 || kubeletPort > 65535 {
return KubeletMetrics{}, fmt.Errorf("Invalid Kubelet port %v. Skipping Kubelet's metrics gathering.", kubeletPort) return KubeletMetrics{}, fmt.Errorf("Invalid Kubelet port %v. Skipping Kubelet's metrics gathering.", kubeletPort)
} }
output, err := g.getMetricsFromNode(nodeName, kubeletPort) output, err := g.getMetricsFromNode(nodeName, int(kubeletPort))
if err != nil { if err != nil {
return KubeletMetrics{}, err return KubeletMetrics{}, err
} }
...@@ -173,7 +173,7 @@ func (g *MetricsGrabber) Grab(unknownMetrics sets.String) (MetricsCollection, er ...@@ -173,7 +173,7 @@ func (g *MetricsGrabber) Grab(unknownMetrics sets.String) (MetricsCollection, er
} else { } else {
for _, node := range nodes.Items { for _, node := range nodes.Items {
kubeletPort := node.Status.DaemonEndpoints.KubeletEndpoint.Port kubeletPort := node.Status.DaemonEndpoints.KubeletEndpoint.Port
metrics, err := g.grabFromKubeletInternal(node.Name, kubeletPort) metrics, err := g.grabFromKubeletInternal(node.Name, int(kubeletPort))
if err != nil { if err != nil {
errs = append(errs, err) errs = append(errs, err)
} }
......
...@@ -330,7 +330,7 @@ func CleanupLeftovers(ipt utiliptables.Interface) (encounteredError bool) { ...@@ -330,7 +330,7 @@ func CleanupLeftovers(ipt utiliptables.Interface) (encounteredError bool) {
} }
func (proxier *Proxier) sameConfig(info *serviceInfo, service *api.Service, port *api.ServicePort) bool { func (proxier *Proxier) sameConfig(info *serviceInfo, service *api.Service, port *api.ServicePort) bool {
if info.protocol != port.Protocol || info.port != port.Port || info.nodePort != port.NodePort { if info.protocol != port.Protocol || info.port != int(port.Port) || info.nodePort != int(port.NodePort) {
return false return false
} }
if !info.clusterIP.Equal(net.ParseIP(service.Spec.ClusterIP)) { if !info.clusterIP.Equal(net.ParseIP(service.Spec.ClusterIP)) {
...@@ -426,9 +426,9 @@ func (proxier *Proxier) OnServiceUpdate(allServices []api.Service) { ...@@ -426,9 +426,9 @@ func (proxier *Proxier) OnServiceUpdate(allServices []api.Service) {
glog.V(1).Infof("Adding new service %q at %s:%d/%s", serviceName, serviceIP, servicePort.Port, servicePort.Protocol) glog.V(1).Infof("Adding new service %q at %s:%d/%s", serviceName, serviceIP, servicePort.Port, servicePort.Protocol)
info = newServiceInfo(serviceName) info = newServiceInfo(serviceName)
info.clusterIP = serviceIP info.clusterIP = serviceIP
info.port = servicePort.Port info.port = int(servicePort.Port)
info.protocol = servicePort.Protocol info.protocol = servicePort.Protocol
info.nodePort = servicePort.NodePort info.nodePort = int(servicePort.NodePort)
info.externalIPs = service.Spec.ExternalIPs info.externalIPs = service.Spec.ExternalIPs
// Deep-copy in case the service instance changes // Deep-copy in case the service instance changes
info.loadBalancerStatus = *api.LoadBalancerStatusDeepCopy(&service.Status.LoadBalancer) info.loadBalancerStatus = *api.LoadBalancerStatusDeepCopy(&service.Status.LoadBalancer)
...@@ -483,7 +483,7 @@ func (proxier *Proxier) OnEndpointsUpdate(allEndpoints []api.Endpoints) { ...@@ -483,7 +483,7 @@ func (proxier *Proxier) OnEndpointsUpdate(allEndpoints []api.Endpoints) {
port := &ss.Ports[i] port := &ss.Ports[i]
for i := range ss.Addresses { for i := range ss.Addresses {
addr := &ss.Addresses[i] addr := &ss.Addresses[i]
portsToEndpoints[port.Name] = append(portsToEndpoints[port.Name], hostPortPair{addr.IP, port.Port}) portsToEndpoints[port.Name] = append(portsToEndpoints[port.Name], hostPortPair{addr.IP, int(port.Port)})
} }
} }
} }
......
...@@ -419,11 +419,11 @@ func (proxier *Proxier) OnServiceUpdate(services []api.Service) { ...@@ -419,11 +419,11 @@ func (proxier *Proxier) OnServiceUpdate(services []api.Service) {
continue continue
} }
info.portal.ip = serviceIP info.portal.ip = serviceIP
info.portal.port = servicePort.Port info.portal.port = int(servicePort.Port)
info.externalIPs = service.Spec.ExternalIPs info.externalIPs = service.Spec.ExternalIPs
// Deep-copy in case the service instance changes // Deep-copy in case the service instance changes
info.loadBalancerStatus = *api.LoadBalancerStatusDeepCopy(&service.Status.LoadBalancer) info.loadBalancerStatus = *api.LoadBalancerStatusDeepCopy(&service.Status.LoadBalancer)
info.nodePort = servicePort.NodePort info.nodePort = int(servicePort.NodePort)
info.sessionAffinityType = service.Spec.SessionAffinity info.sessionAffinityType = service.Spec.SessionAffinity
glog.V(4).Infof("info: %+v", info) glog.V(4).Infof("info: %+v", info)
...@@ -452,7 +452,7 @@ func (proxier *Proxier) OnServiceUpdate(services []api.Service) { ...@@ -452,7 +452,7 @@ func (proxier *Proxier) OnServiceUpdate(services []api.Service) {
} }
func sameConfig(info *serviceInfo, service *api.Service, port *api.ServicePort) bool { func sameConfig(info *serviceInfo, service *api.Service, port *api.ServicePort) bool {
if info.protocol != port.Protocol || info.portal.port != port.Port || info.nodePort != port.NodePort { if info.protocol != port.Protocol || info.portal.port != int(port.Port) || info.nodePort != int(port.NodePort) {
return false return false
} }
if !info.portal.ip.Equal(net.ParseIP(service.Spec.ClusterIP)) { if !info.portal.ip.Equal(net.ParseIP(service.Spec.ClusterIP)) {
......
...@@ -82,8 +82,8 @@ func waitForClosedPortUDP(p *Proxier, proxyPort int) error { ...@@ -82,8 +82,8 @@ func waitForClosedPortUDP(p *Proxier, proxyPort int) error {
return fmt.Errorf("port %d still open", proxyPort) return fmt.Errorf("port %d still open", proxyPort)
} }
var tcpServerPort int var tcpServerPort int32
var udpServerPort int var udpServerPort int32
func init() { func init() {
// Don't handle panics // Don't handle panics
...@@ -103,10 +103,11 @@ func init() { ...@@ -103,10 +103,11 @@ func init() {
if err != nil { if err != nil {
panic(fmt.Sprintf("failed to parse: %v", err)) panic(fmt.Sprintf("failed to parse: %v", err))
} }
tcpServerPort, err = strconv.Atoi(port) tcpServerPortValue, err := strconv.Atoi(port)
if err != nil { if err != nil {
panic(fmt.Sprintf("failed to atoi(%s): %v", port, err)) panic(fmt.Sprintf("failed to atoi(%s): %v", port, err))
} }
tcpServerPort = int32(tcpServerPortValue)
// UDP setup. // UDP setup.
udp, err := newUDPEchoServer() udp, err := newUDPEchoServer()
...@@ -117,10 +118,11 @@ func init() { ...@@ -117,10 +118,11 @@ func init() {
if err != nil { if err != nil {
panic(fmt.Sprintf("failed to parse: %v", err)) panic(fmt.Sprintf("failed to parse: %v", err))
} }
udpServerPort, err = strconv.Atoi(port) udpServerPortValue, err := strconv.Atoi(port)
if err != nil { if err != nil {
panic(fmt.Sprintf("failed to atoi(%s): %v", port, err)) panic(fmt.Sprintf("failed to atoi(%s): %v", port, err))
} }
udpServerPort = int32(udpServerPortValue)
go udp.Loop() go udp.Loop()
} }
...@@ -564,7 +566,7 @@ func TestTCPProxyUpdateDeleteUpdate(t *testing.T) { ...@@ -564,7 +566,7 @@ func TestTCPProxyUpdateDeleteUpdate(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
Spec: api.ServiceSpec{ClusterIP: "1.2.3.4", Ports: []api.ServicePort{{ Spec: api.ServiceSpec{ClusterIP: "1.2.3.4", Ports: []api.ServicePort{{
Name: "p", Name: "p",
Port: svcInfo.proxyPort, Port: int32(svcInfo.proxyPort),
Protocol: "TCP", Protocol: "TCP",
}}}, }}},
}}) }})
...@@ -616,7 +618,7 @@ func TestUDPProxyUpdateDeleteUpdate(t *testing.T) { ...@@ -616,7 +618,7 @@ func TestUDPProxyUpdateDeleteUpdate(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
Spec: api.ServiceSpec{ClusterIP: "1.2.3.4", Ports: []api.ServicePort{{ Spec: api.ServiceSpec{ClusterIP: "1.2.3.4", Ports: []api.ServicePort{{
Name: "p", Name: "p",
Port: svcInfo.proxyPort, Port: int32(svcInfo.proxyPort),
Protocol: "UDP", Protocol: "UDP",
}}}, }}},
}}) }})
...@@ -752,7 +754,7 @@ func TestProxyUpdatePublicIPs(t *testing.T) { ...@@ -752,7 +754,7 @@ func TestProxyUpdatePublicIPs(t *testing.T) {
Spec: api.ServiceSpec{ Spec: api.ServiceSpec{
Ports: []api.ServicePort{{ Ports: []api.ServicePort{{
Name: "p", Name: "p",
Port: svcInfo.portal.port, Port: int32(svcInfo.portal.port),
Protocol: "TCP", Protocol: "TCP",
}}, }},
ClusterIP: svcInfo.portal.ip.String(), ClusterIP: svcInfo.portal.ip.String(),
...@@ -803,7 +805,7 @@ func TestProxyUpdatePortal(t *testing.T) { ...@@ -803,7 +805,7 @@ func TestProxyUpdatePortal(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
Spec: api.ServiceSpec{ClusterIP: "", Ports: []api.ServicePort{{ Spec: api.ServiceSpec{ClusterIP: "", Ports: []api.ServicePort{{
Name: "p", Name: "p",
Port: svcInfo.proxyPort, Port: int32(svcInfo.proxyPort),
Protocol: "TCP", Protocol: "TCP",
}}}, }}},
}}) }})
...@@ -816,7 +818,7 @@ func TestProxyUpdatePortal(t *testing.T) { ...@@ -816,7 +818,7 @@ func TestProxyUpdatePortal(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
Spec: api.ServiceSpec{ClusterIP: "None", Ports: []api.ServicePort{{ Spec: api.ServiceSpec{ClusterIP: "None", Ports: []api.ServicePort{{
Name: "p", Name: "p",
Port: svcInfo.proxyPort, Port: int32(svcInfo.proxyPort),
Protocol: "TCP", Protocol: "TCP",
}}}, }}},
}}) }})
...@@ -829,7 +831,7 @@ func TestProxyUpdatePortal(t *testing.T) { ...@@ -829,7 +831,7 @@ func TestProxyUpdatePortal(t *testing.T) {
ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace}, ObjectMeta: api.ObjectMeta{Name: service.Name, Namespace: service.Namespace},
Spec: api.ServiceSpec{ClusterIP: "1.2.3.4", Ports: []api.ServicePort{{ Spec: api.ServiceSpec{ClusterIP: "1.2.3.4", Ports: []api.ServicePort{{
Name: "p", Name: "p",
Port: svcInfo.proxyPort, Port: int32(svcInfo.proxyPort),
Protocol: "TCP", Protocol: "TCP",
}}}, }}},
}}) }})
......
...@@ -244,7 +244,7 @@ func (lb *LoadBalancerRR) OnEndpointsUpdate(allEndpoints []api.Endpoints) { ...@@ -244,7 +244,7 @@ func (lb *LoadBalancerRR) OnEndpointsUpdate(allEndpoints []api.Endpoints) {
port := &ss.Ports[i] port := &ss.Ports[i]
for i := range ss.Addresses { for i := range ss.Addresses {
addr := &ss.Addresses[i] addr := &ss.Addresses[i]
portsToEndpoints[port.Name] = append(portsToEndpoints[port.Name], hostPortPair{addr.IP, port.Port}) portsToEndpoints[port.Name] = append(portsToEndpoints[port.Name], hostPortPair{addr.IP, int(port.Port)})
// Ignore the protocol field - we'll get that from the Service objects. // Ignore the protocol field - we'll get that from the Service objects.
} }
} }
......
...@@ -281,7 +281,7 @@ func TestScaleUpdate(t *testing.T) { ...@@ -281,7 +281,7 @@ func TestScaleUpdate(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("error setting new replication controller %v: %v", *validController, err) t.Fatalf("error setting new replication controller %v: %v", *validController, err)
} }
replicas := 12 replicas := int32(12)
update := autoscaling.Scale{ update := autoscaling.Scale{
ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace}, ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace},
Spec: autoscaling.ScaleSpec{ Spec: autoscaling.ScaleSpec{
......
...@@ -105,7 +105,7 @@ func (rcStrategy) AllowUnconditionalUpdate() bool { ...@@ -105,7 +105,7 @@ func (rcStrategy) AllowUnconditionalUpdate() bool {
func ControllerToSelectableFields(controller *api.ReplicationController) fields.Set { func ControllerToSelectableFields(controller *api.ReplicationController) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(controller.ObjectMeta, true) objectMetaFieldsSet := generic.ObjectMetaFieldsSet(controller.ObjectMeta, true)
controllerSpecificFieldsSet := fields.Set{ controllerSpecificFieldsSet := fields.Set{
"status.replicas": strconv.Itoa(controller.Status.Replicas), "status.replicas": strconv.Itoa(int(controller.Status.Replicas)),
} }
return generic.MergeFieldsSets(objectMetaFieldsSet, controllerSpecificFieldsSet) return generic.MergeFieldsSets(objectMetaFieldsSet, controllerSpecificFieldsSet)
} }
......
...@@ -225,7 +225,7 @@ func TestScaleUpdate(t *testing.T) { ...@@ -225,7 +225,7 @@ func TestScaleUpdate(t *testing.T) {
if err := storage.Deployment.Storage.Create(ctx, key, &validDeployment, &deployment, 0); err != nil { if err := storage.Deployment.Storage.Create(ctx, key, &validDeployment, &deployment, 0); err != nil {
t.Fatalf("error setting new deployment (key: %s) %v: %v", key, validDeployment, err) t.Fatalf("error setting new deployment (key: %s) %v: %v", key, validDeployment, err)
} }
replicas := 12 replicas := int32(12)
update := extensions.Scale{ update := extensions.Scale{
ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace}, ObjectMeta: api.ObjectMeta{Name: name, Namespace: namespace},
Spec: extensions.ScaleSpec{ Spec: extensions.ScaleSpec{
......
...@@ -54,7 +54,7 @@ var validPodTemplate = api.PodTemplate{ ...@@ -54,7 +54,7 @@ var validPodTemplate = api.PodTemplate{
}, },
} }
var validReplicas = 8 var validReplicas = int32(8)
var validControllerSpec = api.ReplicationControllerSpec{ var validControllerSpec = api.ReplicationControllerSpec{
Replicas: validReplicas, Replicas: validReplicas,
...@@ -108,7 +108,7 @@ func TestUpdate(t *testing.T) { ...@@ -108,7 +108,7 @@ func TestUpdate(t *testing.T) {
if err := si.Create(ctx, key, &validController, nil, 0); err != nil { if err := si.Create(ctx, key, &validController, nil, 0); err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
replicas := 12 replicas := int32(12)
update := extensions.Scale{ update := extensions.Scale{
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test"}, ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test"},
Spec: extensions.ScaleSpec{ Spec: extensions.ScaleSpec{
......
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