gocrane / crane

Crane is a FinOps Platform for Cloud Resource Analytics and Economics in Kubernetes clusters. The goal is not only to help users to manage cloud cost easier but also ensure the quality of applications.
https://gocrane.io
Apache License 2.0
1.83k stars 377 forks source link

How to configure the CRD workload to use recommended features #884

Closed wxuedong closed 6 months ago

wxuedong commented 6 months ago

Describe the feature

K8s version v1.20.8 crane version v0.11.0

Submit the following configuration in the cluster:

apiVersion: analysis.crane.io/v1alpha1
kind: RecommendationRule
metadata:
  name: workloads-rule
  labels:
    analysis.crane.io/recommendation-rule-preinstall: "true"
spec:
  runInterval: 24h                            
  resourceSelectors:                         
    - kind: StatefulSet
      apiVersion: apps/v1
    - kind: Rollout    #CRD
      apiVersion: argoproj.io/v1alpha1
  namespaceSelector:
    any: true                               
  recommenders:                            
    - name: Replicas
    - name: Resource

I hope to recommend Rollout resources just like StatefulSet, check the crane log and the following information appears:

E0105 18:06:04.327485       1 manager.go:138] RecommendationRule(workloads-rule) Target(demo-project/rollouts-demo): recommender "Resource" failed at filter phase: recommender  is failed at filter, your kubernetes resource is not supported for recommender
I0105 18:06:04.327622       1 manager.go:133] RecommendationRule(workloads-rule) Target(demo-project/rollouts-demo): start to run recommender "Replicas".
E0105 18:06:04.327634       1 manager.go:138] RecommendationRule(workloads-rule) Target(demo-project/rollouts-demo): recommender "Replicas" failed at filter phase: recommender  is failed at filter, your kubernetes resource is not supported for recommender
I0105 18:06:04.327834       1 manager.go:133] RecommendationRule(workloads-rule) Target(default/nginx-rollout): start to run recommender "Resource".

Recommended values that are not available in the crane console:

image

How to solve this problem ?

wu0407 commented 6 months ago

Please check if the configmap named "recommendation-configuration" is correctly configured. https://github.com/gocrane/crane/blob/6d7758eb3719a5fa42ed000876c4781c179235f8/deploy/craned/deployment.yaml#L96-L130

wxuedong commented 6 months ago

Please check if the configmap named "recommendation-configuration" is correctly configured.

https://github.com/gocrane/crane/blob/6d7758eb3719a5fa42ed000876c4781c179235f8/deploy/craned/deployment.yaml#L96-L130

Thank you. It has been solved. Add resources based on this configuration.