Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wxuedong opened this issue Jan 5, 2024 · 2 comments
Closed

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

wxuedong opened this issue Jan 5, 2024 · 2 comments

Comments

@wxuedong
Copy link

wxuedong commented Jan 5, 2024

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
Copy link

wu0407 commented Jan 8, 2024

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

apiVersion: v1
kind: ConfigMap
metadata:
name: recommendation-configuration
namespace: crane-system
data:
config.yaml: |-
apiVersion: analysis.crane.io/v1alpha1
kind: RecommendationConfiguration
recommenders:
- name: Replicas
acceptedResources:
- kind: Deployment
apiVersion: apps/v1
- kind: StatefulSet
apiVersion: apps/v1
- name: Resource
acceptedResources:
- kind: Deployment
apiVersion: apps/v1
- kind: StatefulSet
apiVersion: apps/v1
- name: IdleNode
acceptedResources:
- kind: Node
apiVersion: v1
- name: Volume
acceptedResources:
- kind: PersistentVolume
apiVersion: v1
- name: Service
acceptedResources:
- kind: Service
apiVersion: v1
---

@wxuedong
Copy link
Author

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

apiVersion: v1
kind: ConfigMap
metadata:
name: recommendation-configuration
namespace: crane-system
data:
config.yaml: |-
apiVersion: analysis.crane.io/v1alpha1
kind: RecommendationConfiguration
recommenders:
- name: Replicas
acceptedResources:
- kind: Deployment
apiVersion: apps/v1
- kind: StatefulSet
apiVersion: apps/v1
- name: Resource
acceptedResources:
- kind: Deployment
apiVersion: apps/v1
- kind: StatefulSet
apiVersion: apps/v1
- name: IdleNode
acceptedResources:
- kind: Node
apiVersion: v1
- name: Volume
acceptedResources:
- kind: PersistentVolume
apiVersion: v1
- name: Service
acceptedResources:
- kind: Service
apiVersion: v1
---

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants