Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/jenkins] Add existingSecret to Jenkins backup AWS credentials #13392

Merged
merged 7 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion stable/jenkins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: jenkins
home: https://jenkins.io/
version: 1.1.10
version: 1.1.11
appVersion: lts
description: Open source continuous integration server. It supports multiple SCM tools
including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based
Expand All @@ -19,4 +19,6 @@ maintainers:
email: [email protected]
- name: torstenwalter
email: [email protected]
- name: hajowieland
email: [email protected]
icon: https://wiki.jenkins-ci.org/download/attachments/2916393/logo.png
26 changes: 15 additions & 11 deletions stable/jenkins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,17 +345,21 @@ Adds a backup CronJob for jenkins, along with required RBAC resources.

### Backup Values

| Parameter | Description | Default |
| --------------------------- | ------------------------------------------ | --------------------------------- |
| `backup.enabled` | Enable the use of a backup CronJob | `false` |
| `backup.schedule` | Schedule to run jobs | `0 2 * * *` |
| `backup.annotations` | Backup pod annotations | iam.amazonaws.com/role: `jenkins` |
| `backup.image.repo` | Backup image repository | `nuvo/kube-tasks` |
| `backup.image.tag` | Backup image tag | `0.1.2` |
| `backup.extraArgs` | Additional arguments for kube-tasks | `[]` |
| `backup.env` | Backup environment variables | AWS_REGION: `us-east-1` |
| `backup.resources` | Backup CPU/Memory resource requests/limits | Memory: `1Gi`, CPU: `1` |
| `backup.destination` | Destination to store backup artifacts | `s3://nuvo-jenkins-data/backup` |
| Parameter | Description | Default |
| -------------------------------------- | ------------------------------------------------------ | --------------------------------- |
| `backup.enabled` | Enable the use of a backup CronJob | `false` |
| `backup.schedule` | Schedule to run jobs | `0 2 * * *` |
| `backup.annotations` | Backup pod annotations | iam.amazonaws.com/role: `jenkins` |
| `backup.image.repo` | Backup image repository | `nuvo/kube-tasks` |
| `backup.image.tag` | Backup image tag | `0.1.2` |
| `backup.extraArgs` | Additional arguments for kube-tasks | `[]` |
| `backup.existingSecret` | Environment variables to add to the cronjob container | {} |
| `backup.existingSecret.*` | Specify the secret name containing the AWS credentials | `jenkinsaws` |
| `backup.existingSecret.*.awsaccesskey` | `secretKeyRef.key` used for `AWS_ACCESS_KEY_ID` | `jenkins_aws_access_key` |
| `backup.existingSecret.*.awssecretkey` | `secretKeyRef.key` used for `AWS_SECRET_ACCESS_KEY` | `jenkins_aws_secret_key` |
| `backup.env` | Backup environment variables | AWS_REGION: `us-east-1` |
| `backup.resources` | Backup CPU/Memory resource requests/limits | Memory: `1Gi`, CPU: `1` |
| `backup.destination` | Destination to store backup artifacts | `s3://nuvo-jenkins-data/backup` |

### Restore from backup

Expand Down
14 changes: 14 additions & 0 deletions stable/jenkins/templates/jenkins-backup-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ spec:
env:
{{ toYaml . | indent 12 }}
{{- end }}
{{- if .Values.backup.existingSecret }}
{{- range $key,$value := .Values.backup.existingSecret }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ $key }}
key: {{ $value.awsaccesskey | quote }}
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ $key }}
key: {{ $value.awssecretkey | quote}}
{{- end }}
{{- end }}
{{- with .Values.backup.resources }}
resources:
{{ toYaml . | indent 14 }}
Expand Down
8 changes: 8 additions & 0 deletions stable/jenkins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ backup:
# Additional arguments for kube-tasks
# Ref: https://github.com/nuvo/kube-tasks#simple-backup
extraArgs: []
# Add existingSecret for AWS credentials
existingSecret: {}
## Example for using an existing secret
# jenkinsaws:
## Use this key for AWS access key ID
# awsaccesskey: jenkins_aws_access_key
hajowieland marked this conversation as resolved.
Show resolved Hide resolved
## Use this key for AWS secret access key
# awssecretkey: jenkins_aws_secret_key
# Add additional environment variables
env:
# Example environment variable required for AWS credentials chain
Expand Down