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 setup-prometheus-adapter #1012

Merged
merged 40 commits into from
Jan 10, 2025
Merged

add setup-prometheus-adapter #1012

merged 40 commits into from
Jan 10, 2025

Conversation

qindotguan
Copy link
Collaborator

To scale up/down the Vertica DB subcluster size based on prometheus metrics, we need to install the prometheus adapter. This PR provided a way to deploy the promutheus adapter in our e2e test environment.

make setup-prometheus-adapter

Makefile Outdated
setup-prometheus-adapter: ## Setup prometheus adapter for VerticaAutoscaler
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus-adapter prometheus-community/prometheus-adapter --namespace monitoring --create-namespace
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make the release name and namespace a parameter. Default release name and namespace can be prometheus-adapter.

  • There must be an undeploy command too
  • The user must be able to set the prometheus url, prometheus port , the number of replicas.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • add PROMETHEUS_ADAPTER_NAME and PROMETHEUS_ADAPTER_NAMESPACE
  • added undeploy-prometheus-adapter
  • added example values with --set prometheus.url, --set prometheus.port, and --set replicas. I will make them configurable later

Copy link
Collaborator

@roypaulin roypaulin left a comment

Choose a reason for hiding this comment

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

Look at Hao's PR. I think his PR needs to go in before yours, because I would like you to test the dapter when prometheus is running.

Copy link
Collaborator

@roypaulin roypaulin left a comment

Choose a reason for hiding this comment

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

Update Hao's test case

Makefile Outdated
PROMETHEUS_ADAPTER_NAMESPACE ?= prometheus-adapter
PROMETHEUS_ADAPTER_REPLICAS ?= 1
# The Prometheus service URL and port for Prometheus adapter to connect to
PROMETHEUS_URL ?= http://prometheus.default.svc
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
PROMETHEUS_URL ?= http://prometheus.default.svc
PROMETHEUS_URL ?= http://$(PROMETHEUS_HELM_NAME)-kube-prometheus-prometheus.$(PROMETHEUS_NAMESPACE).svc

Also move the adapter variables ddfinition after prometheus'

Makefile Outdated
deploy-prometheus-adapter: ## Setup prometheus adapter for VerticaAutoscaler
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install $(DEPLOY_WAIT) -n ${PROMETHEUS_ADAPTER_NAMESPACE} --create-namespace ${PROMETHEUS_ADAPTER_NAME} prometheus-community/prometheus-adapter --values prometheus/adapter.yaml --set prometheus.url=${PROMETHEUS_URL} --set prometheus.port=${PROMETHEUS_PORT} --set replicas=${PROMETHEUS_ADAPTER_REPLICAS}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
helm install $(DEPLOY_WAIT) -n ${PROMETHEUS_ADAPTER_NAMESPACE} --create-namespace ${PROMETHEUS_ADAPTER_NAME} prometheus-community/prometheus-adapter --values prometheus/adapter.yaml --set prometheus.url=${PROMETHEUS_URL} --set prometheus.port=${PROMETHEUS_PORT} --set replicas=${PROMETHEUS_ADAPTER_REPLICAS}
helm install $(DEPLOY_WAIT) -n ${PROMETHEUS_ADAPTER_NAMESPACE} --create-namespace ${PROMETHEUS_ADAPTER_NAME} prometheus-community/prometheus-adapter --values prometheus/adapter.yaml --set prometheus.url=${PROMETHEUS_URL} --set prometheus.port=${PROMETHEUS_PORT} --set replicas=${PROMETHEUS_ADAPTER_REPLICAS} $(PROMETHEUS_ADAPTER_HELM_OVERRIDES)

Add PROMETHEUS_ADAPTER_HELM_OVERRIDES that we can use to set more fields.

Comment on lines 2 to 8
prometheus:
url: http://prometheus.default.svc
port: 9090
path: ""

# Number of prometheus adapter instances
replicas: 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
prometheus:
url: http://prometheus.default.svc
port: 9090
path: ""
# Number of prometheus adapter instances
replicas: 1

This is not needed. The default replica is already 1

@LiboYu2
Copy link
Collaborator

LiboYu2 commented Jan 6, 2025

@roypaulin If a vdb has sandboxes, how do we exclude them when collecting metrics?

@roypaulin
Copy link
Collaborator

@roypaulin If a vdb has sandboxes, how do we exclude them when collecting metrics?

It can be done on prometheus by setting the service monitor to target only specific subclusters, but We do not need to exclude them, the hpa will select only subclusters that match the service name specified in the CR.

Makefile Outdated
Comment on lines 162 to 165
DB_USER?=dbadmin
DB_PASSWORD?=
VDB_NAME?=verticadb-sample
VDB_NAMESPACE?=default
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move these next to other prometheus variables.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you address this?

@roypaulin
Copy link
Collaborator

Try prometheus-sanity first on your local machine to make sure it works.

Copy link
Collaborator

@roypaulin roypaulin left a comment

Choose a reason for hiding this comment

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

Looks good! Can you also update DEVELOPER.md like Hao did in his open PR?

Makefile Outdated
Comment on lines 162 to 165
DB_USER?=dbadmin
DB_PASSWORD?=
VDB_NAME?=verticadb-sample
VDB_NAMESPACE?=default
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you address this?

@qindotguan qindotguan merged commit 99e311b into main Jan 10, 2025
28 of 40 checks passed
@qindotguan qindotguan deleted the qguan/setup-prometheus-adapter branch January 10, 2025 01:25
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.

4 participants