1 /* 2 Copyright 2019 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package framework 18 19 // NodeInfoLister interface represents anything that can list/get NodeInfo objects from node name. 20 type NodeInfoLister interface { 21 // List returns the list of NodeInfos. 22 List() ([]*NodeInfo, error) 23 // HavePodsWithAffinityList returns the list of NodeInfos of nodes with pods with affinity terms. 24 HavePodsWithAffinityList() ([]*NodeInfo, error) 25 // HavePodsWithRequiredAntiAffinityList returns the list of NodeInfos of nodes with pods with required anti-affinity terms. 26 HavePodsWithRequiredAntiAffinityList() ([]*NodeInfo, error) 27 // Get returns the NodeInfo of the given node name. 28 Get(nodeName string) (*NodeInfo, error) 29 } 30 31 // StorageInfoLister interface represents anything that handles storage-related operations and resources. 32 type StorageInfoLister interface { 33 // IsPVCUsedByPods returns true/false on whether the PVC is used by one or more scheduled pods, 34 // keyed in the format "namespace/name". 35 IsPVCUsedByPods(key string) bool 36 } 37 38 // SharedLister groups scheduler-specific listers. 39 type SharedLister interface { 40 NodeInfos() NodeInfoLister 41 StorageInfos() StorageInfoLister 42 } 43