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

Add CRD recommendationRule #58

Merged
merged 3 commits into from
Jul 19, 2022
Merged

Add CRD recommendationRule #58

merged 3 commits into from
Jul 19, 2022

Conversation

qmhu
Copy link
Member

@qmhu qmhu commented Jul 18, 2022

RecommendationRule defines how to select resource for recommendation. We want to simplify the usage for Analytics.

This is a sample yaml for workload recommendation:

apiVersion: analysis.crane.io/v1alpha1
kind: RecommendationRule
metadata:
  name: workload
spec:
  runInterval: 1h                            # 每小时运行一次
  resourceSelectors:                    # 资源的信息
    - kind: Deployment
      apiVersion: apps/v1
  namespaceSelector:
     any: true                                  # 扫描所有namespace
  recommenders:                         # 使用 Workload的副本和资源推荐器
    - name: WorkloadReplicas
    - name: WorkloadResource

This is a sample yaml for service recommendation:

apiVersion: analysis.crane.io/v1alpha1
kind: RecommendationRule
metadata:
  name: workload
spec:
  runInterval: 1h                            # 每小时运行一次
  resourceSelectors:                    # 资源的信息
    - kind: Service
      apiVersion: apps/v1
  namespaceSelector:
     any: true                                  # 扫描所有namespace
  recommenders:                         # 使用 闲置 Service 推荐器
    - name: LBService

recommenders is referring to RecommenderConfiguration Recommender's type

@xieydd
Copy link
Member

xieydd commented Jul 18, 2022

  1. How to describe a recommendation flow run only once?
  2. How do I let the recommendation framework know what recommendation process I need to use?
  3. How to expand to non-GVK resources?

@qmhu
Copy link
Member Author

qmhu commented Jul 18, 2022

  1. How to describe a recommendation flow run only once?
    runInterval: 0
  2. How do I let the recommendation framework know what recommendation process I need to use
    RecommendationRule defines which resources are needed for recommendation. RecommenderConfiguration defines which recommenders are enabled and will be trigger for recommendation process.
  3. How to expand to non-GVK resources?
    Give an example ?

@xieydd
Copy link
Member

xieydd commented Jul 18, 2022

  1. How to describe a recommendation flow run only once?
    runInterval: 0
  2. How do I let the recommendation framework know what recommendation process I need to use
    RecommendationRule defines which resources are needed for recommendation. RecommenderConfiguration defines which recommenders are enabled and will be trigger for recommendation process.
  3. How to expand to non-GVK resources?
    Give an example ?
  1. Which trigger will be work, i think not all recommender.
  2. CLB Service in Add types for recommenderConfiguration crane#420.

@qmhu
Copy link
Member Author

qmhu commented Jul 19, 2022

  1. How to describe a recommendation flow run only once?
    runInterval: 0
  2. How do I let the recommendation framework know what recommendation process I need to use
    RecommendationRule defines which resources are needed for recommendation. RecommenderConfiguration defines which recommenders are enabled and will be trigger for recommendation process.
  3. How to expand to non-GVK resources?
    Give an example ?
  1. Which trigger will be work, i think not all recommender.
  2. CLB Service in Add types for recommenderConfiguration crane#420.

Use recommender's name to link to RecommenderConfiguration now. Pls take a look again.

@qmhu qmhu merged commit 5f4a551 into gocrane:main Jul 19, 2022
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster,shortName=rr

// RecommendationRule represents the configuration of an RecommendationRule object.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest change to RecommendationRule is the rule to select kubernetes resource and recommender.

metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec is optional?

// NamespaceSelector indicates resource namespaces to select from
NamespaceSelector NamespaceSelector `json:"namespaceSelector"`

// RunInterval between two recommendation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we point out the default interval?


// Recommender referring to the Recommender in RecommendationConfiguration
type Recommender struct {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete the row

// Recommendations is a list of RecommendationMission that run parallel.
// +optional
// +listType=atomic
Recommendations []RecommendationMission `json:"recommendations,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we use recommendation mission?

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

Successfully merging this pull request may close these issues.

None yet

2 participants