diff --git a/cluster/charts/fuel-streams/Chart.yaml b/cluster/charts/fuel-streams/Chart.yaml index cc1859f0..a6537880 100755 --- a/cluster/charts/fuel-streams/Chart.yaml +++ b/cluster/charts/fuel-streams/Chart.yaml @@ -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.8 dependencies: - name: nats version: 1.2.8 diff --git a/cluster/charts/fuel-streams/templates/consumer/statefulset.yaml b/cluster/charts/fuel-streams/templates/consumer/deployment.yaml similarity index 97% rename from cluster/charts/fuel-streams/templates/consumer/statefulset.yaml rename to cluster/charts/fuel-streams/templates/consumer/deployment.yaml index a1f73522..39dcfecd 100644 --- a/cluster/charts/fuel-streams/templates/consumer/statefulset.yaml +++ b/cluster/charts/fuel-streams/templates/consumer/deployment.yaml @@ -1,7 +1,7 @@ {{- $consumer := .Values.consumer -}} {{- if $consumer.enabled -}} apiVersion: apps/v1 -kind: StatefulSet +kind: Deployment metadata: {{- include "k8s.metadata" (dict "context" . "suffix" "-consumer") | nindent 2 }} annotations: @@ -10,7 +10,6 @@ metadata: {{- include "fuel-streams.labels" (dict "name" "consumer" "context" .) | nindent 4 }} {{- include "set-value" (dict "context" $consumer "path" "config.labels") | nindent 4 }} spec: - serviceName: {{ include "fuel-streams.fullname" . }}-consumer {{- if not $consumer.autoscaling.enabled }} replicas: {{ $consumer.config.replicaCount }} {{- end }} diff --git a/cluster/charts/fuel-streams/templates/webserver/certificate.yaml b/cluster/charts/fuel-streams/templates/webserver/certificate.yaml new file mode 100644 index 00000000..3c714ce1 --- /dev/null +++ b/cluster/charts/fuel-streams/templates/webserver/certificate.yaml @@ -0,0 +1,71 @@ +{{- $webserver := .Values.webserver }} +{{- $service := $webserver.service }} +{{- $tls := $webserver.tls }} +{{- $certificate := $tls.certificate }} +{{- $ingress := $tls.ingress }} +{{- if and $webserver.enabled $service.host }} +{{- if $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 +{{- end }} +--- +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: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/proxy-body-size: "0" + nginx.ingress.kubernetes.io/backend-protocol: "HTTP" + nginx.ingress.kubernetes.io/websocket-services: {{ include "fuel-streams.fullname" . }}-webserver + external-dns.alpha.kubernetes.io/hostname: {{ $service.host }} + external-dns.alpha.kubernetes.io/cloudflare-proxied: "false" + {{- if $tls.enabled }} + ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/ssl-redirect: "true" + acme.cert-manager.io/http01-ingress-class: nginx + cert-manager.io/common-name: {{ $service.host }} + cert-manager.io/cluster-issuer: {{ $certificate.issuer }} + {{- end }} + {{- include "set-value" (dict "context" $ingress "path" "annotations") | nindent 4 }} +spec: + ingressClassName: nginx + {{- if $tls.enabled }} + tls: + - hosts: + - {{ $service.host }} + secretName: {{ include "fuel-streams.fullname" . }}-webserver-tls + {{- end }} + rules: + - host: {{ $service.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "fuel-streams.fullname" . }}-webserver + port: + number: {{ $service.port }} +{{- end }} \ No newline at end of file diff --git a/cluster/charts/fuel-streams/templates/webserver/deployment.yaml b/cluster/charts/fuel-streams/templates/webserver/deployment.yaml index 2b83f668..226fa9d7 100644 --- a/cluster/charts/fuel-streams/templates/webserver/deployment.yaml +++ b/cluster/charts/fuel-streams/templates/webserver/deployment.yaml @@ -1,5 +1,5 @@ {{- $webserver := .Values.webserver -}} -{{- $service := $webserver.service -}} +{{- $tls := $webserver.tls -}} {{- if $webserver.enabled -}} apiVersion: apps/v1 kind: Deployment diff --git a/cluster/charts/fuel-streams/templates/webserver/service.yaml b/cluster/charts/fuel-streams/templates/webserver/service.yaml index 5dfcf58d..b1e0d561 100644 --- a/cluster/charts/fuel-streams/templates/webserver/service.yaml +++ b/cluster/charts/fuel-streams/templates/webserver/service.yaml @@ -1,30 +1,18 @@ -{{- $service := .Values.webserver.service }} -{{- if and .Values.webserver.enabled $service.enabled }} +{{- $webserver := .Values.webserver }} +{{- $service := $webserver.service }} +{{- if and $webserver.enabled $service.enabled }} apiVersion: v1 kind: Service metadata: - {{- include "k8s.metadata" (dict "context" . "suffix" "-webserver-nlb") | nindent 2 }} + {{- include "k8s.metadata" (dict "context" . "suffix" "-webserver") | nindent 2 }} annotations: - {{- if $service.dns }} - external-dns.alpha.kubernetes.io/hostname: {{ $service.dns }} - external-dns.alpha.kubernetes.io/cloudflare-proxied: "false" - {{- end }} - service.beta.kubernetes.io/aws-load-balancer-attributes: load_balancing.cross_zone.enabled=true - service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp - service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip - service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing - service.beta.kubernetes.io/aws-load-balancer-target-group-attributes: preserve_client_ip.enabled=true,stickiness.enabled=true,stickiness.type=source_ip,load_balancing.cross_zone.enabled=true - service.beta.kubernetes.io/aws-load-balancer-type: external - service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: "WebSocket=true" - {{- include "set-value" (dict "context" $service "path" "annotations") | nindent 2 }} + {{- include "set-value" (dict "context" $service "path" "annotations") | nindent 4 }} labels: {{- include "fuel-streams.labels" (dict "name" "webserver" "context" .) | nindent 4 }} {{- include "set-value" (dict "context" $service "path" "labels") | nindent 4 }} app.kubernetes.io/component: webserver spec: - type: {{ $service.type }} - loadBalancerClass: service.k8s.aws/nlb - externalTrafficPolicy: Local + type: ClusterIP ports: - appProtocol: tcp name: websocket @@ -34,4 +22,4 @@ spec: selector: {{- include "fuel-streams.selectorLabels" (dict "name" "webserver" "context" .) | nindent 4 }} app.kubernetes.io/component: webserver -{{- end }} +{{- end }} \ No newline at end of file diff --git a/cluster/charts/fuel-streams/values.yaml b/cluster/charts/fuel-streams/values.yaml index 71c6e971..5a6d0abc 100755 --- a/cluster/charts/fuel-streams/values.yaml +++ b/cluster/charts/fuel-streams/values.yaml @@ -226,7 +226,7 @@ consumer: # ------------------------------------------------------------------------------------------------- webserver: - enabled: false + enabled: true network: mainnet port: 9003 @@ -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 diff --git a/examples/Cargo.toml b/examples/Cargo.toml index eea30828..0d57c4ea 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -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 }