Skip to content

Commit 8fd1a04

Browse files
committed
feat(deploy): --no-install-crds option for converge, plan, bundle apply
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
1 parent 3363cd9 commit 8fd1a04

File tree

7 files changed

+16
-3
lines changed

7 files changed

+16
-3
lines changed

cmd/werf/bundle/apply/apply.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ func NewCmd(ctx context.Context) *cobra.Command {
119119
common.SetupRollbackGraphPath(&commonCmdData, cmd)
120120

121121
common.SetupRenderSubchartNotes(&commonCmdData, cmd)
122+
common.SetupNoInstallCRDs(&commonCmdData, cmd)
122123

123124
defaultTag := os.Getenv("WERF_TAG")
124125
if defaultTag == "" {
@@ -238,6 +239,7 @@ func runApply(ctx context.Context) error {
238239
KubeToken: *commonCmdData.KubeToken,
239240
LogRegistryStreamOut: os.Stdout,
240241
NetworkParallelism: common.GetNetworkParallelism(&commonCmdData),
242+
NoInstallCRDs: *commonCmdData.NoInstallCRDs,
241243
NoProgressTablePrint: *commonCmdData.StatusProgressPeriodSeconds == -1,
242244
ProgressTablePrintInterval: time.Duration(*commonCmdData.StatusProgressPeriodSeconds) * time.Second,
243245
RegistryCredentialsPath: registryCredentialsPath,

cmd/werf/common/cmd_data.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ type CmdData struct {
116116
RollbackGraphPath *string
117117

118118
RenderSubchartNotes *bool
119+
NoInstallCRDs *bool
119120

120121
VirtualMerge *bool
121122

cmd/werf/common/common.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,12 @@ func SetupKubeBurstLimit(cmdData *CmdData, cmd *cobra.Command) {
298298
)
299299
}
300300

301+
func SetupNoInstallCRDs(cmdData *CmdData, cmd *cobra.Command) {
302+
cmdData.NoInstallCRDs = new(bool)
303+
304+
cmd.Flags().BoolVarP(cmdData.NoInstallCRDs, "no-install-crds", "", util.GetBoolEnvironmentDefaultFalse("WERF_NO_INSTALL_CRDS"), `Do not install CRDs from "crds/" directories of installed charts (default $WERF_NO_INSTALL_CRDS)`)
305+
}
306+
301307
func GetNetworkParallelism(cmdData *CmdData) int {
302308
if *cmdData.NetworkParallelism < 1 {
303309
panic(fmt.Sprintf("bad network parallelism value: %d (should be >= 1)", *cmdData.NetworkParallelism))

cmd/werf/converge/converge.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ werf converge --repo registry.mydomain.com/web --env production`,
184184
common.SetupRollbackGraphPath(&commonCmdData, cmd)
185185

186186
common.SetupRenderSubchartNotes(&commonCmdData, cmd)
187+
common.SetupNoInstallCRDs(&commonCmdData, cmd)
187188

188189
defaultTimeout, err := util.GetIntEnvVar("WERF_TIMEOUT")
189190
if err != nil || defaultTimeout == nil {
@@ -465,6 +466,7 @@ func run(
465466
KubeToken: *commonCmdData.KubeToken,
466467
LogRegistryStreamOut: os.Stdout,
467468
NetworkParallelism: common.GetNetworkParallelism(&commonCmdData),
469+
NoInstallCRDs: *commonCmdData.NoInstallCRDs,
468470
NoProgressTablePrint: *commonCmdData.StatusProgressPeriodSeconds == -1,
469471
ProgressTablePrintInterval: time.Duration(*commonCmdData.StatusProgressPeriodSeconds) * time.Second,
470472
RegistryCredentialsPath: registryCredentialsPath,

cmd/werf/plan/plan.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ werf plan --repo registry.mydomain.com/web --env production`,
179179
common.SetupNetworkParallelism(&commonCmdData, cmd)
180180
common.SetupKubeQpsLimit(&commonCmdData, cmd)
181181
common.SetupKubeBurstLimit(&commonCmdData, cmd)
182+
common.SetupNoInstallCRDs(&commonCmdData, cmd)
182183

183184
defaultTimeout, err := util.GetIntEnvVar("WERF_TIMEOUT")
184185
if err != nil || defaultTimeout == nil {
@@ -464,6 +465,7 @@ func run(
464465
KubeToken: *commonCmdData.KubeToken,
465466
LogRegistryStreamOut: os.Stdout,
466467
NetworkParallelism: common.GetNetworkParallelism(&commonCmdData),
468+
NoInstallCRDs: *commonCmdData.NoInstallCRDs,
467469
RegistryCredentialsPath: registryCredentialsPath,
468470
ReleaseStorageDriver: os.Getenv("HELM_DRIVER"),
469471
SecretKeyIgnore: *commonCmdData.IgnoreSecretKey,

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ require (
6666
github.com/werf/kubedog-for-werf-helm v0.0.0-20241217155728-9d45c48b82b6
6767
github.com/werf/lockgate v0.1.1
6868
github.com/werf/logboek v0.6.1
69-
github.com/werf/nelm v1.3.1-0.20250507104643-810a45fc4dc2
69+
github.com/werf/nelm v1.3.1-0.20250512164053-bd485476b5a8
7070
github.com/werf/nelm-for-werf-helm v0.0.0-20241217155925-b0e6734d1dbf
7171
go.opentelemetry.io/otel v1.24.0
7272
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,8 +1406,8 @@ github.com/werf/lockgate v0.1.1 h1:S400JFYjtWfE4i4LY9FA8zx0fMdfui9DPrBiTciCrx4=
14061406
github.com/werf/lockgate v0.1.1/go.mod h1:0yIFSLq9ausy6ejNxF5uUBf/Ib6daMAfXuCaTMZJzIE=
14071407
github.com/werf/logboek v0.6.1 h1:oEe6FkmlKg0z0n80oZjLplj6sXcBeLleCkjfOOZEL2g=
14081408
github.com/werf/logboek v0.6.1/go.mod h1:Gez5J4bxekyr6MxTmIJyId1F61rpO+0/V4vjCIEIZmk=
1409-
github.com/werf/nelm v1.3.1-0.20250507104643-810a45fc4dc2 h1:9rUW1CbPE0PDKPTodwI+XS9URIlbasus9nzfogyTkWc=
1410-
github.com/werf/nelm v1.3.1-0.20250507104643-810a45fc4dc2/go.mod h1:9SR2Rfi0uE06z5bbnFRqfZTePNGnbyw9RLOVyYuV+cg=
1409+
github.com/werf/nelm v1.3.1-0.20250512164053-bd485476b5a8 h1:hv9MuHUsJmGUI9u81Esfq5dpVa9DSc55wtRZxpDY9SU=
1410+
github.com/werf/nelm v1.3.1-0.20250512164053-bd485476b5a8/go.mod h1:9SR2Rfi0uE06z5bbnFRqfZTePNGnbyw9RLOVyYuV+cg=
14111411
github.com/werf/nelm-for-werf-helm v0.0.0-20241217155925-b0e6734d1dbf h1:K51qz209c1yJgKzPw8AeS72T21F/ACp0VI3RJvT4THA=
14121412
github.com/werf/nelm-for-werf-helm v0.0.0-20241217155925-b0e6734d1dbf/go.mod h1:7RJXSGPKKPEvfPqrTwNA8jT7y52O0ebwhSbSn29ESMA=
14131413
github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=

0 commit comments

Comments
 (0)