Skip to content

Commit

Permalink
Merge pull request #20 from replicatedhq/laverya/handle-injection-of-…
Browse files Browse the repository at this point in the history
…additional-containers-into-pods

tail the logs of a particular container when migrating
  • Loading branch information
laverya authored Aug 13, 2021
2 parents 3f89cbb + f9bd6ac commit 5b59873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit 5b59873

Please sign in to comment.