Skip to content

add no-relabeling option to backupPVC configmap#8288

Merged
Lyndon-Li merged 1 commit intovelero-io:mainfrom
sseago:spc-norelabeling
Oct 15, 2024
Merged

add no-relabeling option to backupPVC configmap#8288
Lyndon-Li merged 1 commit intovelero-io:mainfrom
sseago:spc-norelabeling

Conversation

@sseago
Copy link
Copy Markdown
Collaborator

@sseago sseago commented Oct 11, 2024

Thank you for contributing to Velero!

Please add a summary of your change

The previous SELinux fix handled podified datamover problems for users who are not setting the readOnly field for their storageclass. When the readOnly field is set (needed for ceph shallow copy), SELinux relabeling can't happen, so datamover backup will fail. This fix adds the spc_t SELinux option in cases when users set this field in the backupPVC configmap. This should only be needed for storageclasses that are already setting readOnly=true, so a new map key won't be needed, just a new value in the struct.

{
    "backupPVC": {
        "storage-class-1": {
            "readOnly": true,
            "spcNoRelabeling": true
        }
    }
}

Does your change fix a particular issue?

Fixes #(issue)

Please indicate you've done the following:

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 59.19%. Comparing base (b34e011) to head (b1035dd).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pkg/exposer/csi_snapshot.go 20.00% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8288   +/-   ##
=======================================
  Coverage   59.18%   59.19%           
=======================================
  Files         367      367           
  Lines       30838    30850   +12     
=======================================
+ Hits        18253    18263   +10     
- Misses      11124    11125    +1     
- Partials     1461     1462    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread pkg/exposer/csi_snapshot.go Outdated
}

backupPVCReadOnly = value.ReadOnly
spcNoRelabeling = value.SPCNoRelabeling
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spcNoRelabeling is only required to set when backupPVCReadOnly=true. However, here we allow users to set it separately.
This would be a security risk strictly speaking, so would we change it to:

if backupPVCReadOnly == true {
     spcNoRelabeling = value.SPCNoRelabeling
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 sounds good, lets just document this behavior explicitly (i.e. SPCNoRelabeling key would be ignored if backupPVCReadOnly is not set to true.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll do that and update the doc as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lyndon-Li Slight modification to your suggestion -- if SPCNoRelabeling is true and backupPVCReadOnly is false, then we log a warning and ignore. Also, docs updated to make it clear that the no relabeling field is ignored if readOnly=false.

Signed-off-by: Scott Seago <sseago@redhat.com>
Copy link
Copy Markdown
Collaborator

@shubham-pampattiwar shubham-pampattiwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants