5 Commits

Author SHA1 Message Date
5165759558 add JWT secret reference
Some checks failed
Ruby Lint / lint (push) Successful in 20s
Ruby Test / test (push) Successful in 24s
Release / docker (push) Has been cancelled
2025-05-10 18:13:02 -05:00
10f73b96ec refer to the session secret using the application name prefix 2025-05-10 18:12:37 -05:00
5097e551e2 just call the Kubernetes secret "kubernaut" 2025-05-10 18:10:50 -05:00
820d2d8c51 move secret related contstants to Config class
Some checks failed
Ruby Lint / lint (push) Failing after 13s
Ruby Test / test (push) Successful in 16s
2025-05-10 17:46:46 -05:00
eb5c12ca91 remove secret from Kustomize 2025-05-10 17:46:46 -05:00
4 changed files with 12 additions and 6 deletions

2
app.rb
View File

@ -24,8 +24,6 @@ require "config"
VERSION = "0.2.1" VERSION = "0.2.1"
CHUNK_SIZE = 1024**2 CHUNK_SIZE = 1024**2
SESSION_SECRET_HEX_LENGTH = 64
JWT_SECRET_HEX_LENGTH = 64
DEFAULT_FLAKEY = 50 DEFAULT_FLAKEY = 50
NAME = "kubernaut".freeze NAME = "kubernaut".freeze

View File

@ -22,12 +22,18 @@ spec:
- name: sinatra-web - name: sinatra-web
containerPort: 4567 containerPort: 4567
env: env:
- name: SESSION_SECRET - name: KUBERNAUT_SESSION_SECRET
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: kubernaut-session-secret name: kubernaut
key: session_secret key: session_secret
optional: true optional: true
- name: KUBERNAUT_JWT_SECRET
valueFrom:
secretKeyRef:
name: kubernaut
key: jwt_secret
optional: true
envFrom: envFrom:
- configMapRef: - configMapRef:
name: kubernaut-configmap name: kubernaut-configmap

View File

@ -3,7 +3,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
namespace: kubernaut namespace: kubernaut
resources: resources:
- secret.yaml
- configmap.yaml - configmap.yaml
- deployment.yaml - deployment.yaml
- hpa.yaml - hpa.yaml

View File

@ -1,5 +1,8 @@
require "sensitive" require "sensitive"
SESSION_SECRET_HEX_LENGTH = 64
JWT_SECRET_HEX_LENGTH = 64
class Config class Config
attr_accessor :cat attr_accessor :cat
@ -9,7 +12,7 @@ class Config
@prefix = prefix @prefix = prefix
@cat = cat @cat = cat
session_secret ||= ENV.fetch "SESSION_SECRET" do session_secret ||= fetch_env "SESSION_SECRET" do
SecureRandom.hex SESSION_SECRET_HEX_LENGTH SecureRandom.hex SESSION_SECRET_HEX_LENGTH
end end