mirror of https://github.com/k3s-io/k3s
Unversioned types should not use ambiguous go-int
All external types that are not int64 are now marked as int32, including IntOrString. Prober is now int32 (43 years should be enough of an initial probe time for anyone). Did not change the metadata fields for now.pull/6/head
parent
8046bb46df
commit
1d592e4c28
|
@ -224,7 +224,7 @@ func NewServerTimeout(kind, operation string, retryAfterSeconds int) error {
|
||||||
Details: &unversioned.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: operation,
|
Name: operation,
|
||||||
RetryAfterSeconds: retryAfterSeconds,
|
RetryAfterSeconds: int32(retryAfterSeconds),
|
||||||
},
|
},
|
||||||
Message: fmt.Sprintf("The %s operation against %s could not be completed at this time, please try again.", operation, kind),
|
Message: fmt.Sprintf("The %s operation against %s could not be completed at this time, please try again.", operation, kind),
|
||||||
}}
|
}}
|
||||||
|
@ -252,7 +252,7 @@ func NewTimeoutError(message string, retryAfterSeconds int) error {
|
||||||
Reason: unversioned.StatusReasonTimeout,
|
Reason: unversioned.StatusReasonTimeout,
|
||||||
Message: fmt.Sprintf("Timeout: %s", message),
|
Message: fmt.Sprintf("Timeout: %s", message),
|
||||||
Details: &unversioned.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
RetryAfterSeconds: retryAfterSeconds,
|
RetryAfterSeconds: int32(retryAfterSeconds),
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
@ -318,14 +318,14 @@ func NewGenericServerResponse(code int, verb, kind, name, serverMessage string,
|
||||||
}
|
}
|
||||||
return &StatusError{unversioned.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: unversioned.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: code,
|
Code: int32(code),
|
||||||
Reason: reason,
|
Reason: reason,
|
||||||
Details: &unversioned.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: name,
|
Name: name,
|
||||||
|
|
||||||
Causes: causes,
|
Causes: causes,
|
||||||
RetryAfterSeconds: retryAfterSeconds,
|
RetryAfterSeconds: int32(retryAfterSeconds),
|
||||||
},
|
},
|
||||||
Message: message,
|
Message: message,
|
||||||
}}
|
}}
|
||||||
|
@ -410,7 +410,7 @@ func SuggestsClientDelay(err error) (int, bool) {
|
||||||
if t.Status().Details != nil {
|
if t.Status().Details != nil {
|
||||||
switch t.Status().Reason {
|
switch t.Status().Reason {
|
||||||
case unversioned.StatusReasonServerTimeout, unversioned.StatusReasonTimeout:
|
case unversioned.StatusReasonServerTimeout, unversioned.StatusReasonTimeout:
|
||||||
return t.Status().Details.RetryAfterSeconds, true
|
return int(t.Status().Details.RetryAfterSeconds), true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -719,11 +719,11 @@ 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 int64 `json:"initialDelaySeconds,omitempty"`
|
InitialDelaySeconds int `json:"initialDelaySeconds,omitempty"`
|
||||||
// Length of time before health checking times out. In seconds.
|
// Length of time before health checking times out. In seconds.
|
||||||
TimeoutSeconds int64 `json:"timeoutSeconds,omitempty"`
|
TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
|
||||||
// How often (in seconds) to perform the probe.
|
// How often (in seconds) to perform the probe.
|
||||||
PeriodSeconds int64 `json:"periodSeconds,omitempty"`
|
PeriodSeconds int `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 int `json:"successThreshold,omitempty"`
|
||||||
|
|
|
@ -99,7 +99,7 @@ type Status struct {
|
||||||
// the reason type.
|
// the reason type.
|
||||||
Details *StatusDetails `json:"details,omitempty"`
|
Details *StatusDetails `json:"details,omitempty"`
|
||||||
// Suggested HTTP return code for this status, 0 if not set.
|
// Suggested HTTP return code for this status, 0 if not set.
|
||||||
Code int `json:"code,omitempty"`
|
Code int32 `json:"code,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StatusDetails is a set of additional properties that MAY be set by the
|
// StatusDetails is a set of additional properties that MAY be set by the
|
||||||
|
@ -120,7 +120,7 @@ type StatusDetails struct {
|
||||||
// failure. Not all StatusReasons may provide detailed causes.
|
// failure. Not all StatusReasons may provide detailed causes.
|
||||||
Causes []StatusCause `json:"causes,omitempty"`
|
Causes []StatusCause `json:"causes,omitempty"`
|
||||||
// If specified, the time in seconds before the operation should be retried.
|
// If specified, the time in seconds before the operation should be retried.
|
||||||
RetryAfterSeconds int `json:"retryAfterSeconds,omitempty"`
|
RetryAfterSeconds int32 `json:"retryAfterSeconds,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Values of Status.Status
|
// Values of Status.Status
|
||||||
|
@ -204,7 +204,7 @@ const (
|
||||||
// Details (optional):
|
// Details (optional):
|
||||||
// "kind" string - the kind attribute of the resource being acted on.
|
// "kind" string - the kind attribute of the resource being acted on.
|
||||||
// "id" string - the operation that is being attempted.
|
// "id" string - the operation that is being attempted.
|
||||||
// "retryAfterSeconds" int - the number of seconds before the operation should be retried
|
// "retryAfterSeconds" int32 - the number of seconds before the operation should be retried
|
||||||
// Status code 500
|
// Status code 500
|
||||||
StatusReasonServerTimeout StatusReason = "ServerTimeout"
|
StatusReasonServerTimeout StatusReason = "ServerTimeout"
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ const (
|
||||||
// The request might succeed with an increased value of timeout param. The client *should*
|
// The request might succeed with an increased value of timeout param. The client *should*
|
||||||
// wait at least the number of seconds specified by the retryAfterSeconds field.
|
// wait at least the number of seconds specified by the retryAfterSeconds field.
|
||||||
// Details (optional):
|
// Details (optional):
|
||||||
// "retryAfterSeconds" int - the number of seconds before the operation should be retried
|
// "retryAfterSeconds" int32 - the number of seconds before the operation should be retried
|
||||||
// Status code 504
|
// Status code 504
|
||||||
StatusReasonTimeout StatusReason = "Timeout"
|
StatusReasonTimeout StatusReason = "Timeout"
|
||||||
|
|
||||||
|
|
|
@ -180,8 +180,8 @@ func convert_api_ReplicationControllerSpec_To_v1_ReplicationControllerSpec(in *a
|
||||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*api.ReplicationControllerSpec))(in)
|
defaulting.(func(*api.ReplicationControllerSpec))(in)
|
||||||
}
|
}
|
||||||
out.Replicas = new(int)
|
out.Replicas = new(int32)
|
||||||
*out.Replicas = in.Replicas
|
*out.Replicas = int32(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 {
|
||||||
|
@ -213,7 +213,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 = *in.Replicas
|
out.Replicas = int(*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 {
|
||||||
|
|
|
@ -41,7 +41,7 @@ func addDefaultingFuncs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if obj.Spec.Replicas == nil {
|
if obj.Spec.Replicas == nil {
|
||||||
obj.Spec.Replicas = new(int)
|
obj.Spec.Replicas = new(int32)
|
||||||
*obj.Spec.Replicas = 1
|
*obj.Spec.Replicas = 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -85,7 +85,7 @@ func addDefaultingFuncs() {
|
||||||
sp.Protocol = ProtocolTCP
|
sp.Protocol = ProtocolTCP
|
||||||
}
|
}
|
||||||
if sp.TargetPort == intstr.FromInt(0) || sp.TargetPort == intstr.FromString("") {
|
if sp.TargetPort == intstr.FromInt(0) || sp.TargetPort == intstr.FromString("") {
|
||||||
sp.TargetPort = intstr.FromInt(sp.Port)
|
sp.TargetPort = intstr.FromInt(int(sp.Port))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -635,7 +635,7 @@ type GCEPersistentDiskVolumeSource struct {
|
||||||
// Examples: For volume /dev/sda1, you specify the partition as "1".
|
// Examples: For volume /dev/sda1, you specify the partition as "1".
|
||||||
// Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).
|
// Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk
|
||||||
Partition int `json:"partition,omitempty"`
|
Partition int32 `json:"partition,omitempty"`
|
||||||
// ReadOnly here will force the ReadOnly setting in VolumeMounts.
|
// ReadOnly here will force the ReadOnly setting in VolumeMounts.
|
||||||
// Defaults to false.
|
// Defaults to false.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#gcepersistentdisk
|
||||||
|
@ -661,7 +661,7 @@ type AWSElasticBlockStoreVolumeSource struct {
|
||||||
// If omitted, the default is to mount by volume name.
|
// If omitted, the default is to mount by volume name.
|
||||||
// Examples: For volume /dev/sda1, you specify the partition as "1".
|
// Examples: For volume /dev/sda1, you specify the partition as "1".
|
||||||
// Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).
|
// Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).
|
||||||
Partition int `json:"partition,omitempty"`
|
Partition int32 `json:"partition,omitempty"`
|
||||||
// Specify "true" to force and set the ReadOnly property in VolumeMounts to "true".
|
// Specify "true" to force and set the ReadOnly property in VolumeMounts to "true".
|
||||||
// If omitted, the default is "false".
|
// If omitted, the default is "false".
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/volumes.md#awselasticblockstore
|
||||||
|
@ -709,7 +709,7 @@ type ISCSIVolumeSource struct {
|
||||||
// Target iSCSI Qualified Name.
|
// Target iSCSI Qualified Name.
|
||||||
IQN string `json:"iqn"`
|
IQN string `json:"iqn"`
|
||||||
// iSCSI target lun number.
|
// iSCSI target lun number.
|
||||||
Lun int `json:"lun"`
|
Lun int32 `json:"lun"`
|
||||||
// Filesystem type of the volume that you want to mount.
|
// Filesystem type of the volume that you want to mount.
|
||||||
// Tip: Ensure that the filesystem type is supported by the host operating system.
|
// Tip: Ensure that the filesystem type is supported by the host operating system.
|
||||||
// Examples: "ext4", "xfs", "ntfs".
|
// Examples: "ext4", "xfs", "ntfs".
|
||||||
|
@ -726,7 +726,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"`
|
||||||
// Required: Filesystem type to mount.
|
// Required: 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"
|
// Ex. "ext4", "xfs", "ntfs"
|
||||||
|
@ -747,10 +747,10 @@ type ContainerPort struct {
|
||||||
// If specified, this must be a valid port number, 0 < x < 65536.
|
// 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.
|
||||||
// Most containers do not need this.
|
// Most containers do not need this.
|
||||||
HostPort int `json:"hostPort,omitempty"`
|
HostPort int32 `json:"hostPort,omitempty"`
|
||||||
// Number of port to expose on the pod's IP address.
|
// Number of port to expose on the pod's IP address.
|
||||||
// This must be a valid port number, 0 < x < 65536.
|
// This must be a valid port number, 0 < x < 65536.
|
||||||
ContainerPort int `json:"containerPort"`
|
ContainerPort int32 `json:"containerPort"`
|
||||||
// Protocol for port. Must be UDP or TCP.
|
// Protocol for port. Must be UDP or TCP.
|
||||||
// Defaults to "TCP".
|
// Defaults to "TCP".
|
||||||
Protocol Protocol `json:"protocol,omitempty"`
|
Protocol Protocol `json:"protocol,omitempty"`
|
||||||
|
@ -853,20 +853,20 @@ type Probe struct {
|
||||||
Handler `json:",inline"`
|
Handler `json:",inline"`
|
||||||
// Number of seconds after the container has started before liveness probes are initiated.
|
// Number of seconds after the container has started before liveness probes are initiated.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes
|
||||||
InitialDelaySeconds int64 `json:"initialDelaySeconds,omitempty"`
|
InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
|
||||||
// Number of seconds after which the probe times out.
|
// Number of seconds after which the probe times out.
|
||||||
// Defaults to 1 second. Minimum value is 1.
|
// Defaults to 1 second. Minimum value is 1.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#container-probes
|
||||||
TimeoutSeconds int64 `json:"timeoutSeconds,omitempty"`
|
TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`
|
||||||
// How often (in seconds) to perform the probe.
|
// How often (in seconds) to perform the probe.
|
||||||
// Default to 10 seconds. Minimum value is 1.
|
// Default to 10 seconds. Minimum value is 1.
|
||||||
PeriodSeconds int64 `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.
|
||||||
// Defaults to 1. Must be 1 for liveness. Minimum value is 1.
|
// Defaults to 1. Must be 1 for liveness. Minimum value is 1.
|
||||||
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.
|
||||||
// Defaults to 3. Minimum value is 1.
|
// Defaults to 3. Minimum value is 1.
|
||||||
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
|
||||||
|
@ -1064,9 +1064,9 @@ type ContainerStateRunning struct {
|
||||||
// ContainerStateTerminated is a terminated state of a container.
|
// ContainerStateTerminated is a terminated state of a container.
|
||||||
type ContainerStateTerminated struct {
|
type ContainerStateTerminated struct {
|
||||||
// Exit status from the last termination of the container
|
// Exit status from the last termination of the container
|
||||||
ExitCode int `json:"exitCode"`
|
ExitCode int32 `json:"exitCode"`
|
||||||
// Signal from the last termination of the container
|
// Signal from the last termination of the container
|
||||||
Signal int `json:"signal,omitempty"`
|
Signal int32 `json:"signal,omitempty"`
|
||||||
// (brief) reason from the last termination of the container
|
// (brief) reason from the last termination of the container
|
||||||
Reason string `json:"reason,omitempty"`
|
Reason string `json:"reason,omitempty"`
|
||||||
// Message regarding the last termination of the container
|
// Message regarding the last termination of the container
|
||||||
|
@ -1106,7 +1106,7 @@ type ContainerStatus struct {
|
||||||
// the number of dead containers that have not yet been removed.
|
// the number of dead containers that have not yet been removed.
|
||||||
// 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"`
|
||||||
// The image the container is running.
|
// The image the container is running.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/images.md
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/images.md
|
||||||
// TODO(dchen1107): Which image the container is running with?
|
// TODO(dchen1107): Which image the container is running with?
|
||||||
|
@ -1423,7 +1423,7 @@ type ReplicationControllerSpec struct {
|
||||||
// This is a pointer to distinguish between explicit zero and unspecified.
|
// This is a pointer to distinguish between explicit zero and unspecified.
|
||||||
// Defaults to 1.
|
// Defaults to 1.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller
|
||||||
Replicas *int `json:"replicas,omitempty"`
|
Replicas *int32 `json:"replicas,omitempty"`
|
||||||
|
|
||||||
// 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.
|
||||||
// If Selector is empty, it is defaulted to the labels present on the Pod template.
|
// If Selector is empty, it is defaulted to the labels present on the Pod template.
|
||||||
|
@ -1448,7 +1448,7 @@ type ReplicationControllerSpec struct {
|
||||||
type ReplicationControllerStatus struct {
|
type ReplicationControllerStatus struct {
|
||||||
// Replicas is the most recently oberved number of replicas.
|
// Replicas is the most recently oberved number of replicas.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller
|
||||||
Replicas int `json:"replicas"`
|
Replicas int32 `json:"replicas"`
|
||||||
|
|
||||||
// ObservedGeneration reflects the generation of the most recently observed replication controller.
|
// ObservedGeneration reflects the generation of the most recently observed replication controller.
|
||||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||||
|
@ -1612,7 +1612,7 @@ type ServicePort struct {
|
||||||
Protocol Protocol `json:"protocol,omitempty"`
|
Protocol Protocol `json:"protocol,omitempty"`
|
||||||
|
|
||||||
// The port that will be exposed by this service.
|
// The port that will be exposed by this service.
|
||||||
Port int `json:"port"`
|
Port int32 `json:"port"`
|
||||||
|
|
||||||
// Number or name of the port to access on the pods targeted by the service.
|
// Number or name of the port to access on the pods targeted by the service.
|
||||||
// Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
|
// Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
|
||||||
|
@ -1628,7 +1628,7 @@ type ServicePort struct {
|
||||||
// if unused or else creation of the service will fail.
|
// if unused or else creation of the service will fail.
|
||||||
// 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.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#type--nodeport
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/services.md#type--nodeport
|
||||||
NodePort int `json:"nodePort,omitempty"`
|
NodePort int32 `json:"nodePort,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Service is a named abstraction of software service (for example, mysql) consisting of local port
|
// Service is a named abstraction of software service (for example, mysql) consisting of local port
|
||||||
|
@ -1771,7 +1771,7 @@ type EndpointPort struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
|
|
||||||
// The port number of the endpoint.
|
// The port number of the endpoint.
|
||||||
Port int `json:"port"`
|
Port int32 `json:"port"`
|
||||||
|
|
||||||
// The IP protocol for this port.
|
// The IP protocol for this port.
|
||||||
// Must be UDP or TCP.
|
// Must be UDP or TCP.
|
||||||
|
@ -1807,7 +1807,7 @@ type NodeSpec struct {
|
||||||
// DaemonEndpoint contains information about a single Daemon endpoint.
|
// DaemonEndpoint contains information about a single Daemon endpoint.
|
||||||
type DaemonEndpoint struct {
|
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.
|
||||||
|
@ -2258,7 +2258,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"`
|
||||||
|
|
|
@ -880,8 +880,9 @@ func validateProbe(probe *api.Probe) validation.ErrorList {
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
allErrs = append(allErrs, validateHandler(&probe.Handler)...)
|
allErrs = append(allErrs, validateHandler(&probe.Handler)...)
|
||||||
allErrs = append(allErrs, ValidatePositiveField(probe.InitialDelaySeconds, "initialDelaySeconds")...)
|
|
||||||
allErrs = append(allErrs, ValidatePositiveField(probe.TimeoutSeconds, "timeoutSeconds")...)
|
allErrs = append(allErrs, ValidatePositiveField(int64(probe.InitialDelaySeconds), "initialDelaySeconds")...)
|
||||||
|
allErrs = append(allErrs, ValidatePositiveField(int64(probe.TimeoutSeconds), "timeoutSeconds")...)
|
||||||
allErrs = append(allErrs, ValidatePositiveField(int64(probe.PeriodSeconds), "periodSeconds")...)
|
allErrs = append(allErrs, ValidatePositiveField(int64(probe.PeriodSeconds), "periodSeconds")...)
|
||||||
allErrs = append(allErrs, ValidatePositiveField(int64(probe.SuccessThreshold), "successThreshold")...)
|
allErrs = append(allErrs, ValidatePositiveField(int64(probe.SuccessThreshold), "successThreshold")...)
|
||||||
allErrs = append(allErrs, ValidatePositiveField(int64(probe.FailureThreshold), "failureThreshold")...)
|
allErrs = append(allErrs, ValidatePositiveField(int64(probe.FailureThreshold), "failureThreshold")...)
|
||||||
|
@ -932,7 +933,7 @@ func validateHTTPGetAction(http *api.HTTPGetAction) validation.ErrorList {
|
||||||
if len(http.Path) == 0 {
|
if len(http.Path) == 0 {
|
||||||
allErrors = append(allErrors, validation.NewRequiredError("path"))
|
allErrors = append(allErrors, validation.NewRequiredError("path"))
|
||||||
}
|
}
|
||||||
if http.Port.Type == intstr.Int && !validation.IsValidPortNum(http.Port.IntVal) {
|
if http.Port.Type == intstr.Int && !validation.IsValidPortNum(http.Port.IntValue()) {
|
||||||
allErrors = append(allErrors, validation.NewInvalidError("port", http.Port, PortRangeErrorMsg))
|
allErrors = append(allErrors, validation.NewInvalidError("port", http.Port, PortRangeErrorMsg))
|
||||||
} else if http.Port.Type == intstr.String && !validation.IsValidPortName(http.Port.StrVal) {
|
} else if http.Port.Type == intstr.String && !validation.IsValidPortName(http.Port.StrVal) {
|
||||||
allErrors = append(allErrors, validation.NewInvalidError("port", http.Port.StrVal, PortNameErrorMsg))
|
allErrors = append(allErrors, validation.NewInvalidError("port", http.Port.StrVal, PortNameErrorMsg))
|
||||||
|
@ -946,7 +947,7 @@ func validateHTTPGetAction(http *api.HTTPGetAction) validation.ErrorList {
|
||||||
|
|
||||||
func validateTCPSocketAction(tcp *api.TCPSocketAction) validation.ErrorList {
|
func validateTCPSocketAction(tcp *api.TCPSocketAction) validation.ErrorList {
|
||||||
allErrors := validation.ErrorList{}
|
allErrors := validation.ErrorList{}
|
||||||
if tcp.Port.Type == intstr.Int && !validation.IsValidPortNum(tcp.Port.IntVal) {
|
if tcp.Port.Type == intstr.Int && !validation.IsValidPortNum(tcp.Port.IntValue()) {
|
||||||
allErrors = append(allErrors, validation.NewInvalidError("port", tcp.Port, PortRangeErrorMsg))
|
allErrors = append(allErrors, validation.NewInvalidError("port", tcp.Port, PortRangeErrorMsg))
|
||||||
} else if tcp.Port.Type == intstr.String && !validation.IsValidPortName(tcp.Port.StrVal) {
|
} else if tcp.Port.Type == intstr.String && !validation.IsValidPortName(tcp.Port.StrVal) {
|
||||||
allErrors = append(allErrors, validation.NewInvalidError("port", tcp.Port.StrVal, PortNameErrorMsg))
|
allErrors = append(allErrors, validation.NewInvalidError("port", tcp.Port.StrVal, PortNameErrorMsg))
|
||||||
|
@ -1333,7 +1334,7 @@ func validateServicePort(sp *api.ServicePort, requireName bool, allNames *sets.S
|
||||||
allErrs = append(allErrs, validation.NewNotSupportedError("protocol", sp.Protocol, supportedPortProtocols.List()))
|
allErrs = append(allErrs, validation.NewNotSupportedError("protocol", sp.Protocol, supportedPortProtocols.List()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if sp.TargetPort.Type == intstr.Int && !validation.IsValidPortNum(sp.TargetPort.IntVal) {
|
if sp.TargetPort.Type == intstr.Int && !validation.IsValidPortNum(sp.TargetPort.IntValue()) {
|
||||||
allErrs = append(allErrs, validation.NewInvalidError("targetPort", sp.TargetPort, PortRangeErrorMsg))
|
allErrs = append(allErrs, validation.NewInvalidError("targetPort", sp.TargetPort, PortRangeErrorMsg))
|
||||||
}
|
}
|
||||||
if sp.TargetPort.Type == intstr.String && !validation.IsValidPortName(sp.TargetPort.StrVal) {
|
if sp.TargetPort.Type == intstr.String && !validation.IsValidPortName(sp.TargetPort.StrVal) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ func addDefaultingFuncs() {
|
||||||
obj.HealthzBindAddress = "127.0.0.1"
|
obj.HealthzBindAddress = "127.0.0.1"
|
||||||
}
|
}
|
||||||
if obj.OOMScoreAdj == nil {
|
if obj.OOMScoreAdj == nil {
|
||||||
temp := qos.KubeProxyOOMScoreAdj
|
temp := int32(qos.KubeProxyOOMScoreAdj)
|
||||||
obj.OOMScoreAdj = &temp
|
obj.OOMScoreAdj = &temp
|
||||||
}
|
}
|
||||||
if obj.IPTablesSyncePeriodSeconds == 0 {
|
if obj.IPTablesSyncePeriodSeconds == 0 {
|
||||||
|
|
|
@ -21,22 +21,22 @@ import "k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
type KubeProxyConfiguration struct {
|
type KubeProxyConfiguration struct {
|
||||||
unversioned.TypeMeta
|
unversioned.TypeMeta
|
||||||
|
|
||||||
// bindAddress is the IP address for the proxy server to serve on (set to 0.0.0.0 for all interfaces)
|
// bindAddress is the IP address for the proxy server to serve on (set to 0.0.0.0 for all int32erfaces)
|
||||||
BindAddress string `json:"bindAddress"`
|
BindAddress string `json:"bindAddress"`
|
||||||
// cleanupIPTables
|
// cleanupIPTables
|
||||||
CleanupIPTables bool `json:"cleanupIPTables"`
|
CleanupIPTables bool `json:"cleanupIPTables"`
|
||||||
// healthzBindAddress is 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)
|
// healthzBindAddress is 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 int32erfaces)
|
||||||
HealthzBindAddress string `json:"healthzBindAddress"`
|
HealthzBindAddress string `json:"healthzBindAddress"`
|
||||||
// healthzPort is the port to bind the health check server. Use 0 to disable.
|
// healthzPort is the port to bind the health check server. Use 0 to disable.
|
||||||
HealthzPort int `json:"healthzPort"`
|
HealthzPort int32 `json:"healthzPort"`
|
||||||
// hostnameOverride, if non-empty, will be used as the identity instead of the actual hostname.
|
// hostnameOverride, if non-empty, will be used as the identity instead of the actual hostname.
|
||||||
HostnameOverride string `json:"hostnameOverride"`
|
HostnameOverride string `json:"hostnameOverride"`
|
||||||
// iptablesSyncPeriodSeconds is the period that iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.
|
// iptablesSyncPeriodSeconds is the period that iptables rules are refreshed (e.g. '5s', '1m', '2h22m'). Must be greater than 0.
|
||||||
IPTablesSyncePeriodSeconds int `json:"iptablesSyncPeriodSeconds"`
|
IPTablesSyncePeriodSeconds int32 `json:"iptablesSyncPeriodSeconds"`
|
||||||
// kubeAPIBurst is the burst to use while talking with kubernetes apiserver
|
// kubeAPIBurst is the burst to use while talking with kubernetes apiserver
|
||||||
KubeAPIBurst int `json:"kubeAPIBurst"`
|
KubeAPIBurst int32 `json:"kubeAPIBurst"`
|
||||||
// kubeAPIQPS is the max QPS to use while talking with kubernetes apiserver
|
// kubeAPIQPS is the max QPS to use while talking with kubernetes apiserver
|
||||||
KubeAPIQPS int `json:"kubeAPIQPS"`
|
KubeAPIQPS int32 `json:"kubeAPIQPS"`
|
||||||
// kubeconfigPath is the path to the kubeconfig file with authorization information (the master location is set by the master flag).
|
// kubeconfigPath is the path to the kubeconfig file with authorization information (the master location is set by the master flag).
|
||||||
KubeconfigPath string `json:"kubeconfigPath"`
|
KubeconfigPath string `json:"kubeconfigPath"`
|
||||||
// masqueradeAll tells kube-proxy to SNAT everything if using the pure iptables proxy mode.
|
// masqueradeAll tells kube-proxy to SNAT everything if using the pure iptables proxy mode.
|
||||||
|
@ -44,7 +44,7 @@ type KubeProxyConfiguration struct {
|
||||||
// master is the address of the Kubernetes API server (overrides any value in kubeconfig)
|
// master is the address of the Kubernetes API server (overrides any value in kubeconfig)
|
||||||
Master string `json:"master"`
|
Master string `json:"master"`
|
||||||
// oomScoreAdj is the oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]
|
// oomScoreAdj is the oom-score-adj value for kube-proxy process. Values must be within the range [-1000, 1000]
|
||||||
OOMScoreAdj *int `json:"oomScoreAdj"`
|
OOMScoreAdj *int32 `json:"oomScoreAdj"`
|
||||||
// mode specifies which proxy mode to use.
|
// mode specifies which proxy mode to use.
|
||||||
Mode ProxyMode `json:"mode"`
|
Mode ProxyMode `json:"mode"`
|
||||||
// portRange is the 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.
|
// portRange is the 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.
|
||||||
|
@ -52,7 +52,7 @@ type KubeProxyConfiguration struct {
|
||||||
// resourceContainer is the bsolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).
|
// resourceContainer is the bsolute name of the resource-only container to create and run the Kube-proxy in (Default: /kube-proxy).
|
||||||
ResourceContainer string `json:"resourceContainer"`
|
ResourceContainer string `json:"resourceContainer"`
|
||||||
// udpTimeoutMilliseconds is how long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxyMode=userspace.
|
// udpTimeoutMilliseconds is how long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxyMode=userspace.
|
||||||
UDPTimeoutMilliseconds int `json:"udpTimeoutMilliseconds"`
|
UDPTimeoutMilliseconds int32 `json:"udpTimeoutMilliseconds"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently two modes of proxying are available: 'userspace' (older, stable) or 'iptables' (experimental). If blank, look at the Node object on the Kubernetes API and respect the 'net.experimental.kubernetes.io/proxy-mode' annotation if provided. Otherwise use the best-available proxy (currently userspace, but may change in future versions). 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.
|
// Currently two modes of proxying are available: 'userspace' (older, stable) or 'iptables' (experimental). If blank, look at the Node object on the Kubernetes API and respect the 'net.experimental.kubernetes.io/proxy-mode' annotation if provided. Otherwise use the best-available proxy (currently userspace, but may change in future versions). 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.
|
||||||
|
|
|
@ -203,8 +203,8 @@ 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(int)
|
out.Replicas = new(int32)
|
||||||
*out.Replicas = in.Replicas
|
*out.Replicas = int32(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 {
|
||||||
|
@ -229,7 +229,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 = *in.Replicas
|
out.Replicas = int(*in.Replicas)
|
||||||
}
|
}
|
||||||
if in.Selector != nil {
|
if in.Selector != nil {
|
||||||
out.Selector = make(map[string]string)
|
out.Selector = make(map[string]string)
|
||||||
|
@ -299,7 +299,7 @@ func convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployme
|
||||||
if err := s.Convert(&in.MaxSurge, out.MaxSurge, 0); err != nil {
|
if err := s.Convert(&in.MaxSurge, out.MaxSurge, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
out.MinReadySeconds = in.MinReadySeconds
|
out.MinReadySeconds = int32(in.MinReadySeconds)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ func convert_v1beta1_RollingUpdateDeployment_To_extensions_RollingUpdateDeployme
|
||||||
if err := s.Convert(in.MaxSurge, &out.MaxSurge, 0); err != nil {
|
if err := s.Convert(in.MaxSurge, &out.MaxSurge, 0); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
out.MinReadySeconds = in.MinReadySeconds
|
out.MinReadySeconds = int(in.MinReadySeconds)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ func addDefaultingFuncs() {
|
||||||
}
|
}
|
||||||
// Set DeploymentSpec.Replicas to 1 if it is not set.
|
// Set DeploymentSpec.Replicas to 1 if it is not set.
|
||||||
if obj.Spec.Replicas == nil {
|
if obj.Spec.Replicas == nil {
|
||||||
obj.Spec.Replicas = new(int)
|
obj.Spec.Replicas = new(int32)
|
||||||
*obj.Spec.Replicas = 1
|
*obj.Spec.Replicas = 1
|
||||||
}
|
}
|
||||||
strategy := &obj.Spec.Strategy
|
strategy := &obj.Spec.Strategy
|
||||||
|
@ -102,7 +102,7 @@ func addDefaultingFuncs() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if obj.Spec.Completions == nil {
|
if obj.Spec.Completions == nil {
|
||||||
completions := 1
|
completions := int32(1)
|
||||||
obj.Spec.Completions = &completions
|
obj.Spec.Completions = &completions
|
||||||
}
|
}
|
||||||
if obj.Spec.Parallelism == nil {
|
if obj.Spec.Parallelism == nil {
|
||||||
|
@ -111,7 +111,7 @@ func addDefaultingFuncs() {
|
||||||
},
|
},
|
||||||
func(obj *HorizontalPodAutoscaler) {
|
func(obj *HorizontalPodAutoscaler) {
|
||||||
if obj.Spec.MinReplicas == nil {
|
if obj.Spec.MinReplicas == nil {
|
||||||
minReplicas := 1
|
minReplicas := int32(1)
|
||||||
obj.Spec.MinReplicas = &minReplicas
|
obj.Spec.MinReplicas = &minReplicas
|
||||||
}
|
}
|
||||||
if obj.Spec.CPUUtilization == nil {
|
if obj.Spec.CPUUtilization == nil {
|
||||||
|
|
|
@ -25,13 +25,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. More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors
|
// label query over pods that should match the replicas count. More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors
|
||||||
Selector map[string]string `json:"selector,omitempty"`
|
Selector map[string]string `json:"selector,omitempty"`
|
||||||
|
@ -70,7 +70,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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// specification of a horizontal pod autoscaler.
|
// specification of a horizontal pod autoscaler.
|
||||||
|
@ -79,9 +79,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; cannot be smaller than MinReplicas.
|
// upper limit for the number of pods that can be set by the autoscaler; 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"`
|
||||||
|
@ -97,14 +97,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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// configuration of a horizontal pod autoscaler.
|
// configuration of a horizontal pod autoscaler.
|
||||||
|
@ -192,7 +192,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 ReplicationControllers whose pods are
|
// Label selector for pods. Existing ReplicationControllers 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.
|
||||||
|
@ -268,16 +268,16 @@ type RollingUpdateDeployment 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeploymentStatus is the most recently observed status of the Deployment.
|
// DeploymentStatus is the most recently observed status of the Deployment.
|
||||||
type DeploymentStatus struct {
|
type DeploymentStatus struct {
|
||||||
// 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeploymentList is a list of Deployments.
|
// DeploymentList is a list of Deployments.
|
||||||
|
@ -311,17 +311,17 @@ 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.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
|
// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
|
||||||
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.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
|
// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
|
||||||
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).
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
|
// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
|
||||||
DesiredNumberScheduled int `json:"desiredNumberScheduled"`
|
DesiredNumberScheduled int32 `json:"desiredNumberScheduled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DaemonSet represents the configuration of a daemon set.
|
// DaemonSet represents the configuration of a daemon set.
|
||||||
|
@ -400,12 +400,12 @@ type JobSpec struct {
|
||||||
// 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.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md
|
||||||
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. Defaults to 1.
|
// job should be run with. Defaults to 1.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md
|
||||||
Completions *int `json:"completions,omitempty"`
|
Completions *int32 `json:"completions,omitempty"`
|
||||||
|
|
||||||
// Selector is a label query over pods that should match the pod count.
|
// Selector is a label query over pods that should match the pod 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
|
||||||
|
@ -435,13 +435,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
|
||||||
|
@ -621,10 +621,10 @@ type NodeUtilization struct {
|
||||||
// Configuration of the Cluster Autoscaler
|
// Configuration of the Cluster Autoscaler
|
||||||
type ClusterAutoscalerSpec struct {
|
type ClusterAutoscalerSpec struct {
|
||||||
// Minimum number of nodes that the cluster should have.
|
// Minimum number of nodes that the cluster should have.
|
||||||
MinNodes int `json:"minNodes"`
|
MinNodes int32 `json:"minNodes"`
|
||||||
|
|
||||||
// Maximum number of nodes that the cluster should have.
|
// Maximum number of nodes that the cluster should have.
|
||||||
MaxNodes int `json:"maxNodes"`
|
MaxNodes int32 `json:"maxNodes"`
|
||||||
|
|
||||||
// Target average utilization of the cluster nodes. New nodes will be added if one of the
|
// Target average utilization of the cluster nodes. New nodes will be added if one of the
|
||||||
// targets is exceeded. Cluster size will be decreased if the current utilization is too low
|
// targets is exceeded. Cluster size will be decreased if the current utilization is too low
|
||||||
|
|
|
@ -249,7 +249,7 @@ func getIntOrPercentValue(intOrStringValue intstr.IntOrString) int {
|
||||||
if isPercent {
|
if isPercent {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
return intOrStringValue.IntVal
|
return intOrStringValue.IntValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsNotMoreThan100Percent(intOrStringValue intstr.IntOrString, fieldName string) validation.ErrorList {
|
func IsNotMoreThan100Percent(intOrStringValue intstr.IntOrString, fieldName string) validation.ErrorList {
|
||||||
|
@ -525,7 +525,7 @@ func validateIngressBackend(backend *extensions.IngressBackend) validation.Error
|
||||||
if !validation.IsValidPortName(backend.ServicePort.StrVal) {
|
if !validation.IsValidPortName(backend.ServicePort.StrVal) {
|
||||||
allErrs = append(allErrs, validation.NewInvalidError("servicePort", backend.ServicePort.StrVal, apivalidation.PortNameErrorMsg))
|
allErrs = append(allErrs, validation.NewInvalidError("servicePort", backend.ServicePort.StrVal, apivalidation.PortNameErrorMsg))
|
||||||
}
|
}
|
||||||
} else if !validation.IsValidPortNum(backend.ServicePort.IntVal) {
|
} else if !validation.IsValidPortNum(backend.ServicePort.IntValue()) {
|
||||||
allErrs = append(allErrs, validation.NewInvalidError("servicePort", backend.ServicePort, apivalidation.PortRangeErrorMsg))
|
allErrs = append(allErrs, validation.NewInvalidError("servicePort", backend.ServicePort, apivalidation.PortRangeErrorMsg))
|
||||||
}
|
}
|
||||||
return allErrs
|
return allErrs
|
||||||
|
|
|
@ -420,8 +420,9 @@ func prettyJSON(codec runtime.Codec, object runtime.Object, w http.ResponseWrite
|
||||||
// errorJSON renders an error to the response. Returns the HTTP status code of the error.
|
// errorJSON renders an error to the response. Returns the HTTP status code of the error.
|
||||||
func errorJSON(err error, codec runtime.Codec, w http.ResponseWriter) int {
|
func errorJSON(err error, codec runtime.Codec, w http.ResponseWriter) int {
|
||||||
status := errToAPIStatus(err)
|
status := errToAPIStatus(err)
|
||||||
writeJSON(status.Code, codec, status, w, true)
|
code := int(status.Code)
|
||||||
return status.Code
|
writeJSON(code, codec, status, w, true)
|
||||||
|
return code
|
||||||
}
|
}
|
||||||
|
|
||||||
// errorJSONFatal renders an error to the response, and if codec fails will render plaintext.
|
// errorJSONFatal renders an error to the response, and if codec fails will render plaintext.
|
||||||
|
@ -429,16 +430,17 @@ func errorJSON(err error, codec runtime.Codec, w http.ResponseWriter) int {
|
||||||
func errorJSONFatal(err error, codec runtime.Codec, w http.ResponseWriter) int {
|
func errorJSONFatal(err error, codec runtime.Codec, w http.ResponseWriter) int {
|
||||||
util.HandleError(fmt.Errorf("apiserver was unable to write a JSON response: %v", err))
|
util.HandleError(fmt.Errorf("apiserver was unable to write a JSON response: %v", err))
|
||||||
status := errToAPIStatus(err)
|
status := errToAPIStatus(err)
|
||||||
|
code := int(status.Code)
|
||||||
output, err := codec.Encode(status)
|
output, err := codec.Encode(status)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(status.Code)
|
w.WriteHeader(code)
|
||||||
fmt.Fprintf(w, "%s: %s", status.Reason, status.Message)
|
fmt.Fprintf(w, "%s: %s", status.Reason, status.Message)
|
||||||
return status.Code
|
return code
|
||||||
}
|
}
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.WriteHeader(status.Code)
|
w.WriteHeader(code)
|
||||||
w.Write(output)
|
w.Write(output)
|
||||||
return status.Code
|
return code
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeRawJSON writes a non-API object in JSON.
|
// writeRawJSON writes a non-API object in JSON.
|
||||||
|
|
|
@ -62,7 +62,7 @@ func errToAPIStatus(err error) *unversioned.Status {
|
||||||
util.HandleError(fmt.Errorf("apiserver received an error that is not an unversioned.Status: %v", err))
|
util.HandleError(fmt.Errorf("apiserver received an error that is not an unversioned.Status: %v", err))
|
||||||
return &unversioned.Status{
|
return &unversioned.Status{
|
||||||
Status: unversioned.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: status,
|
Code: int32(status),
|
||||||
Reason: unversioned.StatusReasonUnknown,
|
Reason: unversioned.StatusReasonUnknown,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,8 +109,9 @@ func (r *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
httplog.LogOf(req, w).Addf("Error getting ResourceLocation: %v", err)
|
httplog.LogOf(req, w).Addf("Error getting ResourceLocation: %v", err)
|
||||||
status := errToAPIStatus(err)
|
status := errToAPIStatus(err)
|
||||||
writeJSON(status.Code, r.codec, status, w, true)
|
code := int(status.Code)
|
||||||
httpCode = status.Code
|
writeJSON(code, r.codec, status, w, true)
|
||||||
|
httpCode = code
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if location == nil {
|
if location == nil {
|
||||||
|
@ -144,9 +145,10 @@ func (r *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
newReq, err := http.NewRequest(req.Method, location.String(), req.Body)
|
newReq, err := http.NewRequest(req.Method, location.String(), req.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
status := errToAPIStatus(err)
|
status := errToAPIStatus(err)
|
||||||
writeJSON(status.Code, r.codec, status, w, true)
|
code := int(status.Code)
|
||||||
|
writeJSON(code, r.codec, status, w, true)
|
||||||
notFound(w, req)
|
notFound(w, req)
|
||||||
httpCode = status.Code
|
httpCode = code
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
httpCode = http.StatusOK
|
httpCode = http.StatusOK
|
||||||
|
@ -211,7 +213,8 @@ func (r *ProxyHandler) tryUpgrade(w http.ResponseWriter, req, newReq *http.Reque
|
||||||
backendConn, err := proxyutil.DialURL(location, transport)
|
backendConn, err := proxyutil.DialURL(location, transport)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
status := errToAPIStatus(err)
|
status := errToAPIStatus(err)
|
||||||
writeJSON(status.Code, r.codec, status, w, true)
|
code := int(status.Code)
|
||||||
|
writeJSON(code, r.codec, status, w, true)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
defer backendConn.Close()
|
defer backendConn.Close()
|
||||||
|
@ -222,14 +225,16 @@ func (r *ProxyHandler) tryUpgrade(w http.ResponseWriter, req, newReq *http.Reque
|
||||||
requestHijackedConn, _, err := w.(http.Hijacker).Hijack()
|
requestHijackedConn, _, err := w.(http.Hijacker).Hijack()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
status := errToAPIStatus(err)
|
status := errToAPIStatus(err)
|
||||||
writeJSON(status.Code, r.codec, status, w, true)
|
code := int(status.Code)
|
||||||
|
writeJSON(code, r.codec, status, w, true)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
defer requestHijackedConn.Close()
|
defer requestHijackedConn.Close()
|
||||||
|
|
||||||
if err = newReq.Write(backendConn); err != nil {
|
if err = newReq.Write(backendConn); err != nil {
|
||||||
status := errToAPIStatus(err)
|
status := errToAPIStatus(err)
|
||||||
writeJSON(status.Code, r.codec, status, w, true)
|
code := int(status.Code)
|
||||||
|
writeJSON(code, r.codec, status, w, true)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ func findPort(pod *api.Pod, svcPort *api.ServicePort) (int, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case intstr.Int:
|
case intstr.Int:
|
||||||
return portName.IntVal, nil
|
return portName.IntValue(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0, fmt.Errorf("no suitable port for manifest: %s", pod.UID)
|
return 0, fmt.Errorf("no suitable port for manifest: %s", pod.UID)
|
||||||
|
|
|
@ -489,7 +489,7 @@ func extractMaxValue(field intstr.IntOrString, name string, value int) (int, err
|
||||||
if field.IntVal < 0 {
|
if field.IntVal < 0 {
|
||||||
return 0, fmt.Errorf("%s must be >= 0", name)
|
return 0, fmt.Errorf("%s must be >= 0", name)
|
||||||
}
|
}
|
||||||
return field.IntVal, nil
|
return field.IntValue(), nil
|
||||||
case intstr.String:
|
case intstr.String:
|
||||||
s := strings.Replace(field.StrVal, "%", "", -1)
|
s := strings.Replace(field.StrVal, "%", "", -1)
|
||||||
v, err := strconv.Atoi(s)
|
v, err := strconv.Atoi(s)
|
||||||
|
|
|
@ -68,19 +68,17 @@ func (hr *HandlerRunner) Run(containerID kubecontainer.ContainerID, pod *api.Pod
|
||||||
// port is found, an error is returned.
|
// port is found, an error is returned.
|
||||||
func resolvePort(portReference intstr.IntOrString, container *api.Container) (int, error) {
|
func resolvePort(portReference intstr.IntOrString, container *api.Container) (int, error) {
|
||||||
if portReference.Type == intstr.Int {
|
if portReference.Type == intstr.Int {
|
||||||
return portReference.IntVal, nil
|
return portReference.IntValue(), nil
|
||||||
} else {
|
}
|
||||||
portName := portReference.StrVal
|
portName := portReference.StrVal
|
||||||
port, err := strconv.Atoi(portName)
|
port, err := strconv.Atoi(portName)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return port, nil
|
return port, nil
|
||||||
|
}
|
||||||
|
for _, portSpec := range container.Ports {
|
||||||
|
if portSpec.Name == portName {
|
||||||
|
return portSpec.ContainerPort, nil
|
||||||
}
|
}
|
||||||
for _, portSpec := range container.Ports {
|
|
||||||
if portSpec.Name == portName {
|
|
||||||
return 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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ func extractPort(param intstr.IntOrString, container api.Container) (int, error)
|
||||||
var err error
|
var err error
|
||||||
switch param.Type {
|
switch param.Type {
|
||||||
case intstr.Int:
|
case intstr.Int:
|
||||||
port = param.IntVal
|
port = param.IntValue()
|
||||||
case intstr.String:
|
case intstr.String:
|
||||||
if port, err = findPortByName(container, param.StrVal); err != nil {
|
if port, err = findPortByName(container, param.StrVal); err != nil {
|
||||||
// Last ditch effort - maybe it was an int stored as string?
|
// Last ditch effort - maybe it was an int stored as string?
|
||||||
|
|
|
@ -163,7 +163,7 @@ func (w *worker) doProbe() (keepGoing bool) {
|
||||||
w.pod.Spec.RestartPolicy != api.RestartPolicyNever
|
w.pod.Spec.RestartPolicy != api.RestartPolicyNever
|
||||||
}
|
}
|
||||||
|
|
||||||
if int64(time.Since(c.State.Running.StartedAt.Time).Seconds()) < w.spec.InitialDelaySeconds {
|
if int(time.Since(c.State.Running.StartedAt.Time).Seconds()) < w.spec.InitialDelaySeconds {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,13 @@ import (
|
||||||
"github.com/google/gofuzz"
|
"github.com/google/gofuzz"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IntOrString is a type that can hold an int or a string. When used in
|
// IntOrString is a type that can hold an int32 or a string. When used in
|
||||||
// JSON or YAML marshalling and unmarshalling, it produces or consumes the
|
// JSON or YAML marshalling and unmarshalling, it produces or consumes the
|
||||||
// inner type. This allows you to have, for example, a JSON field that can
|
// inner type. This allows you to have, for example, a JSON field that can
|
||||||
// accept a name or number.
|
// accept a name or number.
|
||||||
type IntOrString struct {
|
type IntOrString struct {
|
||||||
Type Type
|
Type Type
|
||||||
IntVal int
|
IntVal int32
|
||||||
StrVal string
|
StrVal string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ const (
|
||||||
|
|
||||||
// FromInt creates an IntOrString object with an int value.
|
// FromInt creates an IntOrString object with an int value.
|
||||||
func FromInt(val int) IntOrString {
|
func FromInt(val int) IntOrString {
|
||||||
return IntOrString{Type: Int, IntVal: val}
|
return IntOrString{Type: Int, IntVal: int32(val)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FromString creates an IntOrString object with a string value.
|
// FromString creates an IntOrString object with a string value.
|
||||||
|
@ -67,7 +67,17 @@ func (intstr *IntOrString) String() string {
|
||||||
if intstr.Type == String {
|
if intstr.Type == String {
|
||||||
return intstr.StrVal
|
return intstr.StrVal
|
||||||
}
|
}
|
||||||
return strconv.Itoa(intstr.IntVal)
|
return strconv.Itoa(intstr.IntValue())
|
||||||
|
}
|
||||||
|
|
||||||
|
// IntValue returns the IntVal cast as int32 if type Int, or if
|
||||||
|
// it is a String, will attempt a conversion to int.
|
||||||
|
func (intstr *IntOrString) IntValue() int {
|
||||||
|
if intstr.Type == String {
|
||||||
|
i, _ := strconv.Atoi(intstr.StrVal)
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
return int(intstr.IntVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalJSON implements the json.Marshaller interface.
|
// MarshalJSON implements the json.Marshaller interface.
|
||||||
|
|
|
@ -136,14 +136,14 @@ func Until(f func(), period time.Duration, stopCh <-chan struct{}) {
|
||||||
func GetIntOrPercentValue(intOrStr *intstr.IntOrString) (int, bool, error) {
|
func GetIntOrPercentValue(intOrStr *intstr.IntOrString) (int, bool, error) {
|
||||||
switch intOrStr.Type {
|
switch intOrStr.Type {
|
||||||
case intstr.Int:
|
case intstr.Int:
|
||||||
return intOrStr.IntVal, false, nil
|
return intOrStr.IntValue(), false, nil
|
||||||
case intstr.String:
|
case intstr.String:
|
||||||
s := strings.Replace(intOrStr.StrVal, "%", "", -1)
|
s := strings.Replace(intOrStr.StrVal, "%", "", -1)
|
||||||
v, err := strconv.Atoi(s)
|
v, err := strconv.Atoi(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, false, fmt.Errorf("invalid value %q: %v", intOrStr.StrVal, err)
|
return 0, false, fmt.Errorf("invalid value %q: %v", intOrStr.StrVal, err)
|
||||||
}
|
}
|
||||||
return v, true, nil
|
return int(v), true, nil
|
||||||
}
|
}
|
||||||
return 0, false, fmt.Errorf("invalid value: neither int nor percentage")
|
return 0, false, fmt.Errorf("invalid value: neither int nor percentage")
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,7 +616,7 @@ var _ = Describe("Kubectl client", func() {
|
||||||
if port.Port != servicePort {
|
if port.Port != servicePort {
|
||||||
Failf("Wrong service port: %d", port.Port)
|
Failf("Wrong service port: %d", port.Port)
|
||||||
}
|
}
|
||||||
if port.TargetPort.IntVal != redisPort {
|
if port.TargetPort.IntValue() != redisPort {
|
||||||
Failf("Wrong target port: %d")
|
Failf("Wrong target port: %d")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue