Skip to content

Commit

Permalink
Update ServiceMonitor template
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosmamorim committed Apr 1, 2024
1 parent 789e94f commit a2d40c8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
14 changes: 7 additions & 7 deletions helm/templates/service_monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ metadata:
labels:
{{- include "poolboy.labels" . | nindent 4 }}
spec:
endpoints:
- interval: 30s
path: /metrics
port: {{ .Values.serviceMetrics.name}}
namespaceSelector:
matchNames:
- {{ include "poolboy.namespaceName" . }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "poolboy.name" . }}
namespaceSelector:
matchNames:
- {{ include "poolboy.namespaceName" . }}
endpoints:
- port: {{ include "poolboy.name" . }}
interval: "30s"
path: /metrics
18 changes: 12 additions & 6 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,22 @@ serviceAccount:

service:
type: ClusterIP
port: 8000
port: 8080
ports:
- name: health-check
port: 8080
protocol: TCP
targetPort: 8080

serviceMetrics:
type: ClusterIP
port: 80
name: metrics
ports:
- name: metrics
port: 8000
port: 80
protocol: TCP
targetPort: 8000
- name: metrics-service
port: 8000
protocol: web
targetPort: 8000
path: /metrics


Expand Down
5 changes: 5 additions & 0 deletions operator/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@


@kopf.on.startup()
@AppMetrics.measure_execution_time(
'response_time_seconds',
method='on_startup',
resource_type='poolboy'
)
async def startup(logger: kopf.ObjectLogger, settings: kopf.OperatorSettings, **_):
# Store last handled configuration in status
settings.persistence.diffbase_storage = kopf.StatusDiffBaseStorage(field='status.diffBase')
Expand Down

0 comments on commit a2d40c8

Please sign in to comment.