Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove deprecated cassandra flags #2789

Merged
merged 3 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/cassandra/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ type Configuration struct {
Port int `yaml:"port" mapstructure:"port"`
Authenticator Authenticator `yaml:"authenticator" mapstructure:",squash"`
DisableAutoDiscovery bool `yaml:"disable_auto_discovery" mapstructure:"-"`
EnableDependenciesV2 bool `yaml:"enable_dependencies_v2" mapstructure:"-"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect there to be some code that actually reads this field, not seeing anything like that removed in the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a recursive case-insensitive search in my jaeger root project dir and couldn't find EnableDependenciesV2 or enable_dependencies_v2.

Maybe something wrong with my search, can you see any references?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found it - the logic for that flag was already removed in #1364

TLS tlscfg.Options `mapstructure:"tls"`
}

Expand Down
3 changes: 1 addition & 2 deletions plugin/storage/cassandra/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestCassandraFactory(t *testing.T) {
logger, logBuf := testutils.NewLogger()
f := NewFactory()
v, command := config.Viperize(f.AddFlags)
command.ParseFlags([]string{"--cassandra-archive.enabled=true", "--cassandra.enable-dependencies-v2=true"})
command.ParseFlags([]string{"--cassandra-archive.enabled=true"})
f.InitFromViper(v)

// after InitFromViper, f.primaryConfig points to a real session builder that will fail in unit tests,
Expand Down Expand Up @@ -109,7 +109,6 @@ func TestExclusiveWhitelistBlacklist(t *testing.T) {
f := NewFactory()
v, command := config.Viperize(f.AddFlags)
command.ParseFlags([]string{"--cassandra-archive.enabled=true",
"--cassandra.enable-dependencies-v2=true",
"--cassandra.index.tag-whitelist=a,b,c",
"--cassandra.index.tag-blacklist=a,b,c"})
f.InitFromViper(v)
Expand Down
48 changes: 16 additions & 32 deletions plugin/storage/cassandra/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,22 @@ import (

const (
// session settings
suffixEnabled = ".enabled"
suffixConnPerHost = ".connections-per-host"
suffixMaxRetryAttempts = ".max-retry-attempts"
suffixTimeout = ".timeout"
suffixConnectTimeout = ".connect-timeout"
suffixReconnectInterval = ".reconnect-interval"
suffixServers = ".servers"
suffixPort = ".port"
suffixKeyspace = ".keyspace"
suffixDC = ".local-dc"
suffixConsistency = ".consistency"
suffixDisableCompression = ".disable-compression"
suffixProtoVer = ".proto-version"
suffixSocketKeepAlive = ".socket-keep-alive"
suffixUsername = ".username"
suffixPassword = ".password"
suffixEnableDependenciesV2 = ".enable-dependencies-v2"

suffixVerifyHost = ".tls.verify-host"
suffixEnabled = ".enabled"
suffixConnPerHost = ".connections-per-host"
suffixMaxRetryAttempts = ".max-retry-attempts"
suffixTimeout = ".timeout"
suffixConnectTimeout = ".connect-timeout"
suffixReconnectInterval = ".reconnect-interval"
suffixServers = ".servers"
suffixPort = ".port"
suffixKeyspace = ".keyspace"
suffixDC = ".local-dc"
suffixConsistency = ".consistency"
suffixDisableCompression = ".disable-compression"
suffixProtoVer = ".proto-version"
suffixSocketKeepAlive = ".socket-keep-alive"
suffixUsername = ".username"
suffixPassword = ".password"

// common storage settings
suffixSpanStoreWriteCacheTTL = ".span-store-write-cache-ttl"
Expand Down Expand Up @@ -231,14 +228,6 @@ func addFlags(flagSet *flag.FlagSet, nsConfig namespaceConfig) {
nsConfig.namespace+suffixPassword,
nsConfig.Authenticator.Basic.Password,
"Password for password authentication for Cassandra")
flagSet.Bool(
nsConfig.namespace+suffixEnableDependenciesV2,
nsConfig.EnableDependenciesV2,
"(deprecated) Jaeger will automatically detect the version of the dependencies table")
flagSet.Bool(
nsConfig.namespace+suffixVerifyHost,
false,
"(deprecated) Enable (or disable) host key verification. Use "+nsConfig.namespace+".tls.skip-host-verify instead")
}

// InitFromViper initializes Options with properties from viper
Expand Down Expand Up @@ -282,13 +271,8 @@ func (cfg *namespaceConfig) initFromViper(v *viper.Viper) {
cfg.SocketKeepAlive = v.GetDuration(cfg.namespace + suffixSocketKeepAlive)
cfg.Authenticator.Basic.Username = v.GetString(cfg.namespace + suffixUsername)
cfg.Authenticator.Basic.Password = v.GetString(cfg.namespace + suffixPassword)
cfg.EnableDependenciesV2 = v.GetBool(cfg.namespace + suffixEnableDependenciesV2)
cfg.DisableCompression = v.GetBool(cfg.namespace + suffixDisableCompression)
cfg.TLS = tlsFlagsConfig.InitFromViper(v)

if v.IsSet(cfg.namespace + suffixVerifyHost) {
cfg.TLS.SkipHostVerify = !v.GetBool(cfg.namespace + suffixVerifyHost)
}
}

// GetPrimary returns primary configuration.
Expand Down
15 changes: 0 additions & 15 deletions plugin/storage/cassandra/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func TestOptionsWithFlags(t *testing.T) {
"--cas-aux.enabled=true",
"--cas-aux.keyspace=jaeger-archive",
"--cas-aux.servers=3.3.3.3, 4.4.4.4",
"--cas-aux.enable-dependencies-v2=true",
})
opts.InitFromViper(v)

Expand All @@ -77,7 +76,6 @@ func TestOptionsWithFlags(t *testing.T) {
assert.Equal(t, "mojave", primary.LocalDC)
assert.Equal(t, []string{"1.1.1.1", "2.2.2.2"}, primary.Servers)
assert.Equal(t, "ONE", primary.Consistency)
assert.Equal(t, false, primary.EnableDependenciesV2)
assert.Equal(t, []string{"blerg", "blarg", "blorg"}, opts.TagIndexBlacklist())
assert.Equal(t, []string{"flerg", "flarg", "florg"}, opts.TagIndexWhitelist())
assert.Equal(t, true, opts.Index.Tags)
Expand All @@ -96,19 +94,6 @@ func TestOptionsWithFlags(t *testing.T) {
assert.Equal(t, "", aux.Consistency, "aux storage does not inherit consistency from primary")
assert.Equal(t, 3, aux.ProtoVersion)
assert.Equal(t, 42*time.Second, aux.SocketKeepAlive)
assert.Equal(t, true, aux.EnableDependenciesV2)
}

func TestDeprecatedTlsHostVerifyFlagShouldBeRespected(t *testing.T) {
opts := NewOptions("cas")
v, command := config.Viperize(opts.AddFlags)
command.ParseFlags([]string{
"--cas.tls.verify-host=false",
})
opts.InitFromViper(v)

primary := opts.GetPrimary()
assert.Equal(t, true, primary.TLS.SkipHostVerify)
}

func TestDefaultTlsHostVerify(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion plugin/storage/integration/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func (s *CassandraStorageIntegration) initializeCassandra() error {
func (s *CassandraStorageIntegration) initializeCassandraDependenciesV2() error {
f, err := s.initializeCassandraFactory([]string{
"--cassandra.keyspace=jaeger_v1_dc1",
"--cassandra.enable-dependencies-v2=true",
"--cassandra.port=9043",
})
if err != nil {
Expand Down