Skip to content

Commit 274f5d6

Browse files
authored
Add ff back for export (#299)
1 parent 7e0dcca commit 274f5d6

3 files changed

Lines changed: 24 additions & 9 deletions

File tree

app/feature.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import (
1111
)
1212

1313
var (
14+
ExportFeatureFlag = "enable-export"
1415
GCPSinkFeatureFlag = "enable-gcp-sink"
1516
featureflagFileName = "feature.json"
1617
)
1718

18-
var supportFeatureFlags = []string{GCPSinkFeatureFlag}
19+
var supportFeatureFlags = []string{GCPSinkFeatureFlag, ExportFeatureFlag}
1920

2021
type FeatureFlag struct {
2122
Name string `json:"Name"`
@@ -118,6 +119,14 @@ func NewFeatureCommand() (CommandOut, error) {
118119
Usage: "feature commands",
119120
Hidden: true,
120121
Subcommands: []*cli.Command{
122+
{
123+
Name: "toggle-export",
124+
Aliases: []string{"te"},
125+
Usage: "switch export on/off",
126+
Action: func(c *cli.Context) error {
127+
return toggleFeature(ExportFeatureFlag)
128+
},
129+
},
121130
{
122131
Name: "toggle-gcp-sink",
123132
Aliases: []string{"tgs"},

app/namespace.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,17 +1648,20 @@ func NewNamespaceCommand(getNamespaceClientFn GetNamespaceClientFn) (CommandOut,
16481648
},
16491649
}
16501650

1651-
exportS3Commands.Subcommands = append(exportS3Commands.Subcommands, exportGeneralCommands...)
1652-
exportCommand.Subcommands = append(exportCommand.Subcommands, exportS3Commands)
1651+
// TODO: remove Export sink feature flag check when out of pre-release
1652+
if IsFeatureEnabled(ExportFeatureFlag) {
1653+
exportS3Commands.Subcommands = append(exportS3Commands.Subcommands, exportGeneralCommands...)
1654+
exportCommand.Subcommands = append(exportCommand.Subcommands, exportS3Commands)
1655+
1656+
// TODO: remove GCP sink feature flag check when out of pre-release
1657+
if IsFeatureEnabled(GCPSinkFeatureFlag) {
1658+
exportGCSCommands.Subcommands = append(exportGCSCommands.Subcommands, exportGeneralCommands...)
1659+
exportCommand.Subcommands = append(exportCommand.Subcommands, exportGCSCommands)
1660+
}
16531661

1654-
// TODO: remove GCP sink feature flag check when out of pre-release
1655-
if IsFeatureEnabled(GCPSinkFeatureFlag) {
1656-
exportGCSCommands.Subcommands = append(exportGCSCommands.Subcommands, exportGeneralCommands...)
1657-
exportCommand.Subcommands = append(exportCommand.Subcommands, exportGCSCommands)
1662+
subCommands = append(subCommands, exportCommand)
16581663
}
16591664

1660-
subCommands = append(subCommands, exportCommand)
1661-
16621665
command := &cli.Command{
16631666
Name: "namespace",
16641667
Aliases: []string{"n"},

app/namespace_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ func (s *NamespaceTestSuite) SetupTest() {
4646
},
4747
}
4848

49+
err = s.RunCmd("feature", "toggle-export")
50+
s.Require().NoError(err)
51+
4952
err = s.RunCmd("feature", "toggle-gcp-sink")
5053
s.Require().NoError(err)
5154

0 commit comments

Comments
 (0)