Update staging files

This commit is contained in:
Timothy St. Clair 2017-04-11 08:51:42 -05:00
parent 442713aaaf
commit fc04bba10e
26 changed files with 1911 additions and 1336 deletions

View File

@ -0,0 +1,67 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package api
const (
// TolerationsAnnotationKey represents the key of tolerations data (json serialized)
// in the Annotations of a Pod.
TolerationsAnnotationKey string = "scheduler.alpha.kubernetes.io/tolerations"
// TaintsAnnotationKey represents the key of taints data (json serialized)
// in the Annotations of a Node.
TaintsAnnotationKey string = "scheduler.alpha.kubernetes.io/taints"
// SeccompPodAnnotationKey represents the key of a seccomp profile applied
// to all containers of a pod.
SeccompPodAnnotationKey string = "seccomp.security.alpha.kubernetes.io/pod"
// SeccompContainerAnnotationKeyPrefix represents the key of a seccomp profile applied
// to one container of a pod.
SeccompContainerAnnotationKeyPrefix string = "container.seccomp.security.alpha.kubernetes.io/"
// CreatedByAnnotation represents the key used to store the spec(json)
// used to create the resource.
CreatedByAnnotation = "kubernetes.io/created-by"
// PreferAvoidPodsAnnotationKey represents the key of preferAvoidPods data (json serialized)
// in the Annotations of a Node.
PreferAvoidPodsAnnotationKey string = "scheduler.alpha.kubernetes.io/preferAvoidPods"
// SysctlsPodAnnotationKey represents the key of sysctls which are set for the infrastructure
// container of a pod. The annotation value is a comma separated list of sysctl_name=value
// key-value pairs. Only a limited set of whitelisted and isolated sysctls is supported by
// the kubelet. Pods with other sysctls will fail to launch.
SysctlsPodAnnotationKey string = "security.alpha.kubernetes.io/sysctls"
// UnsafeSysctlsPodAnnotationKey represents the key of sysctls which are set for the infrastructure
// container of a pod. The annotation value is a comma separated list of sysctl_name=value
// key-value pairs. Unsafe sysctls must be explicitly enabled for a kubelet. They are properly
// namespaced to a pod or a container, but their isolation is usually unclear or weak. Their use
// is at-your-own-risk. Pods that attempt to set an unsafe sysctl that is not enabled for a kubelet
// will fail to launch.
UnsafeSysctlsPodAnnotationKey string = "security.alpha.kubernetes.io/unsafe-sysctls"
// ObjectTTLAnnotations represents a suggestion for kubelet for how long it can cache
// an object (e.g. secret, config map) before fetching it again from apiserver.
// This annotation can be attached to node.
ObjectTTLAnnotationKey string = "node.alpha.kubernetes.io/ttl"
// AffinityAnnotationKey represents the key of affinity data (json serialized)
// in the Annotations of a Pod.
// TODO: remove when alpha support for affinity is removed
AffinityAnnotationKey string = "scheduler.alpha.kubernetes.io/affinity"
)

View File

@ -429,56 +429,6 @@ func NodeSelectorRequirementsAsSelector(nsm []NodeSelectorRequirement) (labels.S
return selector, nil return selector, nil
} }
const (
// TolerationsAnnotationKey represents the key of tolerations data (json serialized)
// in the Annotations of a Pod.
TolerationsAnnotationKey string = "scheduler.alpha.kubernetes.io/tolerations"
// TaintsAnnotationKey represents the key of taints data (json serialized)
// in the Annotations of a Node.
TaintsAnnotationKey string = "scheduler.alpha.kubernetes.io/taints"
// SeccompPodAnnotationKey represents the key of a seccomp profile applied
// to all containers of a pod.
SeccompPodAnnotationKey string = "seccomp.security.alpha.kubernetes.io/pod"
// SeccompContainerAnnotationKeyPrefix represents the key of a seccomp profile applied
// to one container of a pod.
SeccompContainerAnnotationKeyPrefix string = "container.seccomp.security.alpha.kubernetes.io/"
// CreatedByAnnotation represents the key used to store the spec(json)
// used to create the resource.
CreatedByAnnotation = "kubernetes.io/created-by"
// PreferAvoidPodsAnnotationKey represents the key of preferAvoidPods data (json serialized)
// in the Annotations of a Node.
PreferAvoidPodsAnnotationKey string = "scheduler.alpha.kubernetes.io/preferAvoidPods"
// SysctlsPodAnnotationKey represents the key of sysctls which are set for the infrastructure
// container of a pod. The annotation value is a comma separated list of sysctl_name=value
// key-value pairs. Only a limited set of whitelisted and isolated sysctls is supported by
// the kubelet. Pods with other sysctls will fail to launch.
SysctlsPodAnnotationKey string = "security.alpha.kubernetes.io/sysctls"
// UnsafeSysctlsPodAnnotationKey represents the key of sysctls which are set for the infrastructure
// container of a pod. The annotation value is a comma separated list of sysctl_name=value
// key-value pairs. Unsafe sysctls must be explicitly enabled for a kubelet. They are properly
// namespaced to a pod or a container, but their isolation is usually unclear or weak. Their use
// is at-your-own-risk. Pods that attempt to set an unsafe sysctl that is not enabled for a kubelet
// will fail to launch.
UnsafeSysctlsPodAnnotationKey string = "security.alpha.kubernetes.io/unsafe-sysctls"
// ObjectTTLAnnotations represents a suggestion for kubelet for how long it can cache
// an object (e.g. secret, config map) before fetching it again from apiserver.
// This annotation can be attached to node.
ObjectTTLAnnotationKey string = "node.alpha.kubernetes.io/ttl"
// AffinityAnnotationKey represents the key of affinity data (json serialized)
// in the Annotations of a Pod.
// TODO: remove when alpha support for affinity is removed
AffinityAnnotationKey string = "scheduler.alpha.kubernetes.io/affinity"
)
// GetTolerationsFromPodAnnotations gets the json serialized tolerations data from Pod.Annotations // GetTolerationsFromPodAnnotations gets the json serialized tolerations data from Pod.Annotations
// and converts it to the []Toleration type in api. // and converts it to the []Toleration type in api.
func GetTolerationsFromPodAnnotations(annotations map[string]string) ([]Toleration, error) { func GetTolerationsFromPodAnnotations(annotations map[string]string) ([]Toleration, error) {
@ -494,7 +444,7 @@ func GetTolerationsFromPodAnnotations(annotations map[string]string) ([]Tolerati
// AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list. // AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
// Returns true if something was updated, false otherwise. // Returns true if something was updated, false otherwise.
func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error) { func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) bool {
podTolerations := pod.Spec.Tolerations podTolerations := pod.Spec.Tolerations
var newTolerations []Toleration var newTolerations []Toleration
@ -502,7 +452,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
for i := range podTolerations { for i := range podTolerations {
if toleration.MatchToleration(&podTolerations[i]) { if toleration.MatchToleration(&podTolerations[i]) {
if Semantic.DeepEqual(toleration, podTolerations[i]) { if Semantic.DeepEqual(toleration, podTolerations[i]) {
return false, nil return false
} }
newTolerations = append(newTolerations, *toleration) newTolerations = append(newTolerations, *toleration)
updated = true updated = true
@ -517,7 +467,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
} }
pod.Spec.Tolerations = newTolerations pod.Spec.Tolerations = newTolerations
return true, nil return true
} }
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>, // MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,

View File

@ -17,6 +17,9 @@ limitations under the License.
package api package api
import ( import (
"fmt"
"math"
"strconv"
"time" "time"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
@ -227,3 +230,41 @@ func PodRequestsAndLimits(pod *Pod) (reqs map[ResourceName]resource.Quantity, li
} }
return return
} }
// ExtractContainerResourceValue extracts the value of a resource
// in an already known container
func ExtractContainerResourceValue(fs *ResourceFieldSelector, container *Container) (string, error) {
divisor := resource.Quantity{}
if divisor.Cmp(fs.Divisor) == 0 {
divisor = resource.MustParse("1")
} else {
divisor = fs.Divisor
}
switch fs.Resource {
case "limits.cpu":
return convertResourceCPUToString(container.Resources.Limits.Cpu(), divisor)
case "limits.memory":
return convertResourceMemoryToString(container.Resources.Limits.Memory(), divisor)
case "requests.cpu":
return convertResourceCPUToString(container.Resources.Requests.Cpu(), divisor)
case "requests.memory":
return convertResourceMemoryToString(container.Resources.Requests.Memory(), divisor)
}
return "", fmt.Errorf("unsupported container resource : %v", fs.Resource)
}
// convertResourceCPUToString converts cpu value to the format of divisor and returns
// ceiling of the value.
func convertResourceCPUToString(cpu *resource.Quantity, divisor resource.Quantity) (string, error) {
c := int64(math.Ceil(float64(cpu.MilliValue()) / float64(divisor.MilliValue())))
return strconv.FormatInt(c, 10), nil
}
// convertResourceMemoryToString converts memory value to the format of divisor and returns
// ceiling of the value.
func convertResourceMemoryToString(memory *resource.Quantity, divisor resource.Quantity) (string, error) {
m := int64(math.Ceil(float64(memory.Value()) / float64(divisor.Value())))
return strconv.FormatInt(m, 10), nil
}

View File

@ -653,10 +653,20 @@ type ISCSIVolumeSource struct {
// the ReadOnly setting in VolumeMounts. // the ReadOnly setting in VolumeMounts.
// +optional // +optional
ReadOnly bool ReadOnly bool
// Required: list of iSCSI target portal ips for high availability. // Optional: list of iSCSI target portal ips for high availability.
// the portal is either an IP or ip_addr:port if port is other than default (typically TCP ports 860 and 3260) // the portal is either an IP or ip_addr:port if port is other than default (typically TCP ports 860 and 3260)
// +optional // +optional
Portals []string Portals []string
// Optional: whether support iSCSI Discovery CHAP authentication
// +optional
DiscoveryCHAPAuth bool
// Optional: whether support iSCSI Session CHAP authentication
// +optional
SessionCHAPAuth bool
// Optional: CHAP secret for iSCSI target and initiator authentication.
// The secret is used if either DiscoveryCHAPAuth or SessionCHAPAuth is true
// +optional
SecretRef *LocalObjectReference
} }
// Represents a Fibre Channel volume. // Represents a Fibre Channel volume.

File diff suppressed because it is too large Load Diff

View File

@ -245,6 +245,8 @@ message ComponentStatus {
// List of component conditions observed // List of component conditions observed
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
repeated ComponentCondition conditions = 2; repeated ComponentCondition conditions = 2;
} }
@ -415,6 +417,8 @@ message Container {
// accessible from the network. // accessible from the network.
// Cannot be updated. // Cannot be updated.
// +optional // +optional
// +patchMergeKey=containerPort
// +patchStrategy=merge
repeated ContainerPort ports = 6; repeated ContainerPort ports = 6;
// List of sources to populate environment variables in the container. // List of sources to populate environment variables in the container.
@ -429,6 +433,8 @@ message Container {
// List of environment variables to set in the container. // List of environment variables to set in the container.
// Cannot be updated. // Cannot be updated.
// +optional // +optional
// +patchMergeKey=name
// +patchStrategy=merge
repeated EnvVar env = 7; repeated EnvVar env = 7;
// Compute Resources required by this container. // Compute Resources required by this container.
@ -440,6 +446,8 @@ message Container {
// Pod volumes to mount into the container's filesystem. // Pod volumes to mount into the container's filesystem.
// Cannot be updated. // Cannot be updated.
// +optional // +optional
// +patchMergeKey=mountPath
// +patchStrategy=merge
repeated VolumeMount volumeMounts = 9; repeated VolumeMount volumeMounts = 9;
// Periodic probe of container liveness. // Periodic probe of container liveness.
@ -1227,6 +1235,18 @@ message ISCSIVolumeSource {
// is other than default (typically TCP ports 860 and 3260). // is other than default (typically TCP ports 860 and 3260).
// +optional // +optional
repeated string portals = 7; repeated string portals = 7;
// whether support iSCSI Discovery CHAP authentication
// +optional
optional bool chapAuthDiscovery = 8;
// whether support iSCSI Session CHAP authentication
// +optional
optional bool chapAuthSession = 11;
// CHAP secret for iSCSI target and initiator authentication
// +optional
optional LocalObjectReference secretRef = 10;
} }
// Maps a string key to a path within a volume. // Maps a string key to a path within a volume.
@ -1591,6 +1611,8 @@ message NodeSelector {
// that relates the key and values. // that relates the key and values.
message NodeSelectorRequirement { message NodeSelectorRequirement {
// The label key that the selector applies to. // The label key that the selector applies to.
// +patchMergeKey=key
// +patchStrategy=merge
optional string key = 1; optional string key = 1;
// Represents a key's relationship to a set of values. // Represents a key's relationship to a set of values.
@ -1658,12 +1680,16 @@ message NodeStatus {
// Conditions is an array of current observed node conditions. // Conditions is an array of current observed node conditions.
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-condition // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-condition
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
repeated NodeCondition conditions = 4; repeated NodeCondition conditions = 4;
// List of addresses reachable to the node. // List of addresses reachable to the node.
// Queried from cloud provider, if available. // Queried from cloud provider, if available.
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-addresses // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-addresses
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
repeated NodeAddress addresses = 5; repeated NodeAddress addresses = 5;
// Endpoints of daemons running on the Node. // Endpoints of daemons running on the Node.
@ -1869,6 +1895,8 @@ message ObjectMeta {
// then an entry in this list will point to this controller, with the controller field set to true. // then an entry in this list will point to this controller, with the controller field set to true.
// There cannot be more than one managing controller. // There cannot be more than one managing controller.
// +optional // +optional
// +patchMergeKey=uid
// +patchStrategy=merge
repeated k8s.io.apimachinery.pkg.apis.meta.v1.OwnerReference ownerReferences = 13; repeated k8s.io.apimachinery.pkg.apis.meta.v1.OwnerReference ownerReferences = 13;
// Must be empty before the object is deleted from the registry. Each entry // Must be empty before the object is deleted from the registry. Each entry
@ -1876,6 +1904,7 @@ message ObjectMeta {
// from the list. If the deletionTimestamp of the object is non-nil, entries // from the list. If the deletionTimestamp of the object is non-nil, entries
// in this list can only be removed. // in this list can only be removed.
// +optional // +optional
// +patchStrategy=merge
repeated string finalizers = 14; repeated string finalizers = 14;
// The name of the cluster which the object belongs to. // The name of the cluster which the object belongs to.
@ -2562,6 +2591,8 @@ message PodSpec {
// List of volumes that can be mounted by containers belonging to the pod. // List of volumes that can be mounted by containers belonging to the pod.
// More info: http://kubernetes.io/docs/user-guide/volumes // More info: http://kubernetes.io/docs/user-guide/volumes
// +optional // +optional
// +patchMergeKey=name
// +patchStrategy=merge
repeated Volume volumes = 1; repeated Volume volumes = 1;
// List of initialization containers belonging to the pod. // List of initialization containers belonging to the pod.
@ -2577,6 +2608,8 @@ message PodSpec {
// Init containers cannot currently be added or removed. // Init containers cannot currently be added or removed.
// Cannot be updated. // Cannot be updated.
// More info: http://kubernetes.io/docs/user-guide/containers // More info: http://kubernetes.io/docs/user-guide/containers
// +patchMergeKey=name
// +patchStrategy=merge
repeated Container initContainers = 20; repeated Container initContainers = 20;
// List of containers belonging to the pod. // List of containers belonging to the pod.
@ -2584,6 +2617,8 @@ message PodSpec {
// There must be at least one container in a Pod. // There must be at least one container in a Pod.
// Cannot be updated. // Cannot be updated.
// More info: http://kubernetes.io/docs/user-guide/containers // More info: http://kubernetes.io/docs/user-guide/containers
// +patchMergeKey=name
// +patchStrategy=merge
repeated Container containers = 2; repeated Container containers = 2;
// Restart policy for all containers within the pod. // Restart policy for all containers within the pod.
@ -2672,6 +2707,8 @@ message PodSpec {
// in the case of docker, only DockerConfig type secrets are honored. // in the case of docker, only DockerConfig type secrets are honored.
// More info: http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod // More info: http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod
// +optional // +optional
// +patchMergeKey=name
// +patchStrategy=merge
repeated LocalObjectReference imagePullSecrets = 15; repeated LocalObjectReference imagePullSecrets = 15;
// Specifies the hostname of the Pod // Specifies the hostname of the Pod
@ -2709,6 +2746,8 @@ message PodStatus {
// Current service state of pod. // Current service state of pod.
// More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions // More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
repeated PodCondition conditions = 2; repeated PodCondition conditions = 2;
// A human readable message indicating details about why the pod is in this condition. // A human readable message indicating details about why the pod is in this condition.
@ -3107,6 +3146,8 @@ message ReplicationControllerStatus {
// Represents the latest available observations of a replication controller's current state. // Represents the latest available observations of a replication controller's current state.
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
repeated ReplicationControllerCondition conditions = 6; repeated ReplicationControllerCondition conditions = 6;
} }
@ -3468,6 +3509,8 @@ message ServiceAccount {
// Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount. // Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount.
// More info: http://kubernetes.io/docs/user-guide/secrets // More info: http://kubernetes.io/docs/user-guide/secrets
// +optional // +optional
// +patchMergeKey=name
// +patchStrategy=merge
repeated ObjectReference secrets = 2; repeated ObjectReference secrets = 2;
// ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images // ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images
@ -3558,6 +3601,8 @@ message ServiceProxyOptions {
message ServiceSpec { message ServiceSpec {
// The list of ports that are exposed by this service. // The list of ports that are exposed by this service.
// More info: http://kubernetes.io/docs/user-guide/services#virtual-ips-and-service-proxies // More info: http://kubernetes.io/docs/user-guide/services#virtual-ips-and-service-proxies
// +patchMergeKey=port
// +patchStrategy=merge
repeated ServicePort ports = 1; repeated ServicePort ports = 1;
// Route service traffic to pods with label keys and values matching this // Route service traffic to pods with label keys and values matching this
@ -3677,6 +3722,8 @@ message TCPSocketAction {
// any pod that that does not tolerate the Taint. // any pod that that does not tolerate the Taint.
message Taint { message Taint {
// Required. The taint key to be applied to a node. // Required. The taint key to be applied to a node.
// +patchMergeKey=key
// +patchStrategy=merge
optional string key = 1; optional string key = 1;
// Required. The taint value corresponding to the taint key. // Required. The taint value corresponding to the taint key.
@ -3700,6 +3747,8 @@ message Toleration {
// Key is the taint key that the toleration applies to. Empty means match all taint keys. // Key is the taint key that the toleration applies to. Empty means match all taint keys.
// If the key is empty, operator must be Exists; this combination means to match all values and all keys. // If the key is empty, operator must be Exists; this combination means to match all values and all keys.
// +optional // +optional
// +patchMergeKey=key
// +patchStrategy=merge
optional string key = 1; optional string key = 1;
// Operator represents a key's relationship to the value. // Operator represents a key's relationship to the value.

View File

@ -276,9 +276,9 @@ const (
AffinityAnnotationKey string = "scheduler.alpha.kubernetes.io/affinity" AffinityAnnotationKey string = "scheduler.alpha.kubernetes.io/affinity"
) )
// Tries to add a toleration to annotations list. Returns true if something was updated // AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
// false otherwise. // Returns true if something was updated, false otherwise.
func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error) { func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) bool {
podTolerations := pod.Spec.Tolerations podTolerations := pod.Spec.Tolerations
var newTolerations []Toleration var newTolerations []Toleration
@ -286,7 +286,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
for i := range podTolerations { for i := range podTolerations {
if toleration.MatchToleration(&podTolerations[i]) { if toleration.MatchToleration(&podTolerations[i]) {
if api.Semantic.DeepEqual(toleration, podTolerations[i]) { if api.Semantic.DeepEqual(toleration, podTolerations[i]) {
return false, nil return false
} }
newTolerations = append(newTolerations, *toleration) newTolerations = append(newTolerations, *toleration)
updated = true updated = true
@ -301,7 +301,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
} }
pod.Spec.Tolerations = newTolerations pod.Spec.Tolerations = newTolerations
return true, nil return true
} }
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>, // MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,

View File

@ -35,6 +35,8 @@ func (meta *ObjectMeta) GetUID() types.UID { return meta.UID }
func (meta *ObjectMeta) SetUID(uid types.UID) { meta.UID = uid } func (meta *ObjectMeta) SetUID(uid types.UID) { meta.UID = uid }
func (meta *ObjectMeta) GetResourceVersion() string { return meta.ResourceVersion } func (meta *ObjectMeta) GetResourceVersion() string { return meta.ResourceVersion }
func (meta *ObjectMeta) SetResourceVersion(version string) { meta.ResourceVersion = version } func (meta *ObjectMeta) SetResourceVersion(version string) { meta.ResourceVersion = version }
func (meta *ObjectMeta) GetGeneration() int64 { return meta.Generation }
func (meta *ObjectMeta) SetGeneration(generation int64) { meta.Generation = generation }
func (meta *ObjectMeta) GetSelfLink() string { return meta.SelfLink } func (meta *ObjectMeta) GetSelfLink() string { return meta.SelfLink }
func (meta *ObjectMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink } func (meta *ObjectMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink }
func (meta *ObjectMeta) GetCreationTimestamp() metav1.Time { return meta.CreationTimestamp } func (meta *ObjectMeta) GetCreationTimestamp() metav1.Time { return meta.CreationTimestamp }
@ -45,6 +47,10 @@ func (meta *ObjectMeta) GetDeletionTimestamp() *metav1.Time { return meta.Deleti
func (meta *ObjectMeta) SetDeletionTimestamp(deletionTimestamp *metav1.Time) { func (meta *ObjectMeta) SetDeletionTimestamp(deletionTimestamp *metav1.Time) {
meta.DeletionTimestamp = deletionTimestamp meta.DeletionTimestamp = deletionTimestamp
} }
func (meta *ObjectMeta) GetDeletionGracePeriodSeconds() *int64 { return meta.DeletionGracePeriodSeconds }
func (meta *ObjectMeta) SetDeletionGracePeriodSeconds(deletionGracePeriodSeconds *int64) {
meta.DeletionGracePeriodSeconds = deletionGracePeriodSeconds
}
func (meta *ObjectMeta) GetLabels() map[string]string { return meta.Labels } func (meta *ObjectMeta) GetLabels() map[string]string { return meta.Labels }
func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = labels } func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = labels }
func (meta *ObjectMeta) GetAnnotations() map[string]string { return meta.Annotations } func (meta *ObjectMeta) GetAnnotations() map[string]string { return meta.Annotations }

View File

@ -17,10 +17,14 @@ limitations under the License.
package v1 package v1
import ( import (
"fmt"
"math"
"strconv"
"time" "time"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api"
) )
// Returns string version of ResourceName. // Returns string version of ResourceName.
@ -255,3 +259,100 @@ func GetResourceRequest(pod *Pod, resource ResourceName) int64 {
} }
return totalResources return totalResources
} }
// ExtractResourceValueByContainerName extracts the value of a resource
// by providing container name
func ExtractResourceValueByContainerName(fs *ResourceFieldSelector, pod *Pod, containerName string) (string, error) {
container, err := findContainerInPod(pod, containerName)
if err != nil {
return "", err
}
return ExtractContainerResourceValue(fs, container)
}
// ExtractResourceValueByContainerNameAndNodeAllocatable extracts the value of a resource
// by providing container name and node allocatable
func ExtractResourceValueByContainerNameAndNodeAllocatable(fs *ResourceFieldSelector, pod *Pod, containerName string, nodeAllocatable ResourceList) (string, error) {
realContainer, err := findContainerInPod(pod, containerName)
if err != nil {
return "", err
}
containerCopy, err := api.Scheme.DeepCopy(realContainer)
if err != nil {
return "", fmt.Errorf("failed to perform a deep copy of container object: %v", err)
}
container, ok := containerCopy.(*Container)
if !ok {
return "", fmt.Errorf("unexpected type returned from deep copy of container object")
}
MergeContainerResourceLimits(container, nodeAllocatable)
return ExtractContainerResourceValue(fs, container)
}
// ExtractContainerResourceValue extracts the value of a resource
// in an already known container
func ExtractContainerResourceValue(fs *ResourceFieldSelector, container *Container) (string, error) {
divisor := resource.Quantity{}
if divisor.Cmp(fs.Divisor) == 0 {
divisor = resource.MustParse("1")
} else {
divisor = fs.Divisor
}
switch fs.Resource {
case "limits.cpu":
return convertResourceCPUToString(container.Resources.Limits.Cpu(), divisor)
case "limits.memory":
return convertResourceMemoryToString(container.Resources.Limits.Memory(), divisor)
case "requests.cpu":
return convertResourceCPUToString(container.Resources.Requests.Cpu(), divisor)
case "requests.memory":
return convertResourceMemoryToString(container.Resources.Requests.Memory(), divisor)
}
return "", fmt.Errorf("Unsupported container resource : %v", fs.Resource)
}
// convertResourceCPUToString converts cpu value to the format of divisor and returns
// ceiling of the value.
func convertResourceCPUToString(cpu *resource.Quantity, divisor resource.Quantity) (string, error) {
c := int64(math.Ceil(float64(cpu.MilliValue()) / float64(divisor.MilliValue())))
return strconv.FormatInt(c, 10), nil
}
// convertResourceMemoryToString converts memory value to the format of divisor and returns
// ceiling of the value.
func convertResourceMemoryToString(memory *resource.Quantity, divisor resource.Quantity) (string, error) {
m := int64(math.Ceil(float64(memory.Value()) / float64(divisor.Value())))
return strconv.FormatInt(m, 10), nil
}
// findContainerInPod finds a container by its name in the provided pod
func findContainerInPod(pod *Pod, containerName string) (*Container, error) {
for _, container := range pod.Spec.Containers {
if container.Name == containerName {
return &container, nil
}
}
return nil, fmt.Errorf("container %s not found", containerName)
}
// MergeContainerResourceLimits checks if a limit is applied for
// the container, and if not, it sets the limit to the passed resource list.
func MergeContainerResourceLimits(container *Container,
allocatable ResourceList) {
if container.Resources.Limits == nil {
container.Resources.Limits = make(ResourceList)
}
for _, resource := range []ResourceName{ResourceCPU, ResourceMemory} {
if quantity, exists := container.Resources.Limits[resource]; !exists || quantity.IsZero() {
if cap, exists := allocatable[resource]; exists {
container.Resources.Limits[resource] = *cap.Copy()
}
}
}
}

View File

@ -15958,16 +15958,19 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
} else { } else {
yysep2 := !z.EncBinary() yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [7]bool var yyq2 [10]bool
_, _, _ = yysep2, yyq2, yy2arr2 _, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false const yyr2 bool = false
yyq2[3] = x.ISCSIInterface != "" yyq2[3] = x.ISCSIInterface != ""
yyq2[4] = x.FSType != "" yyq2[4] = x.FSType != ""
yyq2[5] = x.ReadOnly != false yyq2[5] = x.ReadOnly != false
yyq2[6] = len(x.Portals) != 0 yyq2[6] = len(x.Portals) != 0
yyq2[7] = x.DiscoveryCHAPAuth != false
yyq2[8] = x.SessionCHAPAuth != false
yyq2[9] = x.SecretRef != nil
var yynn2 int var yynn2 int
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
r.EncodeArrayStart(7) r.EncodeArrayStart(10)
} else { } else {
yynn2 = 3 yynn2 = 3
for _, b := range yyq2 { for _, b := range yyq2 {
@ -16143,6 +16146,79 @@ func (x *ISCSIVolumeSource) CodecEncodeSelf(e *codec1978.Encoder) {
} }
} }
} }
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[7] {
yym25 := z.EncBinary()
_ = yym25
if false {
} else {
r.EncodeBool(bool(x.DiscoveryCHAPAuth))
}
} else {
r.EncodeBool(false)
}
} else {
if yyq2[7] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("chapAuthDiscovery"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym26 := z.EncBinary()
_ = yym26
if false {
} else {
r.EncodeBool(bool(x.DiscoveryCHAPAuth))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[8] {
yym28 := z.EncBinary()
_ = yym28
if false {
} else {
r.EncodeBool(bool(x.SessionCHAPAuth))
}
} else {
r.EncodeBool(false)
}
} else {
if yyq2[8] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("chapAuthSession"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym29 := z.EncBinary()
_ = yym29
if false {
} else {
r.EncodeBool(bool(x.SessionCHAPAuth))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[9] {
if x.SecretRef == nil {
r.EncodeNil()
} else {
x.SecretRef.CodecEncodeSelf(e)
}
} else {
r.EncodeNil()
}
} else {
if yyq2[9] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("secretRef"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.SecretRef == nil {
r.EncodeNil()
} else {
x.SecretRef.CodecEncodeSelf(e)
}
}
}
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234) z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else { } else {
@ -16288,6 +16364,41 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromMap(l int, d *codec1978.Decoder)
z.F.DecSliceStringX(yyv16, false, d) z.F.DecSliceStringX(yyv16, false, d)
} }
} }
case "chapAuthDiscovery":
if r.TryDecodeAsNil() {
x.DiscoveryCHAPAuth = false
} else {
yyv18 := &x.DiscoveryCHAPAuth
yym19 := z.DecBinary()
_ = yym19
if false {
} else {
*((*bool)(yyv18)) = r.DecodeBool()
}
}
case "chapAuthSession":
if r.TryDecodeAsNil() {
x.SessionCHAPAuth = false
} else {
yyv20 := &x.SessionCHAPAuth
yym21 := z.DecBinary()
_ = yym21
if false {
} else {
*((*bool)(yyv20)) = r.DecodeBool()
}
}
case "secretRef":
if r.TryDecodeAsNil() {
if x.SecretRef != nil {
x.SecretRef = nil
}
} else {
if x.SecretRef == nil {
x.SecretRef = new(LocalObjectReference)
}
x.SecretRef.CodecDecodeSelf(d)
}
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3 } // end switch yys3
@ -16299,16 +16410,16 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
var h codecSelfer1234 var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d) z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r _, _, _ = h, z, r
var yyj18 int var yyj23 int
var yyb18 bool var yyb23 bool
var yyhl18 bool = l >= 0 var yyhl23 bool = l >= 0
yyj18++ yyj23++
if yyhl18 { if yyhl23 {
yyb18 = yyj18 > l yyb23 = yyj23 > l
} else { } else {
yyb18 = r.CheckBreak() yyb23 = r.CheckBreak()
} }
if yyb18 { if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -16316,21 +16427,21 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.TargetPortal = "" x.TargetPortal = ""
} else { } else {
yyv19 := &x.TargetPortal yyv24 := &x.TargetPortal
yym20 := z.DecBinary() yym25 := z.DecBinary()
_ = yym20 _ = yym25
if false { if false {
} else { } else {
*((*string)(yyv19)) = r.DecodeString() *((*string)(yyv24)) = r.DecodeString()
} }
} }
yyj18++ yyj23++
if yyhl18 { if yyhl23 {
yyb18 = yyj18 > l yyb23 = yyj23 > l
} else { } else {
yyb18 = r.CheckBreak() yyb23 = r.CheckBreak()
} }
if yyb18 { if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -16338,21 +16449,21 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.IQN = "" x.IQN = ""
} else { } else {
yyv21 := &x.IQN yyv26 := &x.IQN
yym22 := z.DecBinary() yym27 := z.DecBinary()
_ = yym22 _ = yym27
if false { if false {
} else { } else {
*((*string)(yyv21)) = r.DecodeString() *((*string)(yyv26)) = r.DecodeString()
} }
} }
yyj18++ yyj23++
if yyhl18 { if yyhl23 {
yyb18 = yyj18 > l yyb23 = yyj23 > l
} else { } else {
yyb18 = r.CheckBreak() yyb23 = r.CheckBreak()
} }
if yyb18 { if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -16360,21 +16471,21 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Lun = 0 x.Lun = 0
} else { } else {
yyv23 := &x.Lun yyv28 := &x.Lun
yym24 := z.DecBinary() yym29 := z.DecBinary()
_ = yym24 _ = yym29
if false { if false {
} else { } else {
*((*int32)(yyv23)) = int32(r.DecodeInt(32)) *((*int32)(yyv28)) = int32(r.DecodeInt(32))
} }
} }
yyj18++ yyj23++
if yyhl18 { if yyhl23 {
yyb18 = yyj18 > l yyb23 = yyj23 > l
} else { } else {
yyb18 = r.CheckBreak() yyb23 = r.CheckBreak()
} }
if yyb18 { if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -16382,21 +16493,21 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.ISCSIInterface = "" x.ISCSIInterface = ""
} else { } else {
yyv25 := &x.ISCSIInterface yyv30 := &x.ISCSIInterface
yym26 := z.DecBinary() yym31 := z.DecBinary()
_ = yym26 _ = yym31
if false { if false {
} else { } else {
*((*string)(yyv25)) = r.DecodeString() *((*string)(yyv30)) = r.DecodeString()
} }
} }
yyj18++ yyj23++
if yyhl18 { if yyhl23 {
yyb18 = yyj18 > l yyb23 = yyj23 > l
} else { } else {
yyb18 = r.CheckBreak() yyb23 = r.CheckBreak()
} }
if yyb18 { if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -16404,21 +16515,21 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.FSType = "" x.FSType = ""
} else { } else {
yyv27 := &x.FSType yyv32 := &x.FSType
yym28 := z.DecBinary() yym33 := z.DecBinary()
_ = yym28 _ = yym33
if false { if false {
} else { } else {
*((*string)(yyv27)) = r.DecodeString() *((*string)(yyv32)) = r.DecodeString()
} }
} }
yyj18++ yyj23++
if yyhl18 { if yyhl23 {
yyb18 = yyj18 > l yyb23 = yyj23 > l
} else { } else {
yyb18 = r.CheckBreak() yyb23 = r.CheckBreak()
} }
if yyb18 { if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -16426,21 +16537,21 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.ReadOnly = false x.ReadOnly = false
} else { } else {
yyv29 := &x.ReadOnly yyv34 := &x.ReadOnly
yym30 := z.DecBinary() yym35 := z.DecBinary()
_ = yym30 _ = yym35
if false { if false {
} else { } else {
*((*bool)(yyv29)) = r.DecodeBool() *((*bool)(yyv34)) = r.DecodeBool()
} }
} }
yyj18++ yyj23++
if yyhl18 { if yyhl23 {
yyb18 = yyj18 > l yyb23 = yyj23 > l
} else { } else {
yyb18 = r.CheckBreak() yyb23 = r.CheckBreak()
} }
if yyb18 { if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -16448,26 +16559,91 @@ func (x *ISCSIVolumeSource) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Portals = nil x.Portals = nil
} else { } else {
yyv31 := &x.Portals yyv36 := &x.Portals
yym32 := z.DecBinary() yym37 := z.DecBinary()
_ = yym32 _ = yym37
if false { if false {
} else { } else {
z.F.DecSliceStringX(yyv31, false, d) z.F.DecSliceStringX(yyv36, false, d)
} }
} }
for { yyj23++
yyj18++ if yyhl23 {
if yyhl18 { yyb23 = yyj23 > l
yyb18 = yyj18 > l } else {
yyb23 = r.CheckBreak()
}
if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.DiscoveryCHAPAuth = false
} else {
yyv38 := &x.DiscoveryCHAPAuth
yym39 := z.DecBinary()
_ = yym39
if false {
} else { } else {
yyb18 = r.CheckBreak() *((*bool)(yyv38)) = r.DecodeBool()
} }
if yyb18 { }
yyj23++
if yyhl23 {
yyb23 = yyj23 > l
} else {
yyb23 = r.CheckBreak()
}
if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.SessionCHAPAuth = false
} else {
yyv40 := &x.SessionCHAPAuth
yym41 := z.DecBinary()
_ = yym41
if false {
} else {
*((*bool)(yyv40)) = r.DecodeBool()
}
}
yyj23++
if yyhl23 {
yyb23 = yyj23 > l
} else {
yyb23 = r.CheckBreak()
}
if yyb23 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
if x.SecretRef != nil {
x.SecretRef = nil
}
} else {
if x.SecretRef == nil {
x.SecretRef = new(LocalObjectReference)
}
x.SecretRef.CodecDecodeSelf(d)
}
for {
yyj23++
if yyhl23 {
yyb23 = yyj23 > l
} else {
yyb23 = r.CheckBreak()
}
if yyb23 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj18-1, "") z.DecStructFieldNotFound(yyj23-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }

View File

@ -197,6 +197,8 @@ type ObjectMeta struct {
// then an entry in this list will point to this controller, with the controller field set to true. // then an entry in this list will point to this controller, with the controller field set to true.
// There cannot be more than one managing controller. // There cannot be more than one managing controller.
// +optional // +optional
// +patchMergeKey=uid
// +patchStrategy=merge
OwnerReferences []metav1.OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"` OwnerReferences []metav1.OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
// Must be empty before the object is deleted from the registry. Each entry // Must be empty before the object is deleted from the registry. Each entry
@ -204,6 +206,7 @@ type ObjectMeta struct {
// from the list. If the deletionTimestamp of the object is non-nil, entries // from the list. If the deletionTimestamp of the object is non-nil, entries
// in this list can only be removed. // in this list can only be removed.
// +optional // +optional
// +patchStrategy=merge
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"` Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
// The name of the cluster which the object belongs to. // The name of the cluster which the object belongs to.
@ -1047,6 +1050,15 @@ type ISCSIVolumeSource struct {
// is other than default (typically TCP ports 860 and 3260). // is other than default (typically TCP ports 860 and 3260).
// +optional // +optional
Portals []string `json:"portals,omitempty" protobuf:"bytes,7,opt,name=portals"` Portals []string `json:"portals,omitempty" protobuf:"bytes,7,opt,name=portals"`
// whether support iSCSI Discovery CHAP authentication
// +optional
DiscoveryCHAPAuth bool `json:"chapAuthDiscovery,omitempty" protobuf:"varint,8,opt,name=chapAuthDiscovery"`
// whether support iSCSI Session CHAP authentication
// +optional
SessionCHAPAuth bool `json:"chapAuthSession,omitempty" protobuf:"varint,11,opt,name=chapAuthSession"`
// CHAP secret for iSCSI target and initiator authentication
// +optional
SecretRef *LocalObjectReference `json:"secretRef,omitempty" protobuf:"bytes,10,opt,name=secretRef"`
} }
// Represents a Fibre Channel volume. // Represents a Fibre Channel volume.
@ -1637,6 +1649,8 @@ type Container struct {
// accessible from the network. // accessible from the network.
// Cannot be updated. // Cannot be updated.
// +optional // +optional
// +patchMergeKey=containerPort
// +patchStrategy=merge
Ports []ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"` Ports []ContainerPort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"containerPort" protobuf:"bytes,6,rep,name=ports"`
// List of sources to populate environment variables in the container. // List of sources to populate environment variables in the container.
// The keys defined within a source must be a C_IDENTIFIER. All invalid keys // The keys defined within a source must be a C_IDENTIFIER. All invalid keys
@ -1649,6 +1663,8 @@ type Container struct {
// List of environment variables to set in the container. // List of environment variables to set in the container.
// Cannot be updated. // Cannot be updated.
// +optional // +optional
// +patchMergeKey=name
// +patchStrategy=merge
Env []EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"` Env []EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"`
// Compute Resources required by this container. // Compute Resources required by this container.
// Cannot be updated. // Cannot be updated.
@ -1658,6 +1674,8 @@ type Container struct {
// Pod volumes to mount into the container's filesystem. // Pod volumes to mount into the container's filesystem.
// Cannot be updated. // Cannot be updated.
// +optional // +optional
// +patchMergeKey=mountPath
// +patchStrategy=merge
VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,9,rep,name=volumeMounts"` VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,9,rep,name=volumeMounts"`
// Periodic probe of container liveness. // Periodic probe of container liveness.
// Container will be restarted if the probe fails. // Container will be restarted if the probe fails.
@ -1978,6 +1996,8 @@ type NodeSelectorTerm struct {
// that relates the key and values. // that relates the key and values.
type NodeSelectorRequirement struct { type NodeSelectorRequirement struct {
// The label key that the selector applies to. // The label key that the selector applies to.
// +patchMergeKey=key
// +patchStrategy=merge
Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"` Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
// Represents a key's relationship to a set of values. // Represents a key's relationship to a set of values.
// Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt. // Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
@ -2162,6 +2182,8 @@ type PreferredSchedulingTerm struct {
// any pod that that does not tolerate the Taint. // any pod that that does not tolerate the Taint.
type Taint struct { type Taint struct {
// Required. The taint key to be applied to a node. // Required. The taint key to be applied to a node.
// +patchMergeKey=key
// +patchStrategy=merge
Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"` Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
// Required. The taint value corresponding to the taint key. // Required. The taint value corresponding to the taint key.
// +optional // +optional
@ -2204,6 +2226,8 @@ type Toleration struct {
// Key is the taint key that the toleration applies to. Empty means match all taint keys. // Key is the taint key that the toleration applies to. Empty means match all taint keys.
// If the key is empty, operator must be Exists; this combination means to match all values and all keys. // If the key is empty, operator must be Exists; this combination means to match all values and all keys.
// +optional // +optional
// +patchMergeKey=key
// +patchStrategy=merge
Key string `json:"key,omitempty" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"` Key string `json:"key,omitempty" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
// Operator represents a key's relationship to the value. // Operator represents a key's relationship to the value.
// Valid operators are Exists and Equal. Defaults to Equal. // Valid operators are Exists and Equal. Defaults to Equal.
@ -2261,6 +2285,8 @@ type PodSpec struct {
// List of volumes that can be mounted by containers belonging to the pod. // List of volumes that can be mounted by containers belonging to the pod.
// More info: http://kubernetes.io/docs/user-guide/volumes // More info: http://kubernetes.io/docs/user-guide/volumes
// +optional // +optional
// +patchMergeKey=name
// +patchStrategy=merge
Volumes []Volume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,1,rep,name=volumes"` Volumes []Volume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,1,rep,name=volumes"`
// List of initialization containers belonging to the pod. // List of initialization containers belonging to the pod.
// Init containers are executed in order prior to containers being started. If any // Init containers are executed in order prior to containers being started. If any
@ -2275,12 +2301,16 @@ type PodSpec struct {
// Init containers cannot currently be added or removed. // Init containers cannot currently be added or removed.
// Cannot be updated. // Cannot be updated.
// More info: http://kubernetes.io/docs/user-guide/containers // More info: http://kubernetes.io/docs/user-guide/containers
// +patchMergeKey=name
// +patchStrategy=merge
InitContainers []Container `json:"initContainers,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,20,rep,name=initContainers"` InitContainers []Container `json:"initContainers,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,20,rep,name=initContainers"`
// List of containers belonging to the pod. // List of containers belonging to the pod.
// Containers cannot currently be added or removed. // Containers cannot currently be added or removed.
// There must be at least one container in a Pod. // There must be at least one container in a Pod.
// Cannot be updated. // Cannot be updated.
// More info: http://kubernetes.io/docs/user-guide/containers // More info: http://kubernetes.io/docs/user-guide/containers
// +patchMergeKey=name
// +patchStrategy=merge
Containers []Container `json:"containers" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=containers"` Containers []Container `json:"containers" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=containers"`
// Restart policy for all containers within the pod. // Restart policy for all containers within the pod.
// One of Always, OnFailure, Never. // One of Always, OnFailure, Never.
@ -2357,6 +2387,8 @@ type PodSpec struct {
// in the case of docker, only DockerConfig type secrets are honored. // in the case of docker, only DockerConfig type secrets are honored.
// More info: http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod // More info: http://kubernetes.io/docs/user-guide/images#specifying-imagepullsecrets-on-a-pod
// +optional // +optional
// +patchMergeKey=name
// +patchStrategy=merge
ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,15,rep,name=imagePullSecrets"` ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,15,rep,name=imagePullSecrets"`
// Specifies the hostname of the Pod // Specifies the hostname of the Pod
// If not specified, the pod's hostname will be set to a system-defined value. // If not specified, the pod's hostname will be set to a system-defined value.
@ -2444,6 +2476,8 @@ type PodStatus struct {
// Current service state of pod. // Current service state of pod.
// More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions // More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []PodCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` Conditions []PodCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
// A human readable message indicating details about why the pod is in this condition. // A human readable message indicating details about why the pod is in this condition.
// +optional // +optional
@ -2640,6 +2674,8 @@ type ReplicationControllerStatus struct {
// Represents the latest available observations of a replication controller's current state. // Represents the latest available observations of a replication controller's current state.
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []ReplicationControllerCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` Conditions []ReplicationControllerCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
} }
@ -2777,6 +2813,8 @@ type LoadBalancerIngress struct {
type ServiceSpec struct { type ServiceSpec struct {
// The list of ports that are exposed by this service. // The list of ports that are exposed by this service.
// More info: http://kubernetes.io/docs/user-guide/services#virtual-ips-and-service-proxies // More info: http://kubernetes.io/docs/user-guide/services#virtual-ips-and-service-proxies
// +patchMergeKey=port
// +patchStrategy=merge
Ports []ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"` Ports []ServicePort `json:"ports,omitempty" patchStrategy:"merge" patchMergeKey:"port" protobuf:"bytes,1,rep,name=ports"`
// Route service traffic to pods with label keys and values matching this // Route service traffic to pods with label keys and values matching this
@ -2962,6 +3000,8 @@ type ServiceAccount struct {
// Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount. // Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount.
// More info: http://kubernetes.io/docs/user-guide/secrets // More info: http://kubernetes.io/docs/user-guide/secrets
// +optional // +optional
// +patchMergeKey=name
// +patchStrategy=merge
Secrets []ObjectReference `json:"secrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=secrets"` Secrets []ObjectReference `json:"secrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=secrets"`
// ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images // ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images
@ -3182,11 +3222,15 @@ type NodeStatus struct {
// Conditions is an array of current observed node conditions. // Conditions is an array of current observed node conditions.
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-condition // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-condition
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []NodeCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"` Conditions []NodeCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"`
// List of addresses reachable to the node. // List of addresses reachable to the node.
// Queried from cloud provider, if available. // Queried from cloud provider, if available.
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-addresses // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-addresses
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
Addresses []NodeAddress `json:"addresses,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,5,rep,name=addresses"` Addresses []NodeAddress `json:"addresses,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,5,rep,name=addresses"`
// Endpoints of daemons running on the Node. // Endpoints of daemons running on the Node.
// +optional // +optional
@ -4235,6 +4279,8 @@ type ComponentStatus struct {
// List of component conditions observed // List of component conditions observed
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"` Conditions []ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
} }

View File

@ -650,14 +650,17 @@ func (HostPathVolumeSource) SwaggerDoc() map[string]string {
} }
var map_ISCSIVolumeSource = map[string]string{ var map_ISCSIVolumeSource = map[string]string{
"": "Represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.", "": "Represents an ISCSI disk. ISCSI volumes can only be mounted as read/write once. ISCSI volumes support ownership management and SELinux relabeling.",
"targetPortal": "iSCSI target portal. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", "targetPortal": "iSCSI target portal. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).",
"iqn": "Target iSCSI Qualified Name.", "iqn": "Target iSCSI Qualified Name.",
"lun": "iSCSI target lun number.", "lun": "iSCSI target lun number.",
"iscsiInterface": "Optional: Defaults to 'default' (tcp). iSCSI interface name that uses an iSCSI transport.", "iscsiInterface": "Optional: Defaults to 'default' (tcp). iSCSI interface name that uses an iSCSI transport.",
"fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#iscsi", "fsType": "Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#iscsi",
"readOnly": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.", "readOnly": "ReadOnly here will force the ReadOnly setting in VolumeMounts. Defaults to false.",
"portals": "iSCSI target portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).", "portals": "iSCSI target portal List. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).",
"chapAuthDiscovery": "whether support iSCSI Discovery CHAP authentication",
"chapAuthSession": "whether support iSCSI Session CHAP authentication",
"secretRef": "CHAP secret for iSCSI target and initiator authentication",
} }
func (ISCSIVolumeSource) SwaggerDoc() map[string]string { func (ISCSIVolumeSource) SwaggerDoc() map[string]string {

View File

@ -1706,6 +1706,9 @@ func autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *ISCSIVolumeSo
out.FSType = in.FSType out.FSType = in.FSType
out.ReadOnly = in.ReadOnly out.ReadOnly = in.ReadOnly
out.Portals = *(*[]string)(unsafe.Pointer(&in.Portals)) out.Portals = *(*[]string)(unsafe.Pointer(&in.Portals))
out.DiscoveryCHAPAuth = in.DiscoveryCHAPAuth
out.SessionCHAPAuth = in.SessionCHAPAuth
out.SecretRef = (*api.LocalObjectReference)(unsafe.Pointer(in.SecretRef))
return nil return nil
} }
@ -1721,6 +1724,9 @@ func autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolu
out.FSType = in.FSType out.FSType = in.FSType
out.ReadOnly = in.ReadOnly out.ReadOnly = in.ReadOnly
out.Portals = *(*[]string)(unsafe.Pointer(&in.Portals)) out.Portals = *(*[]string)(unsafe.Pointer(&in.Portals))
out.DiscoveryCHAPAuth = in.DiscoveryCHAPAuth
out.SessionCHAPAuth = in.SessionCHAPAuth
out.SecretRef = (*LocalObjectReference)(unsafe.Pointer(in.SecretRef))
return nil return nil
} }

View File

@ -1198,6 +1198,11 @@ func DeepCopy_v1_ISCSIVolumeSource(in interface{}, out interface{}, c *conversio
*out = make([]string, len(*in)) *out = make([]string, len(*in))
copy(*out, *in) copy(*out, *in)
} }
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(LocalObjectReference)
**out = **in
}
return nil return nil
} }
} }

View File

@ -1226,6 +1226,11 @@ func DeepCopy_api_ISCSIVolumeSource(in interface{}, out interface{}, c *conversi
*out = make([]string, len(*in)) *out = make([]string, len(*in))
copy(*out, *in) copy(*out, *in)
} }
if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef
*out = new(LocalObjectReference)
**out = **in
}
return nil return nil
} }
} }

View File

@ -167,6 +167,8 @@ message DeploymentStatus {
optional int32 unavailableReplicas = 5; optional int32 unavailableReplicas = 5;
// Represents the latest available observations of a deployment's current state. // Represents the latest available observations of a deployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
repeated DeploymentCondition conditions = 6; repeated DeploymentCondition conditions = 6;
} }

View File

@ -327,6 +327,8 @@ type DeploymentStatus struct {
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"` UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
// Represents the latest available observations of a deployment's current state. // Represents the latest available observations of a deployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
} }

View File

@ -139,6 +139,8 @@ message JobStatus {
// Conditions represent the latest available observations of an object's current state. // Conditions represent the latest available observations of an object's current state.
// More info: http://kubernetes.io/docs/user-guide/jobs // More info: http://kubernetes.io/docs/user-guide/jobs
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
repeated JobCondition conditions = 1; repeated JobCondition conditions = 1;
// StartTime represents time when the job was acknowledged by the Job Manager. // StartTime represents time when the job was acknowledged by the Job Manager.

View File

@ -110,6 +110,8 @@ type JobStatus struct {
// Conditions represent the latest available observations of an object's current state. // Conditions represent the latest available observations of an object's current state.
// More info: http://kubernetes.io/docs/user-guide/jobs // More info: http://kubernetes.io/docs/user-guide/jobs
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []JobCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` Conditions []JobCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
// StartTime represents time when the job was acknowledged by the Job Manager. // StartTime represents time when the job was acknowledged by the Job Manager.

View File

@ -1061,21 +1061,17 @@ type NetworkPolicySpec struct {
type NetworkPolicyIngressRule struct { type NetworkPolicyIngressRule struct {
// List of ports which should be made accessible on the pods selected for this rule. // List of ports which should be made accessible on the pods selected for this rule.
// Each item in this list is combined using a logical OR. // Each item in this list is combined using a logical OR.
// If this field is not provided, this rule matches all ports (traffic not restricted by port). // If this field is empty or missing, this rule matches all ports (traffic not restricted by port).
// If this field is empty, this rule matches no ports (no traffic matches).
// If this field is present and contains at least one item, then this rule allows traffic // If this field is present and contains at least one item, then this rule allows traffic
// only if the traffic matches at least one port in the list. // only if the traffic matches at least one port in the list.
// TODO: Update this to be a pointer to slice as soon as auto-generation supports it.
// +optional // +optional
Ports []NetworkPolicyPort Ports []NetworkPolicyPort
// List of sources which should be able to access the pods selected for this rule. // List of sources which should be able to access the pods selected for this rule.
// Items in this list are combined using a logical OR operation. // Items in this list are combined using a logical OR operation.
// If this field is not provided, this rule matches all sources (traffic not restricted by source). // If this field is empty or missing, this rule matches all sources (traffic not restricted by source).
// If this field is empty, this rule matches no sources (no traffic matches).
// If this field is present and contains at least on item, this rule allows traffic only if the // If this field is present and contains at least on item, this rule allows traffic only if the
// traffic matches at least one item in the from list. // traffic matches at least one item in the from list.
// TODO: Update this to be a pointer to slice as soon as auto-generation supports it.
// +optional // +optional
From []NetworkPolicyPeer From []NetworkPolicyPeer
} }
@ -1100,7 +1096,6 @@ type NetworkPolicyPeer struct {
// This is a label selector which selects Pods in this namespace. // This is a label selector which selects Pods in this namespace.
// This field follows standard label selector semantics. // This field follows standard label selector semantics.
// If not provided, this selector selects no pods.
// If present but empty, this selector selects all pods in this namespace. // If present but empty, this selector selects all pods in this namespace.
// +optional // +optional
PodSelector *metav1.LabelSelector PodSelector *metav1.LabelSelector
@ -1108,7 +1103,6 @@ type NetworkPolicyPeer struct {
// Selects Namespaces using cluster scoped-labels. This // Selects Namespaces using cluster scoped-labels. This
// matches all pods in all namespaces selected by this label selector. // matches all pods in all namespaces selected by this label selector.
// This field follows standard label selector semantics. // This field follows standard label selector semantics.
// If omitted, this selector selects no namespaces.
// If present but empty, this selector selects all namespaces. // If present but empty, this selector selects all namespaces.
// +optional // +optional
NamespaceSelector *metav1.LabelSelector NamespaceSelector *metav1.LabelSelector

View File

@ -127,7 +127,6 @@ func SetDefaults_ReplicaSet(obj *ReplicaSet) {
func SetDefaults_NetworkPolicy(obj *NetworkPolicy) { func SetDefaults_NetworkPolicy(obj *NetworkPolicy) {
// Default any undefined Protocol fields to TCP. // Default any undefined Protocol fields to TCP.
for _, i := range obj.Spec.Ingress { for _, i := range obj.Spec.Ingress {
// TODO: Update Ports to be a pointer to slice as soon as auto-generation supports it.
for _, p := range i.Ports { for _, p := range i.Ports {
if p.Protocol == nil { if p.Protocol == nil {
proto := v1.ProtocolTCP proto := v1.ProtocolTCP

View File

@ -321,6 +321,8 @@ message DeploymentStatus {
optional int32 unavailableReplicas = 5; optional int32 unavailableReplicas = 5;
// Represents the latest available observations of a deployment's current state. // Represents the latest available observations of a deployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
repeated DeploymentCondition conditions = 6; repeated DeploymentCondition conditions = 6;
} }
@ -539,21 +541,17 @@ message NetworkPolicy {
message NetworkPolicyIngressRule { message NetworkPolicyIngressRule {
// List of ports which should be made accessible on the pods selected for this rule. // List of ports which should be made accessible on the pods selected for this rule.
// Each item in this list is combined using a logical OR. // Each item in this list is combined using a logical OR.
// If this field is not provided, this rule matches all ports (traffic not restricted by port). // If this field is empty or missing, this rule matches all ports (traffic not restricted by port).
// If this field is empty, this rule matches no ports (no traffic matches).
// If this field is present and contains at least one item, then this rule allows traffic // If this field is present and contains at least one item, then this rule allows traffic
// only if the traffic matches at least one port in the list. // only if the traffic matches at least one port in the list.
// TODO: Update this to be a pointer to slice as soon as auto-generation supports it.
// +optional // +optional
repeated NetworkPolicyPort ports = 1; repeated NetworkPolicyPort ports = 1;
// List of sources which should be able to access the pods selected for this rule. // List of sources which should be able to access the pods selected for this rule.
// Items in this list are combined using a logical OR operation. // Items in this list are combined using a logical OR operation.
// If this field is not provided, this rule matches all sources (traffic not restricted by source). // If this field is empty or missing, this rule matches all sources (traffic not restricted by source).
// If this field is empty, this rule matches no sources (no traffic matches).
// If this field is present and contains at least on item, this rule allows traffic only if the // If this field is present and contains at least on item, this rule allows traffic only if the
// traffic matches at least one item in the from list. // traffic matches at least one item in the from list.
// TODO: Update this to be a pointer to slice as soon as auto-generation supports it.
// +optional // +optional
repeated NetworkPolicyPeer from = 2; repeated NetworkPolicyPeer from = 2;
} }
@ -572,7 +570,6 @@ message NetworkPolicyList {
message NetworkPolicyPeer { message NetworkPolicyPeer {
// This is a label selector which selects Pods in this namespace. // This is a label selector which selects Pods in this namespace.
// This field follows standard label selector semantics. // This field follows standard label selector semantics.
// If not provided, this selector selects no pods.
// If present but empty, this selector selects all pods in this namespace. // If present but empty, this selector selects all pods in this namespace.
// +optional // +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector podSelector = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector podSelector = 1;
@ -580,7 +577,6 @@ message NetworkPolicyPeer {
// Selects Namespaces using cluster scoped-labels. This // Selects Namespaces using cluster scoped-labels. This
// matches all pods in all namespaces selected by this label selector. // matches all pods in all namespaces selected by this label selector.
// This field follows standard label selector semantics. // This field follows standard label selector semantics.
// If omitted, this selector selects no namespaces.
// If present but empty, this selector selects all namespaces. // If present but empty, this selector selects all namespaces.
// +optional // +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 2; optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 2;
@ -818,6 +814,8 @@ message ReplicaSetStatus {
// Represents the latest available observations of a replica set's current state. // Represents the latest available observations of a replica set's current state.
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
repeated ReplicaSetCondition conditions = 6; repeated ReplicaSetCondition conditions = 6;
} }

View File

@ -322,6 +322,8 @@ type DeploymentStatus struct {
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"` UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
// Represents the latest available observations of a deployment's current state. // Represents the latest available observations of a deployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
} }
@ -802,6 +804,8 @@ type ReplicaSetStatus struct {
// Represents the latest available observations of a replica set's current state. // Represents the latest available observations of a replica set's current state.
// +optional // +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []ReplicaSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"` Conditions []ReplicaSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
} }
@ -1081,21 +1085,17 @@ type NetworkPolicySpec struct {
type NetworkPolicyIngressRule struct { type NetworkPolicyIngressRule struct {
// List of ports which should be made accessible on the pods selected for this rule. // List of ports which should be made accessible on the pods selected for this rule.
// Each item in this list is combined using a logical OR. // Each item in this list is combined using a logical OR.
// If this field is not provided, this rule matches all ports (traffic not restricted by port). // If this field is empty or missing, this rule matches all ports (traffic not restricted by port).
// If this field is empty, this rule matches no ports (no traffic matches).
// If this field is present and contains at least one item, then this rule allows traffic // If this field is present and contains at least one item, then this rule allows traffic
// only if the traffic matches at least one port in the list. // only if the traffic matches at least one port in the list.
// TODO: Update this to be a pointer to slice as soon as auto-generation supports it.
// +optional // +optional
Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"` Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"`
// List of sources which should be able to access the pods selected for this rule. // List of sources which should be able to access the pods selected for this rule.
// Items in this list are combined using a logical OR operation. // Items in this list are combined using a logical OR operation.
// If this field is not provided, this rule matches all sources (traffic not restricted by source). // If this field is empty or missing, this rule matches all sources (traffic not restricted by source).
// If this field is empty, this rule matches no sources (no traffic matches).
// If this field is present and contains at least on item, this rule allows traffic only if the // If this field is present and contains at least on item, this rule allows traffic only if the
// traffic matches at least one item in the from list. // traffic matches at least one item in the from list.
// TODO: Update this to be a pointer to slice as soon as auto-generation supports it.
// +optional // +optional
From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"` From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"`
} }
@ -1120,7 +1120,6 @@ type NetworkPolicyPeer struct {
// This is a label selector which selects Pods in this namespace. // This is a label selector which selects Pods in this namespace.
// This field follows standard label selector semantics. // This field follows standard label selector semantics.
// If not provided, this selector selects no pods.
// If present but empty, this selector selects all pods in this namespace. // If present but empty, this selector selects all pods in this namespace.
// +optional // +optional
PodSelector *metav1.LabelSelector `json:"podSelector,omitempty" protobuf:"bytes,1,opt,name=podSelector"` PodSelector *metav1.LabelSelector `json:"podSelector,omitempty" protobuf:"bytes,1,opt,name=podSelector"`
@ -1128,7 +1127,6 @@ type NetworkPolicyPeer struct {
// Selects Namespaces using cluster scoped-labels. This // Selects Namespaces using cluster scoped-labels. This
// matches all pods in all namespaces selected by this label selector. // matches all pods in all namespaces selected by this label selector.
// This field follows standard label selector semantics. // This field follows standard label selector semantics.
// If omitted, this selector selects no namespaces.
// If present but empty, this selector selects all namespaces. // If present but empty, this selector selects all namespaces.
// +optional // +optional
NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,2,opt,name=namespaceSelector"` NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,2,opt,name=namespaceSelector"`

View File

@ -340,8 +340,8 @@ func (NetworkPolicy) SwaggerDoc() map[string]string {
var map_NetworkPolicyIngressRule = map[string]string{ var map_NetworkPolicyIngressRule = map[string]string{
"": "This NetworkPolicyIngressRule matches traffic if and only if the traffic matches both ports AND from.", "": "This NetworkPolicyIngressRule matches traffic if and only if the traffic matches both ports AND from.",
"ports": "List of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is not provided, this rule matches all ports (traffic not restricted by port). If this field is empty, this rule matches no ports (no traffic matches). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.", "ports": "List of ports which should be made accessible on the pods selected for this rule. Each item in this list is combined using a logical OR. If this field is empty or missing, this rule matches all ports (traffic not restricted by port). If this field is present and contains at least one item, then this rule allows traffic only if the traffic matches at least one port in the list.",
"from": "List of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is not provided, this rule matches all sources (traffic not restricted by source). If this field is empty, this rule matches no sources (no traffic matches). If this field is present and contains at least on item, this rule allows traffic only if the traffic matches at least one item in the from list.", "from": "List of sources which should be able to access the pods selected for this rule. Items in this list are combined using a logical OR operation. If this field is empty or missing, this rule matches all sources (traffic not restricted by source). If this field is present and contains at least on item, this rule allows traffic only if the traffic matches at least one item in the from list.",
} }
func (NetworkPolicyIngressRule) SwaggerDoc() map[string]string { func (NetworkPolicyIngressRule) SwaggerDoc() map[string]string {
@ -359,8 +359,8 @@ func (NetworkPolicyList) SwaggerDoc() map[string]string {
} }
var map_NetworkPolicyPeer = map[string]string{ var map_NetworkPolicyPeer = map[string]string{
"podSelector": "This is a label selector which selects Pods in this namespace. This field follows standard label selector semantics. If not provided, this selector selects no pods. If present but empty, this selector selects all pods in this namespace.", "podSelector": "This is a label selector which selects Pods in this namespace. This field follows standard label selector semantics. If present but empty, this selector selects all pods in this namespace.",
"namespaceSelector": "Selects Namespaces using cluster scoped-labels. This matches all pods in all namespaces selected by this label selector. This field follows standard label selector semantics. If omitted, this selector selects no namespaces. If present but empty, this selector selects all namespaces.", "namespaceSelector": "Selects Namespaces using cluster scoped-labels. This matches all pods in all namespaces selected by this label selector. This field follows standard label selector semantics. If present but empty, this selector selects all namespaces.",
} }
func (NetworkPolicyPeer) SwaggerDoc() map[string]string { func (NetworkPolicyPeer) SwaggerDoc() map[string]string {

View File

@ -174,12 +174,12 @@ func (f *FakeControllerSource) List(options metav1.ListOptions) (runtime.Object,
if err := meta.SetList(listObj, list); err != nil { if err := meta.SetList(listObj, list); err != nil {
return nil, err return nil, err
} }
objMeta, err := metav1.ListMetaFor(listObj) listAccessor, err := meta.ListAccessor(listObj)
if err != nil { if err != nil {
return nil, err return nil, err
} }
resourceVersion := len(f.changes) resourceVersion := len(f.changes)
objMeta.ResourceVersion = strconv.Itoa(resourceVersion) listAccessor.SetResourceVersion(strconv.Itoa(resourceVersion))
return listObj, nil return listObj, nil
} }
@ -195,12 +195,12 @@ func (f *FakePVControllerSource) List(options metav1.ListOptions) (runtime.Objec
if err := meta.SetList(listObj, list); err != nil { if err := meta.SetList(listObj, list); err != nil {
return nil, err return nil, err
} }
objMeta, err := metav1.ListMetaFor(listObj) listAccessor, err := meta.ListAccessor(listObj)
if err != nil { if err != nil {
return nil, err return nil, err
} }
resourceVersion := len(f.changes) resourceVersion := len(f.changes)
objMeta.ResourceVersion = strconv.Itoa(resourceVersion) listAccessor.SetResourceVersion(strconv.Itoa(resourceVersion))
return listObj, nil return listObj, nil
} }
@ -216,12 +216,12 @@ func (f *FakePVCControllerSource) List(options metav1.ListOptions) (runtime.Obje
if err := meta.SetList(listObj, list); err != nil { if err := meta.SetList(listObj, list); err != nil {
return nil, err return nil, err
} }
objMeta, err := metav1.ListMetaFor(listObj) listAccessor, err := meta.ListAccessor(listObj)
if err != nil { if err != nil {
return nil, err return nil, err
} }
resourceVersion := len(f.changes) resourceVersion := len(f.changes)
objMeta.ResourceVersion = strconv.Itoa(resourceVersion) listAccessor.SetResourceVersion(strconv.Itoa(resourceVersion))
return listObj, nil return listObj, nil
} }

1
vendor/BUILD vendored
View File

@ -13885,6 +13885,7 @@ go_library(
go_library( go_library(
name = "k8s.io/client-go/pkg/api", name = "k8s.io/client-go/pkg/api",
srcs = [ srcs = [
"k8s.io/client-go/pkg/api/annotation_key_constants.go",
"k8s.io/client-go/pkg/api/defaults.go", "k8s.io/client-go/pkg/api/defaults.go",
"k8s.io/client-go/pkg/api/doc.go", "k8s.io/client-go/pkg/api/doc.go",
"k8s.io/client-go/pkg/api/field_constants.go", "k8s.io/client-go/pkg/api/field_constants.go",