[WIP] AWS S3 backup

- add backup type to API
- add AWS S3 backup configuration to API
This commit is contained in:
Tomasz Sęk 2019-01-16 00:22:40 +01:00
parent ca2817ad1d
commit e507d23b0e
No known key found for this signature in database
GPG Key ID: DC356D23F6A644D0
2 changed files with 41 additions and 2 deletions

View File

@ -12,8 +12,30 @@ import (
type JenkinsSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
Master JenkinsMaster `json:"master,omitempty"`
SeedJobs []SeedJob `json:"seedJobs,omitempty"`
Backup JenkinsBackup `json:"backup,omitempty"`
BackupAmazonS3 JenkinsBackupAmazonS3 `json:"backupAmazonS3,omitempty"`
Master JenkinsMaster `json:"master,omitempty"`
SeedJobs []SeedJob `json:"seedJobs,omitempty"`
}
// JenkinsBackup defines type of Jenkins backup
type JenkinsBackup string
const (
// JenkinsBackupTypeNoBackup tells that Jenkins won't backup jobs
JenkinsBackupTypeNoBackup = "NoBackup"
// JenkinsBackupTypeAmazonS3 tells that Jenkins will backup jobs into AWS S3 bucket
JenkinsBackupTypeAmazonS3 = "AmazonS3"
)
// AllowedJenkinsBackups consists allowed Jenkins backup types
var AllowedJenkinsBackups = []JenkinsBackup{JenkinsBackupTypeNoBackup, JenkinsBackupTypeAmazonS3}
// JenkinsBackupAmazonS3 defines backup configuration to AWS S3 bucket
type JenkinsBackupAmazonS3 struct {
BucketName string `json:"bucketName,omitempty"`
BucketPath string `json:"bucketPath,omitempty"`
Region string `json:"region,omitempty"`
}
// JenkinsMaster defines the Jenkins master pod attributes and plugins,

View File

@ -77,6 +77,22 @@ func (in *Jenkins) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JenkinsBackupAmazonS3) DeepCopyInto(out *JenkinsBackupAmazonS3) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JenkinsBackupAmazonS3.
func (in *JenkinsBackupAmazonS3) DeepCopy() *JenkinsBackupAmazonS3 {
if in == nil {
return nil
}
out := new(JenkinsBackupAmazonS3)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JenkinsList) DeepCopyInto(out *JenkinsList) {
*out = *in
@ -152,6 +168,7 @@ func (in *JenkinsMaster) DeepCopy() *JenkinsMaster {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JenkinsSpec) DeepCopyInto(out *JenkinsSpec) {
*out = *in
out.BackupAmazonS3 = in.BackupAmazonS3
in.Master.DeepCopyInto(&out.Master)
if in.SeedJobs != nil {
in, out := &in.SeedJobs, &out.SeedJobs