mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-02-01 09:32:51 +08:00
Merge pull request #64596 from apelisse/openapi-some-cleanup
Automatic merge from submit-queue (batch tested with PRs 64613, 64596, 64573, 64154, 64639). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Openapi some cleanup Clean-up some OpenAPI code, mostly test related (there are two implementations of "Fake"). This is going for master, but I'll probably also cherry-pick/create a similar PR for feature-serverside-apply branch since we'll need that to move some code around. **What this PR does / why we need it**: **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` Kubernetes-commit: c3bb41ad4b147f6159dd7542ffd2772d7042e2d8
This commit is contained in:
commit
0484b08e54
452
Godeps/Godeps.json
generated
452
Godeps/Godeps.json
generated
File diff suppressed because it is too large
Load Diff
1867
vendor/k8s.io/api/core/v1/generated.pb.go
generated
vendored
1867
vendor/k8s.io/api/core/v1/generated.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
14
vendor/k8s.io/api/core/v1/generated.proto
generated
vendored
14
vendor/k8s.io/api/core/v1/generated.proto
generated
vendored
@ -2631,7 +2631,6 @@ message PodAttachOptions {
|
||||
// PodCondition contains details for the current condition of this pod.
|
||||
message PodCondition {
|
||||
// Type is the type of the condition.
|
||||
// Currently only Ready.
|
||||
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
|
||||
optional string type = 1;
|
||||
|
||||
@ -2800,6 +2799,12 @@ message PodProxyOptions {
|
||||
optional string path = 1;
|
||||
}
|
||||
|
||||
// PodReadinessGate contains the reference to a pod condition
|
||||
message PodReadinessGate {
|
||||
// ConditionType refers to a condition in the pod's condition list with matching type.
|
||||
optional string conditionType = 1;
|
||||
}
|
||||
|
||||
// PodSecurityContext holds pod-level security attributes and common container settings.
|
||||
// Some fields are also present in container.securityContext. Field values of
|
||||
// container.securityContext take precedence over field values of PodSecurityContext.
|
||||
@ -3052,6 +3057,13 @@ message PodSpec {
|
||||
// configuration based on DNSPolicy.
|
||||
// +optional
|
||||
optional PodDNSConfig dnsConfig = 26;
|
||||
|
||||
// If specified, all readiness gates will be evaluated for pod readiness.
|
||||
// A pod is ready when all its containers are ready AND
|
||||
// all conditions specified in the readiness gates have status equal to "True"
|
||||
// More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md
|
||||
// +optional
|
||||
repeated PodReadinessGate readinessGates = 28;
|
||||
}
|
||||
|
||||
// PodStatus represents information about the status of a pod. Status may trail the actual
|
||||
|
14
vendor/k8s.io/api/core/v1/types.go
generated
vendored
14
vendor/k8s.io/api/core/v1/types.go
generated
vendored
@ -2288,7 +2288,6 @@ const (
|
||||
// PodCondition contains details for the current condition of this pod.
|
||||
type PodCondition struct {
|
||||
// Type is the type of the condition.
|
||||
// Currently only Ready.
|
||||
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
|
||||
Type PodConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=PodConditionType"`
|
||||
// Status is the status of the condition.
|
||||
@ -2632,6 +2631,12 @@ const (
|
||||
TolerationOpEqual TolerationOperator = "Equal"
|
||||
)
|
||||
|
||||
// PodReadinessGate contains the reference to a pod condition
|
||||
type PodReadinessGate struct {
|
||||
// ConditionType refers to a condition in the pod's condition list with matching type.
|
||||
ConditionType PodConditionType `json:"conditionType" protobuf:"bytes,1,opt,name=conditionType,casttype=PodConditionType"`
|
||||
}
|
||||
|
||||
// PodSpec is a description of a pod.
|
||||
type PodSpec struct {
|
||||
// List of volumes that can be mounted by containers belonging to the pod.
|
||||
@ -2796,6 +2801,13 @@ type PodSpec struct {
|
||||
// configuration based on DNSPolicy.
|
||||
// +optional
|
||||
DNSConfig *PodDNSConfig `json:"dnsConfig,omitempty" protobuf:"bytes,26,opt,name=dnsConfig"`
|
||||
|
||||
// If specified, all readiness gates will be evaluated for pod readiness.
|
||||
// A pod is ready when all its containers are ready AND
|
||||
// all conditions specified in the readiness gates have status equal to "True"
|
||||
// More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md
|
||||
// +optional
|
||||
ReadinessGates []PodReadinessGate `json:"readinessGates,omitempty" protobuf:"bytes,28,opt,name=readinessGates"`
|
||||
}
|
||||
|
||||
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
|
||||
|
12
vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go
generated
vendored
12
vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go
generated
vendored
@ -1359,7 +1359,7 @@ func (PodAttachOptions) SwaggerDoc() map[string]string {
|
||||
|
||||
var map_PodCondition = map[string]string{
|
||||
"": "PodCondition contains details for the current condition of this pod.",
|
||||
"type": "Type is the type of the condition. Currently only Ready. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions",
|
||||
"type": "Type is the type of the condition. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions",
|
||||
"status": "Status is the status of the condition. Can be True, False, Unknown. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions",
|
||||
"lastProbeTime": "Last time we probed the condition.",
|
||||
"lastTransitionTime": "Last time the condition transitioned from one status to another.",
|
||||
@ -1449,6 +1449,15 @@ func (PodProxyOptions) SwaggerDoc() map[string]string {
|
||||
return map_PodProxyOptions
|
||||
}
|
||||
|
||||
var map_PodReadinessGate = map[string]string{
|
||||
"": "PodReadinessGate contains the reference to a pod condition",
|
||||
"conditionType": "ConditionType refers to a condition in the pod's condition list with matching type.",
|
||||
}
|
||||
|
||||
func (PodReadinessGate) SwaggerDoc() map[string]string {
|
||||
return map_PodReadinessGate
|
||||
}
|
||||
|
||||
var map_PodSecurityContext = map[string]string{
|
||||
"": "PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.",
|
||||
"seLinuxOptions": "The SELinux context to be applied to all containers. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container.",
|
||||
@ -1501,6 +1510,7 @@ var map_PodSpec = map[string]string{
|
||||
"priorityClassName": "If specified, indicates the pod's priority. \"system-node-critical\" and \"system-cluster-critical\" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.",
|
||||
"priority": "The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.",
|
||||
"dnsConfig": "Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy.",
|
||||
"readinessGates": "If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to \"True\" More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md",
|
||||
}
|
||||
|
||||
func (PodSpec) SwaggerDoc() map[string]string {
|
||||
|
21
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go
generated
vendored
21
vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go
generated
vendored
@ -3715,6 +3715,22 @@ func (in *PodProxyOptions) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PodReadinessGate) DeepCopyInto(out *PodReadinessGate) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodReadinessGate.
|
||||
func (in *PodReadinessGate) DeepCopy() *PodReadinessGate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PodReadinessGate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PodSecurityContext) DeepCopyInto(out *PodSecurityContext) {
|
||||
*out = *in
|
||||
@ -3928,6 +3944,11 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) {
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
if in.ReadinessGates != nil {
|
||||
in, out := &in.ReadinessGates, &out.ReadinessGates
|
||||
*out = make([]PodReadinessGate, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
4
vendor/k8s.io/code-generator/Godeps/Godeps.json
generated
vendored
4
vendor/k8s.io/code-generator/Godeps/Godeps.json
generated
vendored
@ -260,11 +260,11 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/generators",
|
||||
"Rev": "86e28c192d2743f0232b9bc5f0a531568ef9f2a5"
|
||||
"Rev": "8a9b82f00b3a86eac24681da3f9fe6c34c01cea2"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
74
vendor/k8s.io/kube-openapi/pkg/util/proto/document.go
generated
vendored
74
vendor/k8s.io/kube-openapi/pkg/util/proto/document.go
generated
vendored
@ -21,8 +21,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
"github.com/googleapis/gnostic/OpenAPIv2"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func newSchemaError(path *Path, format string, a ...interface{}) error {
|
||||
@ -126,12 +126,17 @@ func (d *Definitions) parseMap(s *openapi_v2.Schema, path *Path) (Schema, error)
|
||||
if len(s.GetType().GetValue()) != 0 && s.GetType().GetValue()[0] != object {
|
||||
return nil, newSchemaError(path, "invalid object type")
|
||||
}
|
||||
var sub Schema
|
||||
if s.GetAdditionalProperties().GetSchema() == nil {
|
||||
return nil, newSchemaError(path, "invalid object doesn't have additional properties")
|
||||
}
|
||||
sub, err := d.ParseSchema(s.GetAdditionalProperties().GetSchema(), path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
sub = &Arbitrary{
|
||||
BaseSchema: d.parseBaseSchema(s, path),
|
||||
}
|
||||
} else {
|
||||
var err error
|
||||
sub, err = d.ParseSchema(s.GetAdditionalProperties().GetSchema(), path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return &Map{
|
||||
BaseSchema: d.parseBaseSchema(s, path),
|
||||
@ -148,12 +153,10 @@ func (d *Definitions) parsePrimitive(s *openapi_v2.Schema, path *Path) (Schema,
|
||||
t = s.GetType().GetValue()[0]
|
||||
}
|
||||
switch t {
|
||||
case String:
|
||||
case Number:
|
||||
case Integer:
|
||||
case Boolean:
|
||||
case "": // Some models are completely empty, and can be safely ignored.
|
||||
// Do nothing
|
||||
case String: // do nothing
|
||||
case Number: // do nothing
|
||||
case Integer: // do nothing
|
||||
case Boolean: // do nothing
|
||||
default:
|
||||
return nil, newSchemaError(path, "Unknown primitive type: %q", t)
|
||||
}
|
||||
@ -219,27 +222,38 @@ func (d *Definitions) parseArbitrary(s *openapi_v2.Schema, path *Path) (Schema,
|
||||
// ParseSchema creates a walkable Schema from an openapi schema. While
|
||||
// this function is public, it doesn't leak through the interface.
|
||||
func (d *Definitions) ParseSchema(s *openapi_v2.Schema, path *Path) (Schema, error) {
|
||||
objectTypes := s.GetType().GetValue()
|
||||
if len(objectTypes) == 1 {
|
||||
t := objectTypes[0]
|
||||
switch t {
|
||||
case object:
|
||||
return d.parseMap(s, path)
|
||||
case array:
|
||||
return d.parseArray(s, path)
|
||||
}
|
||||
|
||||
}
|
||||
if s.GetXRef() != "" {
|
||||
return d.parseReference(s, path)
|
||||
}
|
||||
if s.GetProperties() != nil {
|
||||
return d.parseKind(s, path)
|
||||
objectTypes := s.GetType().GetValue()
|
||||
switch len(objectTypes) {
|
||||
case 0:
|
||||
// in the OpenAPI schema served by older k8s versions, object definitions created from structs did not include
|
||||
// the type:object property (they only included the "properties" property), so we need to handle this case
|
||||
if s.GetProperties() != nil {
|
||||
return d.parseKind(s, path)
|
||||
} else {
|
||||
// Definition has no type and no properties. Treat it as an arbitrary value
|
||||
// TODO: what if it has additionalProperties or patternProperties?
|
||||
return d.parseArbitrary(s, path)
|
||||
}
|
||||
case 1:
|
||||
t := objectTypes[0]
|
||||
switch t {
|
||||
case object:
|
||||
if s.GetProperties() != nil {
|
||||
return d.parseKind(s, path)
|
||||
} else {
|
||||
return d.parseMap(s, path)
|
||||
}
|
||||
case array:
|
||||
return d.parseArray(s, path)
|
||||
}
|
||||
return d.parsePrimitive(s, path)
|
||||
default:
|
||||
// the OpenAPI generator never generates (nor it ever did in the past) OpenAPI type definitions with multiple types
|
||||
return nil, newSchemaError(path, "definitions with multiple types aren't supported")
|
||||
}
|
||||
if len(objectTypes) == 0 || (len(objectTypes) == 1 && objectTypes[0] == "") {
|
||||
return d.parseArbitrary(s, path)
|
||||
}
|
||||
return d.parsePrimitive(s, path)
|
||||
}
|
||||
|
||||
// LookupModel is public through the interface of Models. It
|
||||
|
2
vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go
generated
vendored
2
vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go
generated
vendored
@ -59,7 +59,7 @@ type SchemaVisitor interface {
|
||||
}
|
||||
|
||||
// SchemaVisitorArbitrary is an additional visitor interface which handles
|
||||
// arbitrary types. For backwards compatability, it's a separate interface
|
||||
// arbitrary types. For backwards compatibility, it's a separate interface
|
||||
// which is checked for at runtime.
|
||||
type SchemaVisitorArbitrary interface {
|
||||
SchemaVisitor
|
||||
|
Loading…
Reference in New Issue
Block a user