Skip to content

Commit

Permalink
feat: add routes
Browse files Browse the repository at this point in the history
Signed-off-by: James Petersen <[email protected]>
  • Loading branch information
found-it committed Dec 9, 2024
1 parent e86c7a3 commit b0cfdd2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
3 changes: 3 additions & 0 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ spec:
- name: https
containerPort: {{ .Values.service.port }}
protocol: TCP
env:
- name: RUST_LOG
value: debug
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
Expand Down
18 changes: 9 additions & 9 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ image:
# This sets the pull policy for images.
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "latest@sha256:638b2f6e7765330d69c039a0654ed61e2566bdbee68b90e511da6feabd505651"
tag: "latest@sha256:c7c690744c66213d0792c4c6bcea99eb4c49da31f81ba18c9b774f7c0987a85e"

# This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
imagePullSecrets: []
Expand All @@ -24,6 +24,8 @@ podSecurityContext: {}

securityContext: {}

logLevel: info

# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
service:
type: ClusterIP
Expand All @@ -32,14 +34,12 @@ service:
resources: {}

# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
# livenessProbe:
# httpGet:
# path: /
# port: https
# readinessProbe:
# httpGet:
# path: /
# port: https
livenessProbe:
tcpSocket:
port: 8443
readinessProbe:
tcpSocket:
port: 8443

# Additional volumes on the output Deployment definition.
volumes:
Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ async fn main() -> Result<()> {
let key_file = env::var("WEBHOOK_KEY_FILE").unwrap_or("tls.key".to_string());
info!("configured certs directory to: {}", certs_dir);

let routes = mutate().or(livez()).or(healthz());
// TODO: Make healthz and livez listen on http rather than https if they need to do more
let routes = routes();

info!("listening on 8443");
warp::serve(routes)
Expand All @@ -57,6 +58,10 @@ async fn main() -> Result<()> {
Ok(())
}

fn routes() -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
mutate().or(livez()).or(healthz())
}

fn healthz() -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
warp::get().and(warp::path("healthz")).map(|| {
debug!("GET /healthz");
Expand Down

0 comments on commit b0cfdd2

Please sign in to comment.