diff --git a/pkg/apis/virtuslab/v1alpha1/jenkins_types.go b/pkg/apis/virtuslab/v1alpha1/jenkins_types.go index e4dd8cda..d9f4a33f 100644 --- a/pkg/apis/virtuslab/v1alpha1/jenkins_types.go +++ b/pkg/apis/virtuslab/v1alpha1/jenkins_types.go @@ -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, diff --git a/pkg/apis/virtuslab/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/virtuslab/v1alpha1/zz_generated.deepcopy.go index f283db4f..06cb4f48 100644 --- a/pkg/apis/virtuslab/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/virtuslab/v1alpha1/zz_generated.deepcopy.go @@ -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