Skip to content

Commit

Permalink
feat: add metrics service (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
Demonsthere authored Feb 11, 2022
1 parent 081cc2c commit 187ebfd
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .circleci/values/oathkeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ deployment:
- name: "sidecar"
image: "alpine:latest"
command: ["/bin/sh"]
args: ["-c", "sleep 10"]
args: ["-c", "sleep infinity"]
oathkeeper:
accessRules: |
[
Expand Down
2 changes: 1 addition & 1 deletion helm/charts/keto/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ version: 0.21.7
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: v0.7.0
appVersion: v0.8.0
3 changes: 3 additions & 0 deletions helm/charts/keto/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ spec:
- name: http-write
containerPort: {{ .Values.keto.config.serve.write.port }}
protocol: TCP
- name: http-metrics
containerPort: {{ .Values.keto.config.serve.metrics.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /health/alive
Expand Down
22 changes: 22 additions & 0 deletions helm/charts/keto/templates/service-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.service.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "keto.fullname" . }}-metrics
{{- if .Release.Namespace }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app.kubernetes.io/component: metrics
{{ include "keto.labels" . | indent 4 }}
spec:
type: {{ .Values.service.metrics.type }}
ports:
- port: {{ .Values.service.metrics.port }}
targetPort: http-metrics
protocol: TCP
name: {{ .Values.service.metrics.name }}
selector:
app.kubernetes.io/name: {{ include "keto.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }}
3 changes: 2 additions & 1 deletion helm/charts/keto/templates/service-read.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if.Values.service.read.enabled }}
{{- if .Values.service.read.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -7,6 +7,7 @@ metadata:
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app.kubernetes.io/component: read
{{ include "keto.labels" . | indent 4 }}
spec:
type: {{ .Values.service.read.type }}
Expand Down
3 changes: 2 additions & 1 deletion helm/charts/keto/templates/service-write.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if.Values.service.write.enabled }}
{{- if .Values.service.write.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -7,6 +7,7 @@ metadata:
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app.kubernetes.io/component: write
{{ include "keto.labels" . | indent 4 }}
spec:
type: {{ .Values.service.write.type }}
Expand Down
24 changes: 24 additions & 0 deletions helm/charts/keto/templates/servicemonitor-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") (.Values.service.metrics.enabled) }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "keto.fullname" . }}-metrics
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/component: metrics
{{ include "keto.labels" . | indent 4 }}
{{- with .Values.service.metrics.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- path: /metrics/prometheus
port: {{ .Values.service.metrics.name }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "keto.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: metrics
{{- end -}}
19 changes: 17 additions & 2 deletions helm/charts/keto/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ image:
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
# -- Ory KETO version
tag: "v0.7.0-alpha.1-sqlite"
tag: "v0.8.0-alpha.0"

imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -68,6 +68,7 @@ job:

shareProcessNamespace: false

# -- Ingress definitions
ingress:
read:
enabled: false
Expand Down Expand Up @@ -100,18 +101,29 @@ ingress:
# hosts:
# - chart-example.local

# -- Service configurations
service:
# -- Read service
read:
enabled: true
type: ClusterIP
name: http-read
port: 80
# -- Write service
write:
enabled: true
type: ClusterIP
name: http-write
port: 80
# -- Metrics service
metrics:
enabled: false
type: ClusterIP
name: http-metrics
port: 80
annotations: {}

# -- Secret management
secret:
# -- Switch to false to prevent creating the secret
enabled: true
Expand All @@ -127,14 +139,16 @@ secret:
helm.sh/hook-delete-policy: "before-hook-creation"
helm.sh/resource-policy: "keep"

# -- Main keto config. Full documentation can be found in https://www.ory.sh/keto/docs/reference/configuration
keto:
# https://www.ory.sh/keto/docs/reference/configuration
config:
serve:
read:
port: 4466
write:
port: 4467
metrics:
port: 4468
namespaces:
- id: 0
name: sample
Expand All @@ -153,6 +167,7 @@ resources: {}
# cpu: 100m
# memory: 128Mi

# -- Autoscaling for keto deployment
autoscaling:
enabled: false
minReplicas: 1
Expand Down
4 changes: 2 additions & 2 deletions helm/charts/kratos/templates/statefulset-mail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ spec:
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- if .Values.job.extraContainers }}
{{ tpl .Values.job.extraContainers . | indent 8 }}
{{- if .Values.deployment.extraContainers }}
{{ tpl .Values.deployment.extraContainers . | indent 8 }}
{{- end }}
{{- if .Values.deployment.extraInitContainers }}
initContainers:
Expand Down
2 changes: 1 addition & 1 deletion helm/charts/oathkeeper/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
appVersion: "v0.38.9-beta.1"
appVersion: "v0.38.19-beta.1"
description: A Helm chart for deploying ORY Oathkeeper in Kubernetes
name: oathkeeper
icon: https://raw.githubusercontent.com/ory/docs/master/docs/static/img/logo-oathkeeper.svg
Expand Down
2 changes: 1 addition & 1 deletion helm/charts/oathkeeper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ image:
# -- ORY Oathkeeper image
repository: oryd/oathkeeper
# -- ORY Oathkeeper version
tag: v0.38.17-beta.1
tag: v0.38.19-beta.1
# -- Image pull policy
pullPolicy: IfNotPresent

Expand Down

0 comments on commit 187ebfd

Please sign in to comment.