Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature, s3 bucket tagging for velero backups. #21

Merged
merged 2 commits into from Nov 7, 2019

Conversation

@c-e-brumm
Copy link
Contributor

c-e-brumm commented Nov 7, 2019

No description provided.

awsCredsSecretAccessKey = "aws_secret_access_key" // #nosec G101
credentialsRequestName = "velero-iam-credentials"
veleroImage = "gcr.io/heptio-images/velero:v1.0.0"
deafultBackupStorageLocation = "default"

This comment has been minimized.

Copy link
@cblecker

cblecker Nov 7, 2019

Member
Suggested change
deafultBackupStorageLocation = "default"
defaultBackupStorageLocation = "default"
@@ -124,3 +128,38 @@ func SetBucketLifecycle(s3Client *s3.S3, bucketName string) error {

return err
}
func CreateBucketTaggingInput(bucketname string, backUpLocation string) *s3.PutBucketTaggingInput {

This comment has been minimized.

Copy link
@cblecker

cblecker Nov 7, 2019

Member

Should the bucket tag key be an input here too, so that this can be resused?

This comment has been minimized.

Copy link
@c-e-brumm

c-e-brumm Nov 7, 2019

Author Contributor

Started doing this, getting messier than I'd like. Would prefer to actually do this is a second separate PR.

@@ -8,6 +8,10 @@ import (
"github.com/aws/aws-sdk-go/service/s3"
)

const (
bucketTagKey = "velero.io/backup-location"

This comment has been minimized.

Copy link
@cblecker

cblecker Nov 7, 2019

Member

As this is velero specific, should this be in pkg/controller/velero/s3.go?

This comment has been minimized.

Copy link
@c-e-brumm

c-e-brumm Nov 7, 2019

Author Contributor

The value is needed by the S3 package. But it could be moved up to the Velero controller and passed through. I opted to keep it closer to its usage for the first pass.

return putInput
}

func ClearBucketTags(s3Client *s3.S3, bucketName string) (err error) {

This comment has been minimized.

Copy link
@cblecker

cblecker Nov 7, 2019

Member

Do we use this?

This comment has been minimized.

Copy link
@c-e-brumm

c-e-brumm Nov 7, 2019

Author Contributor

ClearBucketTags is called on line 154. The spec called for correcting so they are deleted and reapplied according to spec each time through tag enforcement.

The return putInput is used on line 158 where it is passed to the s3 client for execution.

@@ -40,7 +41,7 @@ func (r *ReconcileVelero) provisionVelero(reqLogger logr.Logger, namespace strin
// Install BackupStorageLocation
foundBsl := &velerov1.BackupStorageLocation{}
bsl := veleroInstall.BackupStorageLocation(namespace, strings.ToLower(string(platformStatus.Type)), instance.Status.S3Bucket.Name, "", locationConfig)
if err = r.client.Get(context.TODO(), types.NamespacedName{Namespace: namespace, Name: "default"}, foundBsl); err != nil {
if err = r.client.Get(context.TODO(), types.NamespacedName{Namespace: namespace, Name: deafultBackupStorageLocation}, foundBsl); err != nil {

This comment has been minimized.

Copy link
@dak1n1

dak1n1 Nov 7, 2019

Suggested change
if err = r.client.Get(context.TODO(), types.NamespacedName{Namespace: namespace, Name: deafultBackupStorageLocation}, foundBsl); err != nil {
if err = r.client.Get(context.TODO(), types.NamespacedName{Namespace: namespace, Name: defaultBackupStorageLocation}, foundBsl); err != nil {
@dak1n1
dak1n1 approved these changes Nov 7, 2019
Copy link

dak1n1 left a comment

/lgtm

@openshift-ci-robot

This comment has been minimized.

Copy link

openshift-ci-robot commented Nov 7, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: c-e-brumm, dak1n1

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 0293489 into openshift:master Nov 7, 2019
3 of 4 checks passed
3 of 4 checks passed
tide Not mergeable.
Details
ci/prow/images Job succeeded.
Details
ci/prow/test Job succeeded.
Details
ci/prow/verify Job succeeded.
Details
@sachsachdeva

This comment has been minimized.

Copy link

sachsachdeva commented on c2cbc1f Nov 11, 2019

Hello Team, Is there a documentation available on this Operator?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.