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

PT-2281 - provide container name for copying files in the dump #717

Merged

Conversation

svetasmirnova
Copy link
Collaborator

  • Changed getIndividualFiles function and Dumper data structure, so we can specify container name for PXC and other operators which store logs in the separate container.

  • The contributed code is licensed under GPL v2.0

  • Contributor Licence Agreement (CLA) is signed

  • util/update-modules has been ran

  • Documentation updated

  • Test suite update

- Changed getIndividualFiles function and Dumper data structure, so we
  can specify container name for PXC and other operators which store
  logs in the separate container.
Copy link

render bot commented Nov 17, 2023

@@ -372,7 +374,7 @@ type crSecrets struct {

// TODO: check if resource parameter is really needed
func (d *Dumper) getIndividualFiles(resource, namespace string, podName, path, location string, tw *tar.Writer) error {
args := []string{"-n", namespace, "cp", podName + ":" + path, "/dev/stdout"}
args := []string{"-n", namespace, "-c", d.fileContainer, "cp", podName + ":" + path, "/dev/stdout"}
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed, d.fileContainer is used for pxc only which means if this function is called in future for PSMDB/PG, this is effectively calling kubectl -c cp which means an empty container name and the command will error out. It would be good to consider this case and fix it, so that getIndividualFiles can work independent of any constraints

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cshiv, how do you suggest to handle it? Return error or use default container?

Copy link
Contributor

Choose a reason for hiding this comment

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

@svetasmirnova Using the container name is an assured way and I believe we should continue using container name for getting the file. I would prefer returning an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Implemented, please review.

- Implemented error handling when container name is not specified
- Added test case for error handling
@svetasmirnova svetasmirnova requested a review from cshiv November 29, 2023 02:08
Copy link
Contributor

@cshiv cshiv left a comment

Choose a reason for hiding this comment

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

LGTM

@svetasmirnova svetasmirnova merged commit ae67adb into 3.x Nov 30, 2023
4 checks passed
@svetasmirnova svetasmirnova deleted the PT-2281_provide_container_name_for_copying_files_in_the_dump branch November 30, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants