mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #10076 from caesarxuchao/pr/9966/head
based on #9966: fix annoying 'please check...' messages; remove v1beta1&2 ref
This commit is contained in:
		@@ -42,7 +42,7 @@ func addConversionFuncs() {
 | 
				
			|||||||
			case "metadata.name",
 | 
								case "metadata.name",
 | 
				
			||||||
				"metadata.namespace",
 | 
									"metadata.namespace",
 | 
				
			||||||
				"status.phase",
 | 
									"status.phase",
 | 
				
			||||||
				"spec.host":
 | 
									"spec.nodeName":
 | 
				
			||||||
				return label, value, nil
 | 
									return label, value, nil
 | 
				
			||||||
			default:
 | 
								default:
 | 
				
			||||||
				return "", "", fmt.Errorf("field label not supported: %s", label)
 | 
									return "", "", fmt.Errorf("field label not supported: %s", label)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,9 +53,10 @@ func addConversionFuncs() {
 | 
				
			|||||||
			switch label {
 | 
								switch label {
 | 
				
			||||||
			case "metadata.name",
 | 
								case "metadata.name",
 | 
				
			||||||
				"metadata.namespace",
 | 
									"metadata.namespace",
 | 
				
			||||||
				"status.phase",
 | 
									"status.phase":
 | 
				
			||||||
				"spec.host":
 | 
					 | 
				
			||||||
				return label, value, nil
 | 
									return label, value, nil
 | 
				
			||||||
 | 
								case "spec.host":
 | 
				
			||||||
 | 
									return "spec.nodeName", value, nil
 | 
				
			||||||
			default:
 | 
								default:
 | 
				
			||||||
				return "", "", fmt.Errorf("field label not supported: %s", label)
 | 
									return "", "", fmt.Errorf("field label not supported: %s", label)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -260,8 +260,18 @@ const (
 | 
				
			|||||||
	// Will be automatically emitted as the correct name for the API version.
 | 
						// Will be automatically emitted as the correct name for the API version.
 | 
				
			||||||
	NodeUnschedulable = "spec.unschedulable"
 | 
						NodeUnschedulable = "spec.unschedulable"
 | 
				
			||||||
	ObjectNameField   = "metadata.name"
 | 
						ObjectNameField   = "metadata.name"
 | 
				
			||||||
	PodHost           = "spec.host"
 | 
						PodHost           = "spec.nodeName"
 | 
				
			||||||
	SecretType        = "type"
 | 
						SecretType        = "type"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						EventReason                  = "reason"
 | 
				
			||||||
 | 
						EventSource                  = "source"
 | 
				
			||||||
 | 
						EventInvolvedKind            = "involvedObject.kind"
 | 
				
			||||||
 | 
						EventInvolvedNamespace       = "involvedObject.namespace"
 | 
				
			||||||
 | 
						EventInvolvedName            = "involvedObject.name"
 | 
				
			||||||
 | 
						EventInvolvedUID             = "involvedObject.uid"
 | 
				
			||||||
 | 
						EventInvolvedAPIVersion      = "involvedObject.apiVersion"
 | 
				
			||||||
 | 
						EventInvolvedResourceVersion = "involvedObject.resourceVersion"
 | 
				
			||||||
 | 
						EventInvolvedFieldPath       = "involvedObject.fieldPath"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type clientFieldNameToAPIVersionFieldName map[string]string
 | 
					type clientFieldNameToAPIVersionFieldName map[string]string
 | 
				
			||||||
@@ -302,44 +312,6 @@ func (v versionToResourceToFieldMapping) filterField(apiVersion, resourceType, f
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var fieldMappings = versionToResourceToFieldMapping{
 | 
					var fieldMappings = versionToResourceToFieldMapping{
 | 
				
			||||||
	"v1beta1": resourceTypeToFieldMapping{
 | 
					 | 
				
			||||||
		"nodes": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			ObjectNameField:   "name",
 | 
					 | 
				
			||||||
			NodeUnschedulable: "unschedulable",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"minions": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			ObjectNameField:   "name",
 | 
					 | 
				
			||||||
			NodeUnschedulable: "unschedulable",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"pods": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			PodHost: "DesiredState.Host",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"secrets": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			SecretType: "type",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"serviceAccounts": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			ObjectNameField: "name",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	"v1beta2": resourceTypeToFieldMapping{
 | 
					 | 
				
			||||||
		"nodes": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			ObjectNameField:   "name",
 | 
					 | 
				
			||||||
			NodeUnschedulable: "unschedulable",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"minions": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			ObjectNameField:   "name",
 | 
					 | 
				
			||||||
			NodeUnschedulable: "unschedulable",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"pods": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			PodHost: "DesiredState.Host",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"secrets": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			SecretType: "type",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		"serviceAccounts": clientFieldNameToAPIVersionFieldName{
 | 
					 | 
				
			||||||
			ObjectNameField: "name",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	"v1beta3": resourceTypeToFieldMapping{
 | 
						"v1beta3": resourceTypeToFieldMapping{
 | 
				
			||||||
		"nodes": clientFieldNameToAPIVersionFieldName{
 | 
							"nodes": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
			ObjectNameField:   "metadata.name",
 | 
								ObjectNameField:   "metadata.name",
 | 
				
			||||||
@@ -358,6 +330,51 @@ var fieldMappings = versionToResourceToFieldMapping{
 | 
				
			|||||||
		"serviceAccounts": clientFieldNameToAPIVersionFieldName{
 | 
							"serviceAccounts": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
			ObjectNameField: "metadata.name",
 | 
								ObjectNameField: "metadata.name",
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							"endpoints": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
 | 
								ObjectNameField: "metadata.name",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"events": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
 | 
								ObjectNameField:              "metadata.name",
 | 
				
			||||||
 | 
								EventReason:                  "reason",
 | 
				
			||||||
 | 
								EventSource:                  "source",
 | 
				
			||||||
 | 
								EventInvolvedKind:            "involvedObject.kind",
 | 
				
			||||||
 | 
								EventInvolvedNamespace:       "involvedObject.namespace",
 | 
				
			||||||
 | 
								EventInvolvedName:            "involvedObject.name",
 | 
				
			||||||
 | 
								EventInvolvedUID:             "involvedObject.uid",
 | 
				
			||||||
 | 
								EventInvolvedAPIVersion:      "involvedObject.apiVersion",
 | 
				
			||||||
 | 
								EventInvolvedResourceVersion: "involvedObject.resourceVersion",
 | 
				
			||||||
 | 
								EventInvolvedFieldPath:       "involvedObject.fieldPath",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						"v1": resourceTypeToFieldMapping{
 | 
				
			||||||
 | 
							"nodes": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
 | 
								ObjectNameField:   "metadata.name",
 | 
				
			||||||
 | 
								NodeUnschedulable: "spec.unschedulable",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"pods": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
 | 
								PodHost: "spec.nodeName",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"secrets": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
 | 
								SecretType: "type",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"serviceAccounts": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
 | 
								ObjectNameField: "metadata.name",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"endpoints": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
 | 
								ObjectNameField: "metadata.name",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"events": clientFieldNameToAPIVersionFieldName{
 | 
				
			||||||
 | 
								ObjectNameField:              "metadata.name",
 | 
				
			||||||
 | 
								EventReason:                  "reason",
 | 
				
			||||||
 | 
								EventSource:                  "source",
 | 
				
			||||||
 | 
								EventInvolvedKind:            "involvedObject.kind",
 | 
				
			||||||
 | 
								EventInvolvedNamespace:       "involvedObject.namespace",
 | 
				
			||||||
 | 
								EventInvolvedName:            "involvedObject.name",
 | 
				
			||||||
 | 
								EventInvolvedUID:             "involvedObject.uid",
 | 
				
			||||||
 | 
								EventInvolvedAPIVersion:      "involvedObject.apiVersion",
 | 
				
			||||||
 | 
								EventInvolvedResourceVersion: "involvedObject.resourceVersion",
 | 
				
			||||||
 | 
								EventInvolvedFieldPath:       "involvedObject.fieldPath",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -323,13 +323,13 @@ func TestListPodListSelection(t *testing.T) {
 | 
				
			|||||||
			field:       "status.phase=Failed",
 | 
								field:       "status.phase=Failed",
 | 
				
			||||||
			expectedIDs: util.NewStringSet("baz"),
 | 
								expectedIDs: util.NewStringSet("baz"),
 | 
				
			||||||
		}, {
 | 
							}, {
 | 
				
			||||||
			field:       "spec.host=barhost",
 | 
								field:       "spec.nodeName=barhost",
 | 
				
			||||||
			expectedIDs: util.NewStringSet("bar"),
 | 
								expectedIDs: util.NewStringSet("bar"),
 | 
				
			||||||
		}, {
 | 
							}, {
 | 
				
			||||||
			field:       "spec.host=",
 | 
								field:       "spec.nodeName=",
 | 
				
			||||||
			expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"),
 | 
								expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"),
 | 
				
			||||||
		}, {
 | 
							}, {
 | 
				
			||||||
			field:       "spec.host!=",
 | 
								field:       "spec.nodeName!=",
 | 
				
			||||||
			expectedIDs: util.NewStringSet("bar"),
 | 
								expectedIDs: util.NewStringSet("bar"),
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,7 +123,7 @@ func MatchPod(label labels.Selector, field fields.Selector) generic.Matcher {
 | 
				
			|||||||
func PodToSelectableFields(pod *api.Pod) fields.Set {
 | 
					func PodToSelectableFields(pod *api.Pod) fields.Set {
 | 
				
			||||||
	return fields.Set{
 | 
						return fields.Set{
 | 
				
			||||||
		"metadata.name": pod.Name,
 | 
							"metadata.name": pod.Name,
 | 
				
			||||||
		"spec.host":     pod.Spec.NodeName,
 | 
							"spec.nodeName": pod.Spec.NodeName,
 | 
				
			||||||
		"status.phase":  string(pod.Status.Phase),
 | 
							"status.phase":  string(pod.Status.Phase),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user