本文整理汇总了Golang中k8s/io/kubernetes/pkg/registry/generic.MergeFieldsSets函数的典型用法代码示例。如果您正苦于以下问题:Golang MergeFieldsSets函数的具体用法?Golang MergeFieldsSets怎么用?Golang MergeFieldsSets使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MergeFieldsSets函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ControllerToSelectableFields
// ControllerToSelectableFields returns a field set that represents the object.
func ControllerToSelectableFields(controller *api.ReplicationController) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(controller.ObjectMeta, true)
controllerSpecificFieldsSet := fields.Set{
"status.replicas": strconv.Itoa(int(controller.Status.Replicas)),
}
return generic.MergeFieldsSets(objectMetaFieldsSet, controllerSpecificFieldsSet)
}
示例2: NodeToSelectableFields
// NodeToSelectableFields returns a field set that represents the object.
func NodeToSelectableFields(node *api.Node) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(&node.ObjectMeta, false)
specificFieldsSet := fields.Set{
"spec.unschedulable": fmt.Sprint(node.Spec.Unschedulable),
}
return generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet)
}
示例3: ReplicaSetToSelectableFields
// ReplicaSetToSelectableFields returns a field set that represents the object.
func ReplicaSetToSelectableFields(rs *extensions.ReplicaSet) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(&rs.ObjectMeta, true)
rsSpecificFieldsSet := fields.Set{
"status.replicas": strconv.Itoa(int(rs.Status.Replicas)),
}
return generic.MergeFieldsSets(objectMetaFieldsSet, rsSpecificFieldsSet)
}
示例4: JobToSelectableFields
// JobSelectableFields returns a field set that represents the object for matching purposes.
func JobToSelectableFields(job *extensions.Job) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(job.ObjectMeta, true)
specificFieldsSet := fields.Set{
"status.successful": strconv.Itoa(job.Status.Succeeded),
}
return generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet)
}
示例5: SelectableFields
// SelectableFields returns a label set that can be used for filter selection
func SelectableFields(obj *api.Secret) labels.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(obj.ObjectMeta, true)
secretSpecificFieldsSet := fields.Set{
"type": string(obj.Type),
}
return labels.Set(generic.MergeFieldsSets(objectMetaFieldsSet, secretSpecificFieldsSet))
}
示例6: getAttrs
func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, err error) {
event, ok := obj.(*api.Event)
if !ok {
return nil, nil, errors.NewInternalError(fmt.Errorf("object is not of type event: %#v", obj))
}
l := event.Labels
if l == nil {
l = labels.Set{}
}
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(event.ObjectMeta, true)
specificFieldsSet := fields.Set{
"involvedObject.kind": event.InvolvedObject.Kind,
"involvedObject.namespace": event.InvolvedObject.Namespace,
"involvedObject.name": event.InvolvedObject.Name,
"involvedObject.uid": string(event.InvolvedObject.UID),
"involvedObject.apiVersion": event.InvolvedObject.APIVersion,
"involvedObject.resourceVersion": event.InvolvedObject.ResourceVersion,
"involvedObject.fieldPath": event.InvolvedObject.FieldPath,
"reason": event.Reason,
"source": event.Source.Component,
"type": event.Type,
}
return l, generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet), nil
}
示例7: PersistentVolumeClaimToSelectableFields
// PersistentVolumeClaimToSelectableFields returns a field set that represents the object
func PersistentVolumeClaimToSelectableFields(persistentvolumeclaim *api.PersistentVolumeClaim) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(persistentvolumeclaim.ObjectMeta, true)
specificFieldsSet := fields.Set{
// This is a bug, but we need to support it for backward compatibility.
"name": persistentvolumeclaim.Name,
}
return generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet)
}
示例8: PodToSelectableFields
// PodToSelectableFields returns a field set that represents the object
// TODO: fields are not labels, and the validation rules for them do not apply.
func PodToSelectableFields(pod *api.Pod) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(pod.ObjectMeta, true)
podSpecificFieldsSet := fields.Set{
"spec.nodeName": pod.Spec.NodeName,
"status.phase": string(pod.Status.Phase),
}
return generic.MergeFieldsSets(objectMetaFieldsSet, podSpecificFieldsSet)
}
示例9: PersistentVolumeToSelectableFields
// PersistentVolumeToSelectableFields returns a label set that represents the object
func PersistentVolumeToSelectableFields(persistentvolume *api.PersistentVolume) labels.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(persistentvolume.ObjectMeta, false)
specificFieldsSet := fields.Set{
// This is a bug, but we need to support it for backward compatibility.
"name": persistentvolume.Name,
}
return labels.Set(generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet))
}
示例10: NamespaceToSelectableFields
// NamespaceToSelectableFields returns a field set that represents the object
func NamespaceToSelectableFields(namespace *api.Namespace) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(&namespace.ObjectMeta, false)
specificFieldsSet := fields.Set{
"status.phase": string(namespace.Status.Phase),
// This is a bug, but we need to support it for backward compatibility.
"name": namespace.Name,
}
return generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet)
}
示例11: EventToSelectableFields
// EventToSelectableFields returns a field set that represents the object
func EventToSelectableFields(event *api.Event) fields.Set {
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(&event.ObjectMeta, true)
specificFieldsSet := fields.Set{
"involvedObject.kind": event.InvolvedObject.Kind,
"involvedObject.namespace": event.InvolvedObject.Namespace,
"involvedObject.name": event.InvolvedObject.Name,
"involvedObject.uid": string(event.InvolvedObject.UID),
"involvedObject.apiVersion": event.InvolvedObject.APIVersion,
"involvedObject.resourceVersion": event.InvolvedObject.ResourceVersion,
"involvedObject.fieldPath": event.InvolvedObject.FieldPath,
"reason": event.Reason,
"source": event.Source.Component,
"type": event.Type,
}
return generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet)
}