Просмотр исходного кода

Merge pull request #757 from kubecost/develop

Merge develop into master
Ajay Tripathy 5 лет назад
Родитель
Сommit
6ecf205fa8
2 измененных файлов с 11 добавлено и 6 удалено
  1. 6 1
      README.md
  2. 5 5
      pkg/costmodel/allocation.go

+ 6 - 1
README.md

@@ -27,7 +27,12 @@ Here is a summary of features enabled by this cost model:
 You can deploy Kubecost on any Kubernetes 1.8+ cluster in a matter of minutes, if not seconds. 
 You can deploy Kubecost on any Kubernetes 1.8+ cluster in a matter of minutes, if not seconds. 
 Visit the Kubecost docs for [recommended install options](https://docs.kubecost.com/install). Compared to building from source, installing from Helm is faster and includes all necessary dependencies. 
 Visit the Kubecost docs for [recommended install options](https://docs.kubecost.com/install). Compared to building from source, installing from Helm is faster and includes all necessary dependencies. 
 
 
-> If you want to deploy cost model in Prometheus exporter only mode, check out [kubecost-exporter.md](kubecost-exporter.md).
+## Usage
+
+* User interface
+* [Cost APIs](https://github.com/kubecost/docs/blob/master/apis.md)
+* [CLI / kubectl cost](https://github.com/kubecost/kubectl-cost)
+* [Prometheus metric exporter](kubecost-exporter.md)
 
 
 ## Contributing
 ## Contributing
 
 

+ 5 - 5
pkg/costmodel/allocation.go

@@ -1068,7 +1068,7 @@ func labelsToPodControllerMap(podLabels map[podKey]map[string]string, controller
 			podLabelSet := labels.Set(pLabels)
 			podLabelSet := labels.Set(pLabels)
 			if selector.Matches(podLabelSet) {
 			if selector.Matches(podLabelSet) {
 				if _, ok := podControllerMap[pKey]; ok {
 				if _, ok := podControllerMap[pKey]; ok {
-					log.Warningf("CostModel.ComputeAllocation: PodControllerMap match already exists: %s matches %s and %s", pKey, podControllerMap[pKey], cKey)
+					log.DedupedWarningf(5, "CostModel.ComputeAllocation: PodControllerMap match already exists: %s matches %s and %s", pKey, podControllerMap[pKey], cKey)
 				}
 				}
 				podControllerMap[pKey] = cKey
 				podControllerMap[pKey] = cKey
 			}
 			}
@@ -1451,7 +1451,7 @@ func buildPodPVCMap(podPVCMap map[podKey][]*PVC, pvMap map[pvKey]*PV, pvcMap map
 
 
 		values, err := res.GetStrings("persistentvolume", "persistentvolumeclaim", "pod", "namespace")
 		values, err := res.GetStrings("persistentvolume", "persistentvolumeclaim", "pod", "namespace")
 		if err != nil {
 		if err != nil {
-			log.Warningf("CostModel.ComputeAllocation: PVC allocation query result missing field: %s", err)
+			log.DedupedWarningf(5, "CostModel.ComputeAllocation: PVC allocation query result missing field: %s", err)
 			continue
 			continue
 		}
 		}
 
 
@@ -1465,7 +1465,7 @@ func buildPodPVCMap(podPVCMap map[podKey][]*PVC, pvMap map[pvKey]*PV, pvcMap map
 		pvcKey := newPVCKey(cluster, namespace, name)
 		pvcKey := newPVCKey(cluster, namespace, name)
 
 
 		if _, ok := pvMap[pvKey]; !ok {
 		if _, ok := pvMap[pvKey]; !ok {
-			log.Warningf("CostModel.ComputeAllocation: PV missing for PVC allocation query result: %s", pvKey)
+			log.DedupedWarningf(5, "CostModel.ComputeAllocation: PV missing for PVC allocation query result: %s", pvKey)
 			continue
 			continue
 		}
 		}
 
 
@@ -1475,7 +1475,7 @@ func buildPodPVCMap(podPVCMap map[podKey][]*PVC, pvMap map[pvKey]*PV, pvcMap map
 
 
 		pvc, ok := pvcMap[pvcKey]
 		pvc, ok := pvcMap[pvcKey]
 		if !ok {
 		if !ok {
-			log.Warningf("CostModel.ComputeAllocation: PVC missing for PVC allocation query: %s", pvcKey)
+			log.DedupedWarningf(5, "CostModel.ComputeAllocation: PVC missing for PVC allocation query: %s", pvcKey)
 			continue
 			continue
 		}
 		}
 
 
@@ -1598,7 +1598,7 @@ func (cm *CostModel) getNodePricing(nodeMap map[nodeKey]*NodePricing, nodeKey no
 	node, ok := nodeMap[nodeKey]
 	node, ok := nodeMap[nodeKey]
 	if !ok || node == nil {
 	if !ok || node == nil {
 		if nodeKey.Node != "" {
 		if nodeKey.Node != "" {
-			log.Warningf("CostModel: failed to find node for %s", nodeKey)
+			log.DedupedWarningf(5, "CostModel: failed to find node for %s", nodeKey)
 		}
 		}
 		return cm.getCustomNodePricing(false)
 		return cm.getCustomNodePricing(false)
 	}
 	}