Skip to content

Commit 6a55694

Browse files
sadliltamalsaha
authored andcommitted
Migrate TPR to CRD (#160)
1 parent 91f678f commit 6a55694

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

run.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import (
1212
"github.com/appscode/stash/pkg/analytics"
1313
"github.com/appscode/stash/pkg/controller"
1414
"github.com/appscode/stash/pkg/docker"
15+
"github.com/appscode/stash/pkg/migrator"
1516
"github.com/prometheus/client_golang/prometheus/promhttp"
1617
"github.com/spf13/cobra"
18+
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
1719
clientset "k8s.io/client-go/kubernetes"
1820
"k8s.io/client-go/tools/clientcmd"
1921
)
@@ -57,13 +59,18 @@ func NewCmdRun(version string) *cobra.Command {
5759
}
5860
kubeClient = clientset.NewForConfigOrDie(config)
5961
stashClient = scs.NewForConfigOrDie(config)
62+
crdClient := apiextensionsclient.NewForConfigOrDie(config)
6063

61-
ctrl := controller.New(kubeClient, stashClient, tag)
64+
ctrl := controller.New(kubeClient, crdClient, stashClient, tag)
6265
err = ctrl.Setup()
6366
if err != nil {
6467
log.Fatalln(err)
6568
}
6669

70+
if err = migrator.NewMigrator(kubeClient, crdClient).RunMigration(); err != nil {
71+
log.Fatalln(err)
72+
}
73+
6774
log.Infoln("Starting operator...")
6875
ctrl.Run()
6976

0 commit comments

Comments
 (0)