Skip to content

Commit 2dca913

Browse files
authored
Merge pull request #70 from cstaff14/main
added secret for rox api key
2 parents 6148068 + 13ce81f commit 2dca913

File tree

4 files changed

+56
-6
lines changed

4 files changed

+56
-6
lines changed

backups/api-key-secret.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: rox-api-token
5+
stringData:
6+
token: ### insert api token generated by stackrox

backups/cron-backup.yaml

+3-5
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ spec:
1616
spec:
1717
containers:
1818
- args:
19-
- -p
20-
- $(ACS_ADMIN_PASSWORD)
2119
- --output
2220
- /mnt
2321
- -e
@@ -28,11 +26,11 @@ spec:
2826
- central
2927
- backup
3028
env: ###either retreieve the rox pass or create a token and store it in a secret the set the env, don't use passwords in Git!
31-
- name: ACS_ADMIN_PASSWORD
29+
- name: ROX_API_TOKEN
3230
valueFrom:
3331
secretKeyRef:
34-
key: password
35-
name: acs-password
32+
key: token
33+
name: rox-api-token
3634
image: registry.redhat.io/advanced-cluster-security/rhacs-roxctl-rhel8:3.71.2
3735
imagePullPolicy: IfNotPresent
3836
name: backup-cron

backups/cron-clean-backup.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
kind: CronJob
2+
apiVersion: batch/v1
3+
metadata:
4+
name: clean-backup-cron
5+
namespace: stackrox
6+
spec:
7+
schedule: 10 1 * * *
8+
concurrencyPolicy: Allow
9+
suspend: false
10+
jobTemplate:
11+
metadata:
12+
creationTimestamp: null
13+
spec:
14+
template:
15+
metadata:
16+
creationTimestamp: null
17+
spec:
18+
volumes:
19+
- name: stackrox-backups-uat
20+
persistentVolumeClaim:
21+
claimName: stackrox-backups-uat
22+
containers:
23+
- name: clean-backup-cron
24+
image: registry.access.redhat.com/ubi8/ubi
25+
args:
26+
- /bin/sh
27+
- '-c'
28+
- 'find /mnt* -mtime +30 -exec rm {} \;'
29+
resources: {}
30+
volumeMounts:
31+
- name: stackrox-backups-uat
32+
mountPath: /mnt
33+
terminationMessagePath: /dev/termination-log
34+
terminationMessagePolicy: File
35+
imagePullPolicy: IfNotPresent
36+
restartPolicy: OnFailure
37+
terminationGracePeriodSeconds: 30
38+
dnsPolicy: ClusterFirst
39+
securityContext: {}
40+
schedulerName: default-scheduler
41+
successfulJobsHistoryLimit: 3
42+
failedJobsHistoryLimit: 1
43+
status: {}
44+

backups/readme.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
This is a simple example of running ACS/Stackrox backups in a container and storing them on a persistent volume.
22

3+
api-key-secret.yaml creates a secret from a generated rox api token
4+
- you must fill the token value in with a stackrox api token. You can see how to do that [here](https://access.redhat.com/documentation/en-us/red_hat_advanced_cluster_security_for_kubernetes/3.71/html-single/roxctl_cli/index#cli-authentication_cli-getting-started)
5+
36
cron-backups.yaml creates a container from the roxctl image and runs a backup storing it in a PVC mounted on /mnt
4-
- You can utilize ROX_API_TOKEN as an env variable and store an API token in a secret
57
- You can utilize ROX_CENTRAL_ADDRESS as an env variable as well
68
- The above env variables were not used in this case with hopes of showing simple examples that could be built upon.
79

0 commit comments

Comments
 (0)