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

build(repo): Add TLS configuration for WebServer #369

Merged
merged 2 commits into from
Dec 27, 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
2 changes: 1 addition & 1 deletion cluster/charts/fuel-streams/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: fuel-streams
version: 0.7.4
version: 0.8.0
dependencies:
- name: nats
version: 1.2.8
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{- $webserver := .Values.webserver }}
{{- $service := $webserver.service }}
{{- $tls := $webserver.tls }}
{{- $certificate := $tls.certificate }}
{{- $ingress := $tls.ingress }}
{{- if and $webserver.enabled $service.host $tls.enabled }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
{{- include "k8s.metadata" (dict "context" . "suffix" "-webserver-cert") | nindent 2 }}
annotations:
{{- include "set-value" (dict "context" $certificate "path" "annotations") | nindent 4 }}
labels:
{{- include "fuel-streams.labels" (dict "name" "webserver" "context" .) | nindent 4 }}
{{- include "set-value" (dict "context" $certificate "path" "labels") | nindent 4 }}
app.kubernetes.io/component: webserver
spec:
secretName: {{ include "fuel-streams.fullname" . }}-webserver-tls
duration: {{ $certificate.duration }}
renewBefore: {{ $certificate.renewBefore }}
dnsNames:
- {{ $service.host }}
issuerRef:
name: {{ $certificate.issuer }}
kind: ClusterIssuer
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- include "k8s.metadata" (dict "context" . "suffix" "-webserver-cert-validator") | nindent 2 }}
labels:
{{- include "fuel-streams.labels" (dict "name" "webserver" "context" .) | nindent 4 }}
{{- include "set-value" (dict "context" $ingress "path" "labels") | nindent 4 }}
app.kubernetes.io/component: webserver
annotations:
cert-manager.io/cluster-issuer: {{ $certificate.issuer }}
kubernetes.io/ingress.class: nginx
acme.cert-manager.io/http01-ingress-class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
cert-manager.io/common-name: {{ $service.host }}
{{- include "set-value" (dict "context" $ingress "path" "annotations") | nindent 4 }}
spec:
ingressClassName: nginx
tls:
- hosts:
- {{ $service.host }}
secretName: {{ include "fuel-streams.fullname" . }}-webserver-tls
rules:
- host: {{ $service.host }}
http:
paths:
- path: /.well-known/acme-challenge/
pathType: Prefix
backend:
service:
name: cm-acme-http-solver
port:
number: 8089
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ kind: Service
metadata:
{{- include "k8s.metadata" (dict "context" . "suffix" "-webserver-nlb") | nindent 2 }}
annotations:
{{- if $service.dns }}
external-dns.alpha.kubernetes.io/hostname: {{ $service.dns }}
{{- if $service.host }}
external-dns.alpha.kubernetes.io/hostname: {{ $service.host }}
external-dns.alpha.kubernetes.io/cloudflare-proxied: "false"
{{- end }}
service.beta.kubernetes.io/aws-load-balancer-attributes: load_balancing.cross_zone.enabled=true
Expand Down
16 changes: 10 additions & 6 deletions cluster/charts/fuel-streams/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,21 @@ webserver:
enabled: true
port: 8080
type: LoadBalancer
dns: "stream-staging.fuel.network"
host: "stream-staging.fuel.network"
annotations: {}
labels: {}

tls:
enabled: true
issuer: "letsencrypt-prod"
duration: "2160h"
renewBefore: "360h"
annotations: {}
labels: {}
certificate:
issuer: "letsencrypt-prod"
duration: "2160h"
renewBefore: "360h"
annotations: {}
labels: {}
ingress:
annotations: {}
labels: {}

# You can override the env variables for the container here
# using a map or an array of key-value pairs
Expand Down
10 changes: 8 additions & 2 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
[package]
name = "fuel-streams-examples"
version = "0.0.15"
authors = { workspace = true }
keywords = { workspace = true }
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }
rust-version = { workspace = true }
publish = false
edition = "2021"

[dependencies]
anyhow = { workspace = true }
Expand Down
Loading