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

tail the logs of a particular container when migrating #20

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const desiredReclaimAnnotation = baseAnnotation + "-reclaim"
// but that would require adding the k8s import overrides to our go.mod
const IsDefaultStorageClassAnnotation = "storageclass.kubernetes.io/is-default-class"

const pvMigrateContainerName = "pvmigrate"

// Cli uses CLI options to run Migrate
func Cli() {
var sourceSCName string
Expand Down Expand Up @@ -240,7 +242,8 @@ func copyOnePVC(ctx context.Context, w *log.Logger, clientset k8sclient.Interfac
}

podLogsReq := clientset.CoreV1().Pods(ns).GetLogs(createdPod.Name, &corev1.PodLogOptions{
Follow: true,
Container: pvMigrateContainerName,
Follow: true,
})
podLogs, err := podLogsReq.Stream(ctx)
if err != nil {
Expand Down Expand Up @@ -330,7 +333,7 @@ func createMigrationPod(ctx context.Context, clientset k8sclient.Interface, ns s
},
Containers: []corev1.Container{
{
Name: "pvmigrate-" + sourcePvcName,
Name: pvMigrateContainerName,
Image: rsyncImage,
Command: []string{
"rsync",
Expand Down
2 changes: 1 addition & 1 deletion pkg/migrate/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ func Test_createMigrationPod(t *testing.T) {
},
Containers: []corev1.Container{
{
Name: "pvmigrate-sourcepvc",
Name: "pvmigrate",
Image: "imagename",
Command: []string{
"rsync",
Expand Down