This commit is contained in:
parent
79b027fe07
commit
68f44eb5e4
2
.env
2
.env
@ -1,3 +1,3 @@
|
||||
PROD_URL=git.gmoker.com
|
||||
IMAGEAPP=docker.io/gitea/gitea:1.22.0-rootless
|
||||
IMAGEAPP=docker.io/gitea/gitea:1.22.2-rootless
|
||||
IMAGERUNNER=docker.io/gitea/act_runner:0.2.10-dind-rootless
|
||||
|
@ -19,31 +19,25 @@ function kcreatecm() {
|
||||
function kgseckey() {
|
||||
local sec="$1"; shift
|
||||
local key="$1"; shift
|
||||
local ret
|
||||
|
||||
ret="$(kubectl get secret "$sec" -o jsonpath="{.data.$key}" | base64 -d)"
|
||||
if [ "$?" -ne 0 ] || [ -z "$ret" ]; then
|
||||
if ! kubectl get secret "$sec" -ojson | jq -re ".data.\"$key\" // empty" | base64 -d; then
|
||||
return 1
|
||||
fi
|
||||
echo "$ret"
|
||||
}
|
||||
|
||||
function kgcmkey() {
|
||||
local cm="$1"; shift
|
||||
local cm="$1"; shift
|
||||
local key="$1"; shift
|
||||
local ret;
|
||||
|
||||
ret="$(kubectl get configmap "$cm" -o jsonpath="{.data.$key}")"
|
||||
if [ "$?" -ne 0 ] || [ -z "$ret" ]; then
|
||||
if ! kubectl get configmap "$cm" -ojson | jq -re ".data.\"$key\" // empty"; then
|
||||
return 1
|
||||
fi
|
||||
echo "$ret"
|
||||
}
|
||||
|
||||
|
||||
kapply common/db.yaml
|
||||
|
||||
export REDIS_HOST=redis
|
||||
export REDIS_HOST=valkey
|
||||
export REDIS_DB=0
|
||||
export REDIS_PORT=6379
|
||||
export POSTGRES_HOST; POSTGRES_HOST="$(kgseckey postgres-app host)"
|
||||
@ -60,7 +54,7 @@ kcreatesec gitea-admin \
|
||||
--from-literal=username="$GITEA_USERNAME" \
|
||||
--from-literal=password="$GITEA_PASSWORD"
|
||||
|
||||
kubectl run --image "$IMAGEAPP" secrets sleep 60
|
||||
kubectl run --image "$IMAGEAPP" secrets sleep 600
|
||||
sleep 5
|
||||
kcreatesec gitea \
|
||||
--from-literal=secret_key="$(kgseckey gitea secret_key || kubectl exec secrets -- gitea generate secret SECRET_KEY)" \
|
||||
@ -72,7 +66,7 @@ kcreatecm gitea \
|
||||
--from-file=app.ini=<(envsubst "$(env | xargs printf '$%s ')" < config/app.ini)
|
||||
|
||||
kapply common/job.yaml \
|
||||
common/redis.yaml \
|
||||
common/valkey.yaml \
|
||||
common/app.yaml
|
||||
|
||||
kubectl rollout restart statefulset app
|
||||
|
@ -2,36 +2,36 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis
|
||||
name: valkey
|
||||
labels:
|
||||
app: redis
|
||||
app: valkey
|
||||
spec:
|
||||
selector:
|
||||
app: redis
|
||||
app: valkey
|
||||
ports:
|
||||
- name: redis
|
||||
- name: valkey
|
||||
port: 6379
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: redis
|
||||
name: valkey
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: redis
|
||||
serviceName: redis
|
||||
app: valkey
|
||||
serviceName: valkey
|
||||
replicas: $NB_REPLICAS
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: redis
|
||||
app: valkey
|
||||
spec:
|
||||
containers:
|
||||
- name: redis
|
||||
image: docker.io/redis:latest
|
||||
- name: valkey
|
||||
image: docker.io/valkey/valkey:latest
|
||||
ports:
|
||||
- name: redis
|
||||
- name: valkey
|
||||
containerPort: 6379
|
||||
volumeMounts:
|
||||
- name: data
|
Loading…
Reference in New Issue
Block a user