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

delete recommendation belong to recommendationrule if target oject not found #692

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

whitebear009
Copy link
Contributor

What type of PR is this?

optimize

What this PR does / why we need it:

if we deploy recommendationrule to cover all deployment/statefulset like example, craned will create correspond recommendation for all deployment/statefulset.
If we delete some workloads (required for testing), the recommendation will not be deleted. After a period of time, there will be many unavailable recommedations in the cluster.

so this PR optimizes the issue. if recommendation is created by recommendationrule and its target object has been deleted, delete correspond recommendation.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

…ect has been deleted, delete correspond recommendation.
@github-actions
Copy link
Contributor

🎉 Successfully Build Images.
Now Support ARM Platforms.
Comment Post Time: 2023-02-13 16:42
Git Version: a54d84a

Docker Registry

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

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

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-692-a54d84a \
                   --set metricAdapter.image.repository=gocrane/metric-adapter \
                   --set metricAdapter.image.tag=pr-692-a54d84a \
                   --set craneAgent.image.repository=gocrane/crane-agent \
                   --set craneAgent.image.tag=pr-692-a54d84a \
                   --set cranedDashboard.image.repository=gocrane/dashboard \
                   --set cranedDashboard.image.tag=pr-692-a54d84a crane/crane

Coding Registry

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

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

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-692-a54d84a \
                   --set metricAdapter.image.repository=finops-docker.pkg.coding.net/gocrane/crane/metric-adapter \
                   --set metricAdapter.image.tag=pr-692-a54d84a \
                   --set craneAgent.image.repository=finops-docker.pkg.coding.net/gocrane/crane/crane-agent \
                   --set craneAgent.image.tag=pr-692-a54d84a \
                   --set cranedDashboard.image.repository=finops-docker.pkg.coding.net/gocrane/crane/dashboard \
                   --set cranedDashboard.image.tag=pr-692-a54d84a crane/crane

Ghcr Registry

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

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

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-692-a54d84a \
                   --set metricAdapter.image.repository=ghcr.io/gocrane/crane/metric-adapter \
                   --set metricAdapter.image.tag=pr-692-a54d84a \
                   --set craneAgent.image.repository=ghcr.io/gocrane/crane/crane-agent \
                   --set craneAgent.image.tag=pr-692-a54d84a \
                   --set cranedDashboard.image.repository=ghcr.io/gocrane/crane/dashboard \
                   --set cranedDashboard.image.tag=pr-692-a54d84a crane/crane

Copy link
Member

@qmhu qmhu left a comment

Choose a reason for hiding this comment

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

When recommendationrule controller rerun the progress, the orphan recommendation also will be deleted?

@qmhu qmhu merged commit ccefb00 into gocrane:main Feb 20, 2023
@qmhu
Copy link
Member

qmhu commented Feb 20, 2023

Solve the error that throws in RecommendationController, good improvement.

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