Skip to content

Commit 1fae845

Browse files
committed
use DefValuePerCommand
1 parent 174c287 commit 1fae845

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

cmd/skaffold/app/cmd/dev.go

-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ func runDev(ctx context.Context, out io.Writer) error {
5555
}()
5656
}
5757

58-
// force skaffold labels to be applied in dev mode - port forwarding and log tailing won't work without them
59-
opts.AddSkaffoldLabels = true
60-
6158
for {
6259
select {
6360
case <-ctx.Done():

cmd/skaffold/app/cmd/flags.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,15 @@ var flagRegistry = []Flag{
432432
DefinedOn: []string{"dev", "debug"},
433433
},
434434
{
435-
Name: "add-skaffold-labels",
436-
Usage: "Add Skaffold-specific labels to rendered manifest. Custom labels will still be applied. Helpful for GitOps model where Skaffold is not the deployer.",
437-
Value: &opts.AddSkaffoldLabels,
438-
DefValue: false,
435+
Name: "add-skaffold-labels",
436+
Usage: "Add Skaffold-specific labels to rendered manifest. Custom labels will still be applied. Helpful for GitOps model where Skaffold is not the deployer.",
437+
Value: &opts.AddSkaffoldLabels,
438+
DefValue: false,
439+
DefValuePerCommand: map[string]interface{}{
440+
"dev": true,
441+
"debug": true,
442+
"run": true,
443+
},
439444
FlagAddMethod: "BoolVar",
440445
DefinedOn: []string{"render"},
441446
IsEnum: true,

cmd/skaffold/app/cmd/run.go

-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ func NewCmdRun() *cobra.Command {
4141
}
4242

4343
func doRun(ctx context.Context, out io.Writer) error {
44-
// force skaffold labels to be applied in run mode - log tailing won't work without them
45-
opts.AddSkaffoldLabels = true
46-
4744
return withRunner(ctx, out, func(r runner.Runner, configs []*latest_v1.SkaffoldConfig) error {
4845
bRes, err := r.Build(ctx, out, targetArtifacts(opts, configs))
4946
if err != nil {

0 commit comments

Comments
 (0)