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 metricbeat annotations and control over access to the metrics endpoint #20

Merged
merged 3 commits into from
Jul 30, 2024
Merged
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
4 changes: 2 additions & 2 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: v2
name: f7t4jhub
description: A Helm chart to Deploy JupyterHub with the FirecREST Spawner
type: application
version: 0.6.2
version: 0.7.0
appVersion: "4.1.5"
dependencies:
- name: f7t4jhub
version: 0.6.2
version: 0.7.0
repository: "file://./f7t4jhub"
- name: reloader
version: v1.0.51
Expand Down
2 changes: 1 addition & 1 deletion chart/f7t4jhub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: f7t4jhub
description: A Helm chart to Deploy JupyterHub with the FirecREST Spawner
type: application
version: 0.6.2
version: 0.7.0
appVersion: "4.1.5"
2 changes: 1 addition & 1 deletion chart/f7t4jhub/files/jupyterhub-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ async def refresh_user(self, user, handler=None):
# This should be set to the URL which the hub uses to connect to the proxy’s API.
c.ConfigurableHTTPProxy.api_url = 'http://{{ .Release.Name }}-proxy-svc:{{ .Values.network.apiPort }}'

{{ .Values.extraConfig }}
{{ .Values.config.extraConfig }}
14 changes: 11 additions & 3 deletions chart/f7t4jhub/templates/deployment-hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
app: hub
annotations:
{{- if .Values.vault.enabled }}
{{- if .Values.reloader.enabled }}
configmap.reloader.stakater.com/reload: "{{ .Release.Name }}-configmap"
secret.reloader.stakater.com/reload: "{{ .Release.Name }}-common-secrets"
{{- end }}
Expand All @@ -18,6 +18,14 @@ spec:
metadata:
labels:
app: hub
annotations:
{{- if .Values.metricbeat.enabled }}
co.elastic.metrics/enabled: "true"
co.elastic.metrics/hosts: '"${data.host}:{{ .Values.network.externalPort }}"'
co.elastic.metrics/metrics_path: /metrics
co.elastic.metrics/metricsets: collector
co.elastic.metrics/module: prometheus
{{- end }}
spec:
securityContext:
runAsUser: 1000
Expand Down Expand Up @@ -53,7 +61,7 @@ spec:
secretKeyRef:
name: {{ .Release.Name }}-secret
key: configProxyAuthToken
{{- if .Values.vault.enabled }}
{{- if .Values.vault.keycloak.enabled }}
- name: KC_CLIENT_ID
valueFrom:
secretKeyRef:
Expand All @@ -80,7 +88,7 @@ spec:
items:
- key: jupyterhub-config
path: jupyterhub_config.py
{{- if .Values.vault.enabled }}
{{- if .Values.vault.containerRegistry.enabled }}
imagePullSecrets:
- name: {{ .Release.Name }}-registry-docker-config
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.vault.enabled }}
{{- if .Values.vault.containerRegistry.enabled }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
Expand All @@ -19,6 +19,6 @@ spec:
data:
- secretKey: jfrog_docker_config
remoteRef:
key: jfrog
key: {{ .Values.vault.containerRegistry.secretPath }}
property: docker_config
{{- end }}
6 changes: 3 additions & 3 deletions chart/f7t4jhub/templates/external-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.vault.enabled }}
{{- if .Values.vault.keycloak.enabled }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
Expand All @@ -14,10 +14,10 @@ spec:
data:
- secretKey: kc_client_secret
remoteRef:
key: {{ .Values.vault.secretPath }}
key: {{ .Values.vault.keycloak.secretPath }}
property: kc_client_secret
- secretKey: kc_client_id
remoteRef:
key: {{ .Values.vault.secretPath }}
key: {{ .Values.vault.keycloak.secretPath }}
property: kc_client_id
{{- end }}
80 changes: 41 additions & 39 deletions chart/f7t4jhub/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
apiVersion: v1
items:
- apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-proxy-ingress
spec:
ingressClassName: nginx
rules:
- host: {{ .Values.config.commonName }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-proxy-svc
port:
number: {{ .Values.network.appPort }}
- path: /hub/api
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-proxy-svc
port:
number: {{ .Values.network.appPort }}
- path: /api
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-proxy-svc
port:
number: {{ .Values.network.apiPort }}
tls:
- hosts:
- {{ .Values.config.commonName }}
secretName: {{ .Release.Name }}-cert-secret
kind: List
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
resourceVersion: ""
name: {{ .Release.Name }}-proxy-ingress
annotations:
{{- if .Values.metricbeat.deny_metrics_endpoint }}
nginx.ingress.kubernetes.io/server-snippet: |
location /hub/metrics {
deny all;
}
{{- end }}
spec:
ingressClassName: nginx
rules:
- host: {{ .Values.config.commonName }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-proxy-svc
port:
number: {{ .Values.network.appPort }}
- path: /hub/api
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-proxy-svc
port:
number: {{ .Values.network.appPort }}
- path: /api
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}-proxy-svc
port:
number: {{ .Values.network.apiPort }}
tls:
- hosts:
- {{ .Values.config.commonName }}
secretName: {{ .Release.Name }}-cert-secret
2 changes: 1 addition & 1 deletion chart/f7t4jhub/templates/secret-store.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.vault.enabled }}
{{- if .Values.vault.keycloak.enabled }}
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
Expand Down
42 changes: 33 additions & 9 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,42 @@ f7t4jhub:
# Set log level to logging.DEBUG
debug: false

vault:
# Enable or disable Vault integration
reloader:
# Enable or disable reloader integration
enabled: false

vault:
# URL for the Vault service (replace with your own Vault URL)
url: 'https://vault.example.com'

# Secret engine used in Vault (replace with your own secret engine)
secretEngine: 'jupyterhub'

# Secret path in Vault (replace with your own secret path)
secretPath: 'dom/tds'
secretEngine: 'secret-engine'

# Role ID for accessing Vault secrets (replace with your own role ID)
roleId: '<role-id>'
roleId: 'role-id'

# keycloack credentials
keycloak:
# Enable or disable Vault integration
enabled: false

# Secret path in Vault (replace with your own secret path)
secretPath: 'secret/path/keycloack'

# container registry credentials
containerRegistry:
# Enable or disable Vault integration
enabled: false

# Secret path in Vault (replace with your own secret path)
secretPath: 'secret/path/containers'

metricbeat:
# Enable or disable annotations for metric beat monitoring
enabled: false

# Allow or deny access to /hub/metrics
deny_metrics_endpoint: false

network:
# Ports configuration for the application
Expand Down Expand Up @@ -127,5 +148,8 @@ f7t4jhub:
customStateGetHost: None

# Literal python code to add at the end of jupyterhub's configuration
extraConfig: |
# ...
optionsForm: |

# Literal python code to add at the end of jupyterhub's configuration
extraConfig: |
# ...
Loading