Skip to content

Commit

Permalink
Merge pull request #44121 from mbohlool/patch
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Kubernetes Submit Queue authored Apr 8, 2017
2 parents 9c93261 + 5f60dcd commit d043e20
Show file tree
Hide file tree
Showing 26 changed files with 563 additions and 55 deletions.
95 changes: 71 additions & 24 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -37027,7 +37027,9 @@
"properties": {
"key": {
"description": "key is the label key that the selector applies to.",
"type": "string"
"type": "string",
"x-kubernetes-patch-merge-key": "key",
"x-kubernetes-patch-strategy": "merge"
},
"operator": {
"description": "operator represents a key's relationship to a set of values. Valid operators ard In, NotIn, Exists and DoesNotExist.",
Expand Down Expand Up @@ -37087,7 +37089,8 @@
"type": "array",
"items": {
"type": "string"
}
},
"x-kubernetes-patch-strategy": "merge"
},
"generateName": {
"description": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#idempotency",
Expand Down Expand Up @@ -37118,7 +37121,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference"
}
},
"x-kubernetes-patch-merge-key": "uid",
"x-kubernetes-patch-strategy": "merge"
},
"resourceVersion": {
"description": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency",
Expand Down Expand Up @@ -37613,7 +37618,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ComponentCondition"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
Expand Down Expand Up @@ -37834,7 +37841,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.EnvVar"
}
},
"x-kubernetes-patch-merge-key": "name",
"x-kubernetes-patch-strategy": "merge"
},
"envFrom": {
"description": "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
Expand Down Expand Up @@ -37868,7 +37877,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ContainerPort"
}
},
"x-kubernetes-patch-merge-key": "containerPort",
"x-kubernetes-patch-strategy": "merge"
},
"readinessProbe": {
"description": "Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/pod-states#container-probes",
Expand Down Expand Up @@ -37907,7 +37918,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.VolumeMount"
}
},
"x-kubernetes-patch-merge-key": "mountPath",
"x-kubernetes-patch-strategy": "merge"
},
"workingDir": {
"description": "Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image. Cannot be updated.",
Expand Down Expand Up @@ -39213,7 +39226,9 @@
"properties": {
"key": {
"description": "The label key that the selector applies to.",
"type": "string"
"type": "string",
"x-kubernetes-patch-merge-key": "key",
"x-kubernetes-patch-strategy": "merge"
},
"operator": {
"description": "Represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.",
Expand Down Expand Up @@ -39279,7 +39294,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.NodeAddress"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"allocatable": {
"description": "Allocatable represents the resources of a node that are available for scheduling. Defaults to Capacity.",
Expand All @@ -39300,7 +39317,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.NodeCondition"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"daemonEndpoints": {
"description": "Endpoints of daemons running on the Node.",
Expand Down Expand Up @@ -39994,7 +40013,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.Container"
}
},
"x-kubernetes-patch-merge-key": "name",
"x-kubernetes-patch-strategy": "merge"
},
"dnsPolicy": {
"description": "Set DNS policy for containers within the pod. One of 'ClusterFirstWithHostNet', 'ClusterFirst' or 'Default'. Defaults to \"ClusterFirst\". To have DNS options set along with hostNetwork, you have to specify DNS policy explicitly to 'ClusterFirstWithHostNet'.",
Expand All @@ -40021,14 +40042,18 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.LocalObjectReference"
}
},
"x-kubernetes-patch-merge-key": "name",
"x-kubernetes-patch-strategy": "merge"
},
"initContainers": {
"description": "List of initialization containers belonging to the pod. Init containers are executed in order prior to containers being started. If any init container fails, the pod is considered to have failed and is handled according to its restartPolicy. The name for an init container or normal container must be unique among all containers. Init containers may not have Lifecycle actions, Readiness probes, or Liveness probes. The resourceRequirements of an init container are taken into account during scheduling by finding the highest request/limit for each resource type, and then using the max of of that value or the sum of the normal containers. Limits are applied to init containers in a similar fashion. Init containers cannot currently be added or removed. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/containers",
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.Container"
}
},
"x-kubernetes-patch-merge-key": "name",
"x-kubernetes-patch-strategy": "merge"
},
"nodeName": {
"description": "NodeName is a request to schedule this pod onto a specific node. If it is non-empty, the scheduler simply schedules this pod onto that node, assuming that it fits resource requirements.",
Expand Down Expand Up @@ -40082,7 +40107,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.Volume"
}
},
"x-kubernetes-patch-merge-key": "name",
"x-kubernetes-patch-strategy": "merge"
}
}
},
Expand All @@ -40094,7 +40121,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.PodCondition"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"containerStatuses": {
"description": "The list has one entry per container in the manifest. Each entry is currently the output of `docker inspect`. More info: http://kubernetes.io/docs/user-guide/pod-states#container-statuses",
Expand Down Expand Up @@ -40525,7 +40554,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ReplicationControllerCondition"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"fullyLabeledReplicas": {
"description": "The number of pods that have labels matching the labels of the pod template of the replication controller.",
Expand Down Expand Up @@ -41011,7 +41042,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ObjectReference"
}
},
"x-kubernetes-patch-merge-key": "name",
"x-kubernetes-patch-strategy": "merge"
}
},
"x-kubernetes-group-version-kind": [
Expand Down Expand Up @@ -41161,7 +41194,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.ServicePort"
}
},
"x-kubernetes-patch-merge-key": "port",
"x-kubernetes-patch-strategy": "merge"
},
"selector": {
"description": "Route service traffic to pods with label keys and values matching this selector. If empty or not present, the service is assumed to have an external process managing its endpoints, which Kubernetes will not modify. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName. More info: http://kubernetes.io/docs/user-guide/services#overview",
Expand Down Expand Up @@ -41218,7 +41253,9 @@
},
"key": {
"description": "Required. The taint key to be applied to a node.",
"type": "string"
"type": "string",
"x-kubernetes-patch-merge-key": "key",
"x-kubernetes-patch-strategy": "merge"
},
"timeAdded": {
"description": "TimeAdded represents the time at which the taint was added. It is only written for NoExecute taints.",
Expand All @@ -41239,7 +41276,9 @@
},
"key": {
"description": "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.",
"type": "string"
"type": "string",
"x-kubernetes-patch-merge-key": "key",
"x-kubernetes-patch-strategy": "merge"
},
"operator": {
"description": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.",
Expand Down Expand Up @@ -41647,7 +41686,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.apps.v1beta1.DeploymentCondition"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"observedGeneration": {
"description": "The generation observed by the deployment controller.",
Expand Down Expand Up @@ -43181,7 +43222,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.batch.v1.JobCondition"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"failed": {
"description": "Failed is the number of pods which reached Phase Failed.",
Expand Down Expand Up @@ -43857,7 +43900,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.extensions.v1beta1.DeploymentCondition"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"observedGeneration": {
"description": "The generation observed by the deployment controller.",
Expand Down Expand Up @@ -44527,7 +44572,9 @@
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.apis.extensions.v1beta1.ReplicaSetCondition"
}
},
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge"
},
"fullyLabeledReplicas": {
"description": "The number of pods that have labels matching the labels of the pod template of the replicaset.",
Expand Down
Loading

0 comments on commit d043e20

Please sign in to comment.