mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Merge pull request #44121 from mbohlool/patch
Automatic merge from submit-queue (batch tested with PRs 43777, 44121) Add patchMergeKey and patchStrategy support to OpenAPI Support generating Open API extensions for strategic merge patch tags in go struct tags Support `patchStrategy` and `patchMergeKey`. Also support checking if the Open API extension and struct tags match. ```release-note Support generating Open API extensions for strategic merge patch tags in go struct tags ``` cc: @pwittrock @ymqytw (Description mostly copied from #43833)
This commit is contained in:
@@ -245,6 +245,8 @@ message ComponentStatus {
|
||||
|
||||
// List of component conditions observed
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
repeated ComponentCondition conditions = 2;
|
||||
}
|
||||
|
||||
@@ -415,6 +417,8 @@ message Container {
|
||||
// accessible from the network.
|
||||
// Cannot be updated.
|
||||
// +optional
|
||||
// +patchMergeKey=containerPort
|
||||
// +patchStrategy=merge
|
||||
repeated ContainerPort ports = 6;
|
||||
|
||||
// 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.
|
||||
// Cannot be updated.
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
repeated EnvVar env = 7;
|
||||
|
||||
// Compute Resources required by this container.
|
||||
@@ -440,6 +446,8 @@ message Container {
|
||||
// Pod volumes to mount into the container's filesystem.
|
||||
// Cannot be updated.
|
||||
// +optional
|
||||
// +patchMergeKey=mountPath
|
||||
// +patchStrategy=merge
|
||||
repeated VolumeMount volumeMounts = 9;
|
||||
|
||||
// Periodic probe of container liveness.
|
||||
@@ -1603,6 +1611,8 @@ message NodeSelector {
|
||||
// that relates the key and values.
|
||||
message NodeSelectorRequirement {
|
||||
// The label key that the selector applies to.
|
||||
// +patchMergeKey=key
|
||||
// +patchStrategy=merge
|
||||
optional string key = 1;
|
||||
|
||||
// Represents a key's relationship to a set of values.
|
||||
@@ -1670,12 +1680,16 @@ message NodeStatus {
|
||||
// Conditions is an array of current observed node conditions.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-condition
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
repeated NodeCondition conditions = 4;
|
||||
|
||||
// List of addresses reachable to the node.
|
||||
// Queried from cloud provider, if available.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-addresses
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
repeated NodeAddress addresses = 5;
|
||||
|
||||
// Endpoints of daemons running on the Node.
|
||||
@@ -1881,6 +1895,8 @@ message ObjectMeta {
|
||||
// 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.
|
||||
// +optional
|
||||
// +patchMergeKey=uid
|
||||
// +patchStrategy=merge
|
||||
repeated k8s.io.apimachinery.pkg.apis.meta.v1.OwnerReference ownerReferences = 13;
|
||||
|
||||
// Must be empty before the object is deleted from the registry. Each entry
|
||||
@@ -1888,6 +1904,7 @@ message ObjectMeta {
|
||||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||
// in this list can only be removed.
|
||||
// +optional
|
||||
// +patchStrategy=merge
|
||||
repeated string finalizers = 14;
|
||||
|
||||
// The name of the cluster which the object belongs to.
|
||||
@@ -2574,6 +2591,8 @@ message PodSpec {
|
||||
// List of volumes that can be mounted by containers belonging to the pod.
|
||||
// More info: http://kubernetes.io/docs/user-guide/volumes
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
repeated Volume volumes = 1;
|
||||
|
||||
// List of initialization containers belonging to the pod.
|
||||
@@ -2589,6 +2608,8 @@ message PodSpec {
|
||||
// Init containers cannot currently be added or removed.
|
||||
// Cannot be updated.
|
||||
// More info: http://kubernetes.io/docs/user-guide/containers
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
repeated Container initContainers = 20;
|
||||
|
||||
// List of containers belonging to the pod.
|
||||
@@ -2596,6 +2617,8 @@ message PodSpec {
|
||||
// There must be at least one container in a Pod.
|
||||
// Cannot be updated.
|
||||
// More info: http://kubernetes.io/docs/user-guide/containers
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
repeated Container containers = 2;
|
||||
|
||||
// Restart policy for all containers within the pod.
|
||||
@@ -2684,6 +2707,8 @@ message PodSpec {
|
||||
// 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
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
repeated LocalObjectReference imagePullSecrets = 15;
|
||||
|
||||
// Specifies the hostname of the Pod
|
||||
@@ -2721,6 +2746,8 @@ message PodStatus {
|
||||
// Current service state of pod.
|
||||
// More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
repeated PodCondition conditions = 2;
|
||||
|
||||
// A human readable message indicating details about why the pod is in this condition.
|
||||
@@ -3119,6 +3146,8 @@ message ReplicationControllerStatus {
|
||||
|
||||
// Represents the latest available observations of a replication controller's current state.
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
repeated ReplicationControllerCondition conditions = 6;
|
||||
}
|
||||
|
||||
@@ -3480,6 +3509,8 @@ message 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
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
repeated ObjectReference secrets = 2;
|
||||
|
||||
// ImagePullSecrets is a list of references to secrets in the same namespace to use for pulling any images
|
||||
@@ -3570,6 +3601,8 @@ message ServiceProxyOptions {
|
||||
message ServiceSpec {
|
||||
// The list of ports that are exposed by this service.
|
||||
// More info: http://kubernetes.io/docs/user-guide/services#virtual-ips-and-service-proxies
|
||||
// +patchMergeKey=port
|
||||
// +patchStrategy=merge
|
||||
repeated ServicePort ports = 1;
|
||||
|
||||
// Route service traffic to pods with label keys and values matching this
|
||||
@@ -3689,6 +3722,8 @@ message TCPSocketAction {
|
||||
// any pod that that does not tolerate the Taint.
|
||||
message Taint {
|
||||
// Required. The taint key to be applied to a node.
|
||||
// +patchMergeKey=key
|
||||
// +patchStrategy=merge
|
||||
optional string key = 1;
|
||||
|
||||
// Required. The taint value corresponding to the taint key.
|
||||
@@ -3712,6 +3747,8 @@ message Toleration {
|
||||
// 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.
|
||||
// +optional
|
||||
// +patchMergeKey=key
|
||||
// +patchStrategy=merge
|
||||
optional string key = 1;
|
||||
|
||||
// Operator represents a key's relationship to the value.
|
||||
|
||||
@@ -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.
|
||||
// There cannot be more than one managing controller.
|
||||
// +optional
|
||||
// +patchMergeKey=uid
|
||||
// +patchStrategy=merge
|
||||
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
|
||||
@@ -204,6 +206,7 @@ type ObjectMeta struct {
|
||||
// from the list. If the deletionTimestamp of the object is non-nil, entries
|
||||
// in this list can only be removed.
|
||||
// +optional
|
||||
// +patchStrategy=merge
|
||||
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
|
||||
|
||||
// The name of the cluster which the object belongs to.
|
||||
@@ -1646,6 +1649,8 @@ type Container struct {
|
||||
// accessible from the network.
|
||||
// Cannot be updated.
|
||||
// +optional
|
||||
// +patchMergeKey=containerPort
|
||||
// +patchStrategy=merge
|
||||
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.
|
||||
// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
|
||||
@@ -1658,6 +1663,8 @@ type Container struct {
|
||||
// List of environment variables to set in the container.
|
||||
// Cannot be updated.
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
Env []EnvVar `json:"env,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,7,rep,name=env"`
|
||||
// Compute Resources required by this container.
|
||||
// Cannot be updated.
|
||||
@@ -1667,6 +1674,8 @@ type Container struct {
|
||||
// Pod volumes to mount into the container's filesystem.
|
||||
// Cannot be updated.
|
||||
// +optional
|
||||
// +patchMergeKey=mountPath
|
||||
// +patchStrategy=merge
|
||||
VolumeMounts []VolumeMount `json:"volumeMounts,omitempty" patchStrategy:"merge" patchMergeKey:"mountPath" protobuf:"bytes,9,rep,name=volumeMounts"`
|
||||
// Periodic probe of container liveness.
|
||||
// Container will be restarted if the probe fails.
|
||||
@@ -1987,6 +1996,8 @@ type NodeSelectorTerm struct {
|
||||
// that relates the key and values.
|
||||
type NodeSelectorRequirement struct {
|
||||
// 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"`
|
||||
// Represents a key's relationship to a set of values.
|
||||
// Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
|
||||
@@ -2171,6 +2182,8 @@ type PreferredSchedulingTerm struct {
|
||||
// any pod that that does not tolerate the Taint.
|
||||
type Taint struct {
|
||||
// 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"`
|
||||
// Required. The taint value corresponding to the taint key.
|
||||
// +optional
|
||||
@@ -2213,6 +2226,8 @@ type Toleration struct {
|
||||
// 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.
|
||||
// +optional
|
||||
// +patchMergeKey=key
|
||||
// +patchStrategy=merge
|
||||
Key string `json:"key,omitempty" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
|
||||
// Operator represents a key's relationship to the value.
|
||||
// Valid operators are Exists and Equal. Defaults to Equal.
|
||||
@@ -2270,6 +2285,8 @@ type PodSpec struct {
|
||||
// List of volumes that can be mounted by containers belonging to the pod.
|
||||
// More info: http://kubernetes.io/docs/user-guide/volumes
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
Volumes []Volume `json:"volumes,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,1,rep,name=volumes"`
|
||||
// List of initialization containers belonging to the pod.
|
||||
// Init containers are executed in order prior to containers being started. If any
|
||||
@@ -2284,12 +2301,16 @@ type PodSpec struct {
|
||||
// Init containers cannot currently be added or removed.
|
||||
// Cannot be updated.
|
||||
// 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"`
|
||||
// List of containers belonging to the pod.
|
||||
// Containers cannot currently be added or removed.
|
||||
// There must be at least one container in a Pod.
|
||||
// Cannot be updated.
|
||||
// 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"`
|
||||
// Restart policy for all containers within the pod.
|
||||
// One of Always, OnFailure, Never.
|
||||
@@ -2366,6 +2387,8 @@ type PodSpec struct {
|
||||
// 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
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
ImagePullSecrets []LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,15,rep,name=imagePullSecrets"`
|
||||
// Specifies the hostname of the Pod
|
||||
// If not specified, the pod's hostname will be set to a system-defined value.
|
||||
@@ -2453,6 +2476,8 @@ type PodStatus struct {
|
||||
// Current service state of pod.
|
||||
// More info: http://kubernetes.io/docs/user-guide/pod-states#pod-conditions
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
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.
|
||||
// +optional
|
||||
@@ -2649,6 +2674,8 @@ type ReplicationControllerStatus struct {
|
||||
|
||||
// Represents the latest available observations of a replication controller's current state.
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
Conditions []ReplicationControllerCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
|
||||
}
|
||||
|
||||
@@ -2786,6 +2813,8 @@ type LoadBalancerIngress struct {
|
||||
type ServiceSpec struct {
|
||||
// The list of ports that are exposed by this service.
|
||||
// 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"`
|
||||
|
||||
// Route service traffic to pods with label keys and values matching this
|
||||
@@ -2971,6 +3000,8 @@ type ServiceAccount struct {
|
||||
// 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
|
||||
// +optional
|
||||
// +patchMergeKey=name
|
||||
// +patchStrategy=merge
|
||||
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
|
||||
@@ -3191,11 +3222,15 @@ type NodeStatus struct {
|
||||
// Conditions is an array of current observed node conditions.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-condition
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
Conditions []NodeCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,4,rep,name=conditions"`
|
||||
// List of addresses reachable to the node.
|
||||
// Queried from cloud provider, if available.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-addresses
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
Addresses []NodeAddress `json:"addresses,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,5,rep,name=addresses"`
|
||||
// Endpoints of daemons running on the Node.
|
||||
// +optional
|
||||
@@ -4244,6 +4279,8 @@ type ComponentStatus struct {
|
||||
|
||||
// List of component conditions observed
|
||||
// +optional
|
||||
// +patchMergeKey=type
|
||||
// +patchStrategy=merge
|
||||
Conditions []ComponentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user