Skip to content

Commit ae429b0

Browse files
committed
fix(deploy): panic in many commands when --synchronization=kubernetes://...
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
1 parent e562812 commit ae429b0

File tree

9 files changed

+64
-51
lines changed

9 files changed

+64
-51
lines changed

cmd/werf/cleanup/cleanup.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,13 @@ func runCleanup(ctx context.Context, cmd *cobra.Command) error {
108108
InitTrueGitWithOptions: &common.InitTrueGitOptions{
109109
Options: true_git.Options{LiveGitOutput: *commonCmdData.LogDebug},
110110
},
111-
InitDockerRegistry: true,
112-
InitProcessContainerBackend: true,
113-
InitWerf: true,
114-
InitGitDataManager: true,
115-
InitManifestCache: true,
116-
InitLRUImagesCache: true,
111+
InitDockerRegistry: true,
112+
InitProcessContainerBackend: true,
113+
InitWerf: true,
114+
InitGitDataManager: true,
115+
InitManifestCache: true,
116+
InitLRUImagesCache: true,
117+
SetupOndemandKubeInitializer: true,
117118
})
118119
if err != nil {
119120
return fmt.Errorf("component init error: %w", err)

cmd/werf/compose/main.go

+5
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,11 @@ func run(ctx context.Context, containerBackend container_backend.ContainerBacken
448448

449449
var envArray []string
450450
if !imagesToProcess.WithoutImages && shouldBeBuilt {
451+
common.SetupOndemandKubeInitializer(*commonCmdData.KubeContext, *commonCmdData.KubeConfig, *commonCmdData.KubeConfigBase64, *commonCmdData.KubeConfigPathMergeList)
452+
if err := common.GetOndemandKubeInitializer().Init(ctx); err != nil {
453+
return err
454+
}
455+
451456
projectName := werfConfig.Meta.Project
452457

453458
projectTmpDir, err := tmp_manager.CreateProjectDir(ctx)

cmd/werf/export/export.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ func run(ctx context.Context, imageNameListFromArgs, tagTemplateList []string, e
142142
InitTrueGitWithOptions: &common.InitTrueGitOptions{
143143
Options: true_git.Options{LiveGitOutput: *commonCmdData.LogDebug},
144144
},
145-
InitDockerRegistry: true,
146-
InitProcessContainerBackend: true,
147-
InitWerf: true,
148-
InitGitDataManager: true,
149-
InitManifestCache: true,
150-
InitLRUImagesCache: true,
151-
InitSSHAgent: true,
145+
InitDockerRegistry: true,
146+
InitProcessContainerBackend: true,
147+
InitWerf: true,
148+
InitGitDataManager: true,
149+
InitManifestCache: true,
150+
InitLRUImagesCache: true,
151+
InitSSHAgent: true,
152+
SetupOndemandKubeInitializer: true,
152153
})
153154
if err != nil {
154155
return fmt.Errorf("component init error: %w", err)

cmd/werf/managed_images/add/add.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ func run(ctx context.Context, imageName string) error {
8080
InitTrueGitWithOptions: &common.InitTrueGitOptions{
8181
Options: true_git.Options{LiveGitOutput: *commonCmdData.LogDebug},
8282
},
83-
InitDockerRegistry: true,
84-
InitProcessContainerBackend: true,
85-
InitWerf: true,
86-
InitGitDataManager: true,
87-
InitManifestCache: true,
88-
InitLRUImagesCache: true,
83+
InitDockerRegistry: true,
84+
InitProcessContainerBackend: true,
85+
InitWerf: true,
86+
InitGitDataManager: true,
87+
InitManifestCache: true,
88+
InitLRUImagesCache: true,
89+
SetupOndemandKubeInitializer: true,
8990
})
9091
if err != nil {
9192
return fmt.Errorf("component init error: %w", err)

cmd/werf/managed_images/ls/ls.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,13 @@ func run(ctx context.Context) error {
7676
InitTrueGitWithOptions: &common.InitTrueGitOptions{
7777
Options: true_git.Options{LiveGitOutput: *commonCmdData.LogDebug},
7878
},
79-
InitDockerRegistry: true,
80-
InitProcessContainerBackend: true,
81-
InitWerf: true,
82-
InitGitDataManager: true,
83-
InitManifestCache: true,
84-
InitLRUImagesCache: true,
79+
InitDockerRegistry: true,
80+
InitProcessContainerBackend: true,
81+
InitWerf: true,
82+
InitGitDataManager: true,
83+
InitManifestCache: true,
84+
InitLRUImagesCache: true,
85+
SetupOndemandKubeInitializer: true,
8586
})
8687
if err != nil {
8788
return fmt.Errorf("component init error: %w", err)

cmd/werf/managed_images/rm/rm.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ func run(ctx context.Context, imageNames []string) error {
8080
InitTrueGitWithOptions: &common.InitTrueGitOptions{
8181
Options: true_git.Options{LiveGitOutput: *commonCmdData.LogDebug},
8282
},
83-
InitDockerRegistry: true,
84-
InitProcessContainerBackend: true,
85-
InitWerf: true,
86-
InitGitDataManager: true,
87-
InitManifestCache: true,
88-
InitLRUImagesCache: true,
83+
InitDockerRegistry: true,
84+
InitProcessContainerBackend: true,
85+
InitWerf: true,
86+
InitGitDataManager: true,
87+
InitManifestCache: true,
88+
InitLRUImagesCache: true,
89+
SetupOndemandKubeInitializer: true,
8990
})
9091
if err != nil {
9192
return fmt.Errorf("component init error: %w", err)

cmd/werf/purge/purge.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ func runPurge(ctx context.Context) error {
9292
InitTrueGitWithOptions: &common.InitTrueGitOptions{
9393
Options: true_git.Options{LiveGitOutput: *commonCmdData.LogDebug},
9494
},
95-
InitDockerRegistry: true,
96-
InitProcessContainerBackend: true,
97-
InitWerf: true,
98-
InitGitDataManager: true,
99-
InitManifestCache: true,
100-
InitLRUImagesCache: true,
95+
InitDockerRegistry: true,
96+
InitProcessContainerBackend: true,
97+
InitWerf: true,
98+
InitGitDataManager: true,
99+
InitManifestCache: true,
100+
InitLRUImagesCache: true,
101+
SetupOndemandKubeInitializer: true,
101102
})
102103
if err != nil {
103104
return fmt.Errorf("component init error: %w", err)

cmd/werf/run/run.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,14 @@ func runMain(ctx context.Context) error {
225225
InitTrueGitWithOptions: &common.InitTrueGitOptions{
226226
Options: true_git.Options{LiveGitOutput: *commonCmdData.LogDebug},
227227
},
228-
InitDockerRegistry: true,
229-
InitProcessContainerBackend: true,
230-
InitWerf: true,
231-
InitGitDataManager: true,
232-
InitManifestCache: true,
233-
InitLRUImagesCache: true,
234-
InitSSHAgent: true,
228+
InitDockerRegistry: true,
229+
InitProcessContainerBackend: true,
230+
InitWerf: true,
231+
InitGitDataManager: true,
232+
InitManifestCache: true,
233+
InitLRUImagesCache: true,
234+
InitSSHAgent: true,
235+
SetupOndemandKubeInitializer: true,
235236
})
236237
if err != nil {
237238
return fmt.Errorf("component init error: %w", err)

cmd/werf/stage/image/main.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ func run(ctx context.Context, imageName string) error {
9898
InitTrueGitWithOptions: &common.InitTrueGitOptions{
9999
Options: true_git.Options{LiveGitOutput: *commonCmdData.LogDebug},
100100
},
101-
InitDockerRegistry: true,
102-
InitProcessContainerBackend: true,
103-
InitWerf: true,
104-
InitGitDataManager: true,
105-
InitManifestCache: true,
106-
InitLRUImagesCache: true,
107-
InitSSHAgent: true,
101+
InitDockerRegistry: true,
102+
InitProcessContainerBackend: true,
103+
InitWerf: true,
104+
InitGitDataManager: true,
105+
InitManifestCache: true,
106+
InitLRUImagesCache: true,
107+
InitSSHAgent: true,
108+
SetupOndemandKubeInitializer: true,
108109
})
109110
if err != nil {
110111
return fmt.Errorf("component init error: %w", err)

0 commit comments

Comments
 (0)