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

Override recommder parameter with the config in RecommendationRule #648

Merged
merged 1 commit into from
Dec 15, 2022

Conversation

whitebear009
Copy link
Contributor

What type of PR is this?

optimization

What this PR does / why we need it:

Override the RecommendationConfiguration in configmap and the default value with the config in RecommendationRule

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

}

// Override the default value with RecommendationConfiguration in configmap
if err = SetRecommendationConfig(rr, recommender.Config); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

  1. merge recommender.Config and recommendationRule.Spec.Config first
  2. do other initialization steps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. if the value in recommender.Config and recommendationRule.Spec.Config conflict, I will use the value of recommendationRule. Is that right?

Copy link
Member

@qmhu qmhu Dec 14, 2022

Choose a reason for hiding this comment

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

  1. if the value in recommender.Config and recommendationRule.Spec.Config conflict, I will use the value of recommendationRule. Is that right?

yes, recommendationRule.Spec.Config has the highest priority.

Copy link
Member

Choose a reason for hiding this comment

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

also, api change PR should be merged first and use the newest api version in crane

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@whitebear009 whitebear009 force-pushed the add-config-for-recommendationrule branch 2 times, most recently from 181fe9a to f3177ff Compare December 15, 2022 03:55
@qmhu
Copy link
Member

qmhu commented Dec 15, 2022

gocrane/api#74 has merged, and you can run make all locally to avoid CI error

@whitebear009 whitebear009 force-pushed the add-config-for-recommendationrule branch from f3177ff to f905eb2 Compare December 15, 2022 06:41
@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 2022

🎉 Successfully Build Images.
Now Support ARM Platforms.
Comment Post Time: 2022-12-15 20:31
Git Version: f4c2ee1

Docker Registry

Overview: https://hub.docker.com/u/gocrane

Image Pull Command
crane-agent:pr-648-f4c2ee1 docker pull gocrane/crane-agent:pr-648-f4c2ee1
dashboard:pr-648-f4c2ee1 docker pull gocrane/dashboard:pr-648-f4c2ee1
metric-adapter:pr-648-f4c2ee1 docker pull gocrane/metric-adapter:pr-648-f4c2ee1
craned:pr-648-f4c2ee1 docker pull gocrane/craned:pr-648-f4c2ee1

Quick Deploy - Helm

helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
                   --set craned.image.repository=gocrane/craned \
                   --set craned.image.tag=pr-648-f4c2ee1 \
                   --set metricAdapter.image.repository=gocrane/metric-adapter \
                   --set metricAdapter.image.tag=pr-648-f4c2ee1 \
                   --set craneAgent.image.repository=gocrane/crane-agent \
                   --set craneAgent.image.tag=pr-648-f4c2ee1 \
                   --set cranedDashboard.image.repository=gocrane/dashboard \
                   --set cranedDashboard.image.tag=pr-648-f4c2ee1 crane/crane

Coding Registry

Overview: https://finops.coding.net/public-artifacts/gocrane/crane/packages

Image Pull Command
crane-agent:pr-648-f4c2ee1 docker pull finops-docker.pkg.coding.net/gocrane/crane/crane-agent:pr-648-f4c2ee1
dashboard:pr-648-f4c2ee1 docker pull finops-docker.pkg.coding.net/gocrane/crane/dashboard:pr-648-f4c2ee1
metric-adapter:pr-648-f4c2ee1 docker pull finops-docker.pkg.coding.net/gocrane/crane/metric-adapter:pr-648-f4c2ee1
craned:pr-648-f4c2ee1 docker pull finops-docker.pkg.coding.net/gocrane/crane/craned:pr-648-f4c2ee1

Quick Deploy - Helm

helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
                   --set craned.image.repository=finops-docker.pkg.coding.net/gocrane/crane/craned \
                   --set craned.image.tag=pr-648-f4c2ee1 \
                   --set metricAdapter.image.repository=finops-docker.pkg.coding.net/gocrane/crane/metric-adapter \
                   --set metricAdapter.image.tag=pr-648-f4c2ee1 \
                   --set craneAgent.image.repository=finops-docker.pkg.coding.net/gocrane/crane/crane-agent \
                   --set craneAgent.image.tag=pr-648-f4c2ee1 \
                   --set cranedDashboard.image.repository=finops-docker.pkg.coding.net/gocrane/crane/dashboard \
                   --set cranedDashboard.image.tag=pr-648-f4c2ee1 crane/crane

Ghcr Registry

Overview: https://github.com/orgs/gocrane/packages?repo_name=crane

Image Pull Command
crane-agent:pr-648-f4c2ee1 docker pull ghcr.io/gocrane/crane/crane-agent:pr-648-f4c2ee1
dashboard:pr-648-f4c2ee1 docker pull ghcr.io/gocrane/crane/dashboard:pr-648-f4c2ee1
metric-adapter:pr-648-f4c2ee1 docker pull ghcr.io/gocrane/crane/metric-adapter:pr-648-f4c2ee1
craned:pr-648-f4c2ee1 docker pull ghcr.io/gocrane/crane/craned:pr-648-f4c2ee1

Quick Deploy - Helm

helm repo add crane https://finops-helm.pkg.coding.net/gocrane/gocrane
helm install crane -n crane-system --create-namespace \
                   --set craned.image.repository=ghcr.io/gocrane/crane/craned \
                   --set craned.image.tag=pr-648-f4c2ee1 \
                   --set metricAdapter.image.repository=ghcr.io/gocrane/crane/metric-adapter \
                   --set metricAdapter.image.tag=pr-648-f4c2ee1 \
                   --set craneAgent.image.repository=ghcr.io/gocrane/crane/crane-agent \
                   --set craneAgent.image.tag=pr-648-f4c2ee1 \
                   --set cranedDashboard.image.repository=ghcr.io/gocrane/crane/dashboard \
                   --set cranedDashboard.image.tag=pr-648-f4c2ee1 crane/crane

@whitebear009
Copy link
Contributor Author

@qmhu it's done. please check.

@@ -21,10 +21,19 @@ func (inr *IdleNodeRecommender) Name() string {
}

// NewIdleNodeRecommender create a new idle node recommender.
func NewIdleNodeRecommender(recommender apis.Recommender) (*IdleNodeRecommender, error) {
func NewIdleNodeRecommender(recommender apis.Recommender, recommendationRuleConfig map[string]string) (*IdleNodeRecommender, error) {
if recommender.Config == nil {
recommender.Config = map[string]string{}
}
Copy link
Member

Choose a reason for hiding this comment

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

Could you extract these line into a common function?

@whitebear009
Copy link
Contributor Author

/hold
I found something wrong.

@whitebear009 whitebear009 force-pushed the add-config-for-recommendationrule branch from e655bba to f4c2ee1 Compare December 15, 2022 11:57
@qmhu qmhu merged commit 357c2ff into gocrane:main Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants