Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions deployment/clouddeploy/gke-workers/base/core/workers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ spec:
value: failed-tasks
- name: NOTIFY_PYPI
value: "false"
ports:
- name: metrics
containerPort: 9090
resources:
requests:
cpu: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ spec:
value: failed-tasks
- name: NOTIFY_PYPI
value: "false"
ports:
- name: metrics
containerPort: 9090
resources:
requests:
cpu: "0.9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ spec:
value: failed-tasks
- name: NOTIFY_PYPI
value: "false"
ports:
- name: metrics
containerPort: 9090
resources:
requests:
cpu: "0.9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ resources:
- ../../base
- staging-api-test.yaml
- osv-linter.yaml
- monitoring
patches:
- path: workers.yaml
- path: scaler.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboards-prov
labels:
app.kubernetes.io/name: grafana
app.kubernetes.io/part-of: osv-monitoring
data:
dashboards.yaml: |
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: false
options:
path: /etc/grafana/dashboards
Comment thread
jess-lowe marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasources
labels:
app.kubernetes.io/name: grafana
app.kubernetes.io/part-of: osv-monitoring
data:
datasources.yaml: |
apiVersion: 1
datasources:
- name: GMP (Prometheus)
Comment thread
jess-lowe marked this conversation as resolved.
uid: gmp
type: prometheus
access: proxy
url: http://127.0.0.1:9090
isDefault: true
editable: false
jsonData:
httpMethod: POST
timeInterval: 15s
- name: Cloud Monitoring
uid: cloud-monitoring
type: googlecloud-monitoring-datasource
access: proxy
editable: false
jsonData:
authenticationType: gce
defaultProject: oss-vdb-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": false,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "gmp"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 8,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "11.5.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "gmp"
},
"editorMode": "code",
"expr": "sum(osv_worker_tasks_processed_total)",
"legendFormat": "Total Tasks",
"range": true,
"refId": "A"
}
],
"title": "Total Tasks Processed",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "gmp"
},
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineInterpolation": "smooth",
"lineWidth": 2,
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
}
},
"unit": "ops"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 16,
"x": 8,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [
"mean",
"lastNotNull"
],
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "gmp"
Comment thread
jess-lowe marked this conversation as resolved.
},
"editorMode": "code",
"expr": "sum(rate(osv_worker_tasks_processed_total[5m])) by (status)",
"legendFormat": "{{status}}",
"range": true,
"refId": "A"
}
],
"title": "Worker Task Processing Rate",
"type": "timeseries"
}
],
"refresh": "10s",
"schemaVersion": 39,
"tags": [
"osv",
"gmp",
"worker"
],
"templating": {
"list": []
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m"
]
},
"timezone": "utc",
"title": "OSV Worker - Test Dashboard",
"uid": "osv-worker-test",
"version": 1
}
Comment thread
jess-lowe marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
labels:
app.kubernetes.io/name: grafana
app.kubernetes.io/part-of: osv-monitoring
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: grafana
template:
metadata:
labels:
app.kubernetes.io/name: grafana
app.kubernetes.io/part-of: osv-monitoring
spec:
serviceAccountName: grafana-sa
containers:
- name: grafana
image: grafana/grafana:11.5.0@sha256:4a0808cf7ca4b2569e5d4cb05ef2222a27ffb2a0c6499318b76c8cb81a6c4b28
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 3000
env:
- name: GF_SECURITY_ALLOW_EMBEDDING
value: "true"
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "false"
- name: GF_AUTH_BASIC_ENABLED
value: "false"
- name: GF_AUTH_DISABLE_LOGIN_FORM
value: "true"
- name: GF_AUTH_JWT_ENABLED
value: "true"
- name: GF_AUTH_JWT_HEADER_NAME
value: "X-Goog-IAP-JWT-Assertion"
- name: GF_AUTH_JWT_EMAIL_CLAIM
value: "email"
- name: GF_AUTH_JWT_USERNAME_CLAIM
value: "email"
- name: GF_AUTH_JWT_JWK_SET_URL
value: "https://www.gstatic.com/iap/verify/public_key-jwk"
- name: GF_AUTH_JWT_EXPECT_CLAIMS
value: '{"iss": "https://cloud.google.com/iap"}'
- name: GF_AUTH_JWT_AUTO_SIGN_UP
value: "true"
- name: GF_USERS_AUTO_ASSIGN_ORG
value: "true"
Comment on lines +30 to +53

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is going to need more work to get working I believe.

Apparently the Auth proxy header doesn't work with google. Try JWTs.

You'll also need to look into how oauth and cloud IAM is setup and how it can be used to authenticate grafana.

Also, we probably want to set: GF_USERS_AUTO_ASSIGN_ORG_ROLE to be admin, instead of the default viewer. We'll need to figure out persistent accounts later. Right now for testing allow anyone with the google cloud perms to have write access.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have done the oauth and iam service account. 👍🏻

- name: GF_USERS_AUTO_ASSIGN_ORG_ROLE
value: "Admin"
- name: GF_SERVER_ROOT_URL
value: "https://monitoring.test.osv.dev"
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
cpu: 1000m
memory: 1Gi
livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 2
volumeMounts:
- name: datasources
mountPath: /etc/grafana/provisioning/datasources
readOnly: true
- name: dashboards-prov
mountPath: /etc/grafana/provisioning/dashboards
readOnly: true
- name: dashboards
mountPath: /etc/grafana/dashboards
readOnly: true
- name: storage
mountPath: /var/lib/grafana
- name: gmp-frontend
image: gke.gcr.io/prometheus-engine/frontend:v0.18.2-gke.1@sha256:35ab356d969255dd7694ae371bf0991b97907451b4c7e1574b58a096d3be5977
args:
- "--web.listen-address=127.0.0.1:9090"
- "--project-id=$(GOOGLE_CLOUD_PROJECT)"
env:
- name: GOOGLE_CLOUD_PROJECT
value: oss-vdb-test
ports:
- name: gmp-proxy
containerPort: 9090
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
volumes:
- name: datasources
configMap:
name: grafana-datasources
- name: dashboards-prov
configMap:
name: grafana-dashboards-prov
- name: dashboards
configMap:
name: grafana-dashboards
- name: storage
emptyDir: {}
Loading
Loading