Skip to content

Commit

Permalink
Merge pull request #33 from projectsyn/permission-fix-ocp
Browse files Browse the repository at this point in the history
Fix backup tmpfile permissions on OCP
  • Loading branch information
bastjan authored Apr 7, 2022
2 parents bdb6b5d + 2e0db37 commit 9e56584
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 1 deletion.
6 changes: 6 additions & 0 deletions component/backup.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ local backupPod = backup.PreBackupPod(
config: {
mountPath: '/etc/vault/',
},
home: {
mountPath: '/home/vault',
},
},
},
},
Expand All @@ -105,6 +108,9 @@ local backupPod = backup.PreBackupPod(
name: backupConfig.metadata.name,
},
},
home: {
emptyDir: {},
},
},
serviceAccountName: backupSA.metadata.name,
},
Expand Down
13 changes: 12 additions & 1 deletion tests/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
---
parameters:
kapitan:
dependencies:
- type: https
source: https://raw.githubusercontent.com/projectsyn/component-backup-k8up/v3.0.1/lib/backup-k8up.libjsonnet
output_path: vendor/lib/backup-k8up.libjsonnet

backup_k8up:
global_backup_config:
s3_endpoint: null
prometheus_push_gateway: null

_instance: vault
vault:
name: foobar
Expand All @@ -17,7 +28,7 @@ parameters:
memory: 9001Mi
cpu: 1000m
backup:
enabled: false
enabled: true
x_forwarded_for:
authorized_addrs: "198.51.100.0/24" # TEST-NET-2
reject_not_authorized: "true"
Expand Down
56 changes: 56 additions & 0 deletions tests/golden/defaults/vault/vault/30_backup/31_schedule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
data: {}
kind: Secret
metadata:
annotations: {}
labels:
name: foobar-backup-password
name: foobar-backup-password
stringData:
password: t-silent-test-1234/c-green-test-1234/vault/vault/backup/password
type: Opaque
---
apiVersion: v1
data: {}
kind: Secret
metadata:
annotations: {}
labels:
name: foobar-backup-s3-credentials
name: foobar-backup-s3-credentials
stringData:
password: t-silent-test-1234/c-green-test-1234/vault/vault/backup/s3_secret_key
username: t-silent-test-1234/c-green-test-1234/vault/vault/backup/s3_access_key
type: Opaque
---
apiVersion: k8up.io/v1
kind: Schedule
metadata:
name: foobar
namespace: vault
spec:
backend:
repoPasswordSecretRef:
key: password
name: foobar-backup-password
s3:
accessKeyIDSecretRef:
key: username
name: foobar-backup-s3-credentials
bucket: vault-backup
endpoint: null
secretAccessKeySecretRef:
key: password
name: foobar-backup-s3-credentials
backup:
keepJobs: 5
promURL: null
schedule: '*/13 * * * *'
check:
promURL: null
schedule: 30 3 * * *
prune:
retention:
keepDaily: 30
keepLast: 20
schedule: 23 * * * *
63 changes: 63 additions & 0 deletions tests/golden/defaults/vault/vault/30_backup/32_backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: v1
data:
vault-agent-config.hcl: "exit_after_auth = false\nauto_auth {\n method \"kubernetes\"\
\ {\n config = {\n role = \"backup\"\n }\n }\n \
\ sink \"file\" {\n config = {\n path = \"/home/vault/.vault-token\"\
\n mode = 0644\n }\n }\n}\n"
kind: ConfigMap
metadata:
annotations: {}
labels:
name: foobar-backup
name: foobar-backup
namespace: vault
---
apiVersion: k8up.io/v1
kind: PreBackupPod
metadata:
name: foobar
namespace: vault
spec:
backupCommand: vault operator raft snapshot save /dev/stdout
fileExtension: .snapshot
pod:
spec:
containers:
- args: []
env:
- name: HOME
value: /home/vault
- name: SKIP_SETCAP
value: 'true'
- name: VAULT_ADDR
value: http://foobar-active:8200
image: docker.io/vault:1.7.3
imagePullPolicy: IfNotPresent
name: backup
ports: []
stdin: false
tty: false
volumeMounts:
- mountPath: /etc/vault/
name: config
- mountPath: /home/vault
name: home
imagePullSecrets: []
initContainers: []
serviceAccountName: foobar-backup
terminationGracePeriodSeconds: 30
volumes:
- configMap:
name: foobar-backup
name: config
- emptyDir: {}
name: home
---
apiVersion: v1
kind: ServiceAccount
metadata:
annotations: {}
labels:
name: foobar-backup
name: foobar-backup
namespace: vault

0 comments on commit 9e56584

Please sign in to comment.