-
Notifications
You must be signed in to change notification settings - Fork 386
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 query expressions management by prom-adapter-config #560
Conversation
🎉 Successfully Build Images. Docker RegistryOverview: https://hub.docker.com/u/gocrane
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-560-4a9c9c7 \
--set metricAdapter.image.repository=gocrane/metric-adapter \
--set metricAdapter.image.tag=pr-560-4a9c9c7 \
--set craneAgent.image.repository=gocrane/crane-agent \
--set craneAgent.image.tag=pr-560-4a9c9c7 \
--set cranedDashboard.image.repository=gocrane/dashboard \
--set cranedDashboard.image.tag=pr-560-4a9c9c7 crane/crane Coding RegistryOverview: https://finops.coding.net/public-artifacts/gocrane/crane/packages
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-560-4a9c9c7 \
--set metricAdapter.image.repository=finops-docker.pkg.coding.net/gocrane/crane/metric-adapter \
--set metricAdapter.image.tag=pr-560-4a9c9c7 \
--set craneAgent.image.repository=finops-docker.pkg.coding.net/gocrane/crane/crane-agent \
--set craneAgent.image.tag=pr-560-4a9c9c7 \
--set cranedDashboard.image.repository=finops-docker.pkg.coding.net/gocrane/crane/dashboard \
--set cranedDashboard.image.tag=pr-560-4a9c9c7 crane/crane Ghcr RegistryOverview: https://github.com/orgs/gocrane/packages?repo_name=crane
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-560-4a9c9c7 \
--set metricAdapter.image.repository=ghcr.io/gocrane/crane/metric-adapter \
--set metricAdapter.image.tag=pr-560-4a9c9c7 \
--set craneAgent.image.repository=ghcr.io/gocrane/crane/crane-agent \
--set craneAgent.image.tag=pr-560-4a9c9c7 \
--set cranedDashboard.image.repository=ghcr.io/gocrane/crane/dashboard \
--set cranedDashboard.image.tag=pr-560-4a9c9c7 crane/crane |
🎊 PR Preview c177e23 has been successfully built and deployed to https://gocrane-crane-preview-pr-560.surge.sh 🕐 Build time: 0.011s 🤖 By surge-preview |
@@ -12,7 +12,7 @@ require ( | |||
github.com/prometheus/client_golang v1.11.0 | |||
github.com/prometheus/common v0.26.0 | |||
github.com/shirou/gopsutil v3.21.10+incompatible | |||
github.com/spf13/cobra v1.1.3 | |||
github.com/spf13/cobra v1.2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
pkg/utils/util.go
Outdated
@@ -91,3 +97,18 @@ func CmpFloat(p1, p2 float64) int32 { | |||
} | |||
return 1 | |||
} | |||
|
|||
func GetFileMd5(file string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use fsnotify to implement it.
please refer to:
https://github.com/gocrane/crane/blob/main/pkg/recommendation/manager.go#L78
PostRegMatchesPodStatefulset = `[0-9]+$` | ||
) | ||
|
||
func GetPodNameReg(resourceName string, resourceType string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a Unit test for it
pkg/utils/expression_prom_adapter.go
Outdated
|
||
// define MetricRule for expressionQuery, SeriesName for original metric name, MetricName for name converted by prometheus-adapter | ||
|
||
type MetricRule struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest to move it to another path
) | ||
|
||
// controller for configMap of prometheus-adapter | ||
type PromAdapterConfigMapController struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally a controller should be independency. So i suggest you can implement it referring to OOMRecorder's implementation.
ScaleClient scale.ScalesGetter | ||
K8SVersion *version.Version | ||
Config EhpaControllerConfig | ||
MetricRulesResource []utils.MetricRule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to manage rules in a in depended class .
code refine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Please fix the lints
} | ||
|
||
if opts.DataSourcePromConfig.AdapterConfigMap != "" { | ||
// PrometheusAdapterConfigFetcher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if opts.DataSourcePromConfig.AdapterConfigMap != "" || opts.DataSourcePromConfig.AdapterConfig != "" {
init()
}
What type of PR is this?
Examples
Make sure you include metrics in your prometheus-adapter-config file
Add args
Modify ehpa config
Delete annotation for metric-query "metric-query.autoscaling.crane.io: xxx"
Add metric config
Test
Extension-labels
Add annotation for extension-labels
Test