-
Notifications
You must be signed in to change notification settings - Fork 61
Enable metrics #405
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
Enable metrics #405
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
I haven't tested yet but changes LGTM
The only thing that may want us not to merge it - productization, but I think kuberbac proxy is common enough that we can use an existing productized container instead of doing it by ourselves.
Rebased PR onto main and merged metrics-service.yaml into the service.yaml created to support webhooks. Still need to double-check that everything works though. |
@amisevsk @sleshchenko Are we going to target this for the 1.0 release? |
As of now, no. We need to find an OpenShift-suitable image for |
Signed-off-by: Angel Misevski <[email protected]>
Enable setting the image used for the kube-rbac-proxy via env vars in order to allow using a different repository for the proxy on OpenShift vs Kubernetes. Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Use OPENSHIFT_RBAC_PROXY_IMAGE env var to set rbac proxy image used in OLM deployments in similar way to OpenShift. Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Retesting this PR now, it seems that the ose-rbac-proxy image can be pulled when running on OpenShift (tested on regular OpenShift 4.7 cluster and in Latest changes can be tested using the catalogsource below (and installing DWO as an operator) cat <<EOF | kubectl apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: custom-devworkspace-operator-catalog
namespace: openshift-marketplace
spec:
sourceType: grpc
image: quay.io/amisevsk/devworkspace-operator-index@sha256:cfbe26ee7003a15fed3d6a92f45dd30023c020283cc48df98b2bb201972db547
publisher: Red Hat
displayName: DevWorkspace Operator Catalog
EOF |
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Fixed two more minor issues
|
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.
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.
Just tested it out and it works for me 👍
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, JPinkney, sleshchenko The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path |
1 similar comment
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path |
/test v7-devworkspace-happy-path |
@amisevsk: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
I believe happy-path test failures are expected due to #484 |
What does this PR do?
Enables serving metrics for both the DevWorkspace controller and webhooks server.
Metrics are secured via kube-rbac-proxy, which is the default setup when kubebuilder bootstraps a project. The image used can be configured via env vars
KUBE_RBAC_PROXY_IMAGE
andOPENSHIFT_RBAC_PROXY_IMAGE
-- I made it separate so that we can use a different image on openshift (openshift4/ose-kube-rbac-proxy
)Changes to the deployment:
generate-deployment.sh
to be a little smarter in how it uses envsubst -- we no longer needbak
files :)devworkspace-controller-manager-metrics-service
todevworkspace-controller-metrics-service
and made the selector actually select the controller's deployment.What issues does this PR fix or reference?
Closes #241
Is it tested? How?
make install
and wait for everything to be up and running (you may need to make uninstall to get rid of the old auth-proxy service). Once everything is running:devworkspace-controller-metrics-reader
to some serviceaccount, e.g.NAMESPACE=devworkspace-controller kubectl create clusterrolebinding dw-metrics --clusterrole=devworkspace-controller-metrics-reader --serviceaccount=${NAMESPACE}:devworkspace-controller-serviceaccount
NAMESPACE=devworkspace-controller TOKEN=$(kubectl get secrets -o=json -n ${NAMESPACE} | jq -r '[.items[] | select (.type == "kubernetes.io/service-account-token" and .metadata.annotations."kubernetes.io/service-account.name" == "devworkspace-controller-serviceaccount")][0].data.token' | base64 --decode)
oc expose svc devworkspace-controller-metrics-service
, etc. withtls.termination: passthrough
)kubectl port-forward service/devworkspace-controller-manager-service 8443:8443 &; kubectl port-forward service/devworkspace-webhookserver 9443:9443
To ingest the metrics locally with prometheus/grafana:
prometheus.yaml
docker run -d --name prometheus \ --network=host \ -p 9090:9090 \ -v $(pwd)/prometheus.yaml:/etc/prometheus/prometheus.yaml:z \ prom/prometheus --config.file=/etc/prometheus/prometheus.yaml --log.level=debug
--network=host
is required when using localhost, otherwise it can be dropped (e.g. for OpenShift routes)localhost:3000
, login asadmin/admin
, add the datasource for prometheus (http://localhost:9090
,Access: Browser
), and create a new dashboard