Skip to content

Commit

Permalink
Use secrets for backup creds
Browse files Browse the repository at this point in the history
  • Loading branch information
wkmor1 committed Jun 11, 2024
1 parent 7229ed3 commit 3a1e631
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
17 changes: 12 additions & 5 deletions oc-process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,39 @@ if [ $i = "volume" ]; then

ITEM=".items[0]"

elif [ $i = "deploy" ]; then
elif [ $i = "secrets" ]; then

ITEM=".items[1]"

elif [ $i = "service-app" ]; then
elif [ $i = "deploy" ]; then

ITEM=".items[2]"

elif [ $i = "service-api" ]; then
elif [ $i = "service-app" ]; then

ITEM=".items[3]"

elif [ $i = "route" ]; then
elif [ $i = "service-api" ]; then

ITEM=".items[4]"

elif [ $i = "job" ]; then
elif [ $i = "route" ]; then

ITEM=".items[5]"

elif [ $i = "job" ]; then

ITEM=".items[6]"

else

ITEM=""

fi

RCLONE_ACCESS_KEY_ID=$(echo -n $RCLONE_ACCESS_KEY_ID | base64)
RCLONE_SECRET_ACCESS_KEY=$(echo -n $RCLONE_SECRET_ACCESS_KEY | base64)

oc process -f $f \
-p BRANCH=$BRANCH \
-p HOST=$HOST \
Expand Down
20 changes: 17 additions & 3 deletions template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ objects:
resources:
requests:
storage: ${STORAGE}
- kind: Secret
apiVersion: v1
metadata:
name: ${APP}-${BRANCH}
type: Opaque
data:
rclone_access_key_id: ${RCLONE_ACCESS_KEY_ID}
rclone_secret_access_key: ${RCLONE_SECRET_ACCESS_KEY}
- kind: Deployment
apiVersion: apps/v1
metadata:
Expand Down Expand Up @@ -222,10 +230,16 @@ objects:
command: ${{CRON_CMD}}
env:
- name: RCLONE_CONFIG_DEFAULT_ACCESS_KEY_ID
value: ${RCLONE_ACCESS_KEY_ID}
valueFrom:
secretKeyRef:
name: ${APP}-${BRANCH}
key: rclone_access_key_id
- name: RCLONE_CONFIG_DEFAULT_SECRET_ACCESS_KEY
value: ${RCLONE_SECRET_ACCESS_KEY}
- name: API_HOSTNAME
valueFrom:
secretKeyRef:
name: ${APP}-${BRANCH}
key: rclone_secret_access_key
- name: API_HOSTNAME
value: ${API}-${BRANCH}
- name: API_PORT
value: ${API_PORT}
Expand Down

0 comments on commit 3a1e631

Please sign in to comment.