From e11efa3ce240743c06b7d08ae99f24bbf6f21bc0 Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Tue, 2 Nov 2021 22:19:48 +0200 Subject: [PATCH 1/2] Add dc.Spec.Config validation for properties that are not available in defined version --- CHANGELOG.md | 1 + Makefile | 4 + .../v1beta1/cassandra_config_generated.go | 725 ++++++++++++++++++ .../v1beta1/cassandradatacenter_webhook.go | 44 +- apis/cassandra/v1beta1/webhook_test.go | 42 + hack/config/Pipfile | 12 + hack/config/generate.sh | 8 + hack/config/parse.py | 85 ++ pkg/reconciliation/handler.go | 3 + 9 files changed, 923 insertions(+), 1 deletion(-) create mode 100644 apis/cassandra/v1beta1/cassandra_config_generated.go create mode 100644 hack/config/Pipfile create mode 100755 hack/config/generate.sh create mode 100644 hack/config/parse.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 0513abf0..75ac054a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Changelog for Cass Operator, new PRs should update the `main / unreleased` secti ## unreleased * [CHANGE] [#354](https://github.com/k8ssandra/cass-operator/issues/354) Remove oldDefunctLabel support since we recreate StS. Fix #335 created-by value to match expected value. +* [ENHANCEMENT] [#224](https://github.com/k8ssandra/cass-operator/pull/224) Validate dc.Spec.Config properties against the Cassandra's allowed config value list * [ENHANCEMENT] [#383](https://github.com/k8ssandra/cass-operator/pull/383) Add UpgradeSSTables, Compaction and Scrub to management-api client. Improve CassandraTasks to have the ability to validate input parameters, filter target pods and do processing outside of pods. * [ENHANCEMENT] [#384](https://github.com/k8ssandra/cass-operator/issues/384) Add a new CassandraTask operation "replacenode" that removes the existing PVCs from the pod, deletes the pod and starts a replacement process. * [ENHANCEMENT] [#387](https://github.com/k8ssandra/cass-operator/issues/387) Add a new CassandraTask operation "upgradesstables" that allows to do SSTable upgrades after Cassandra version upgrade. diff --git a/Makefile b/Makefile index 29b814f6..41701cb0 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,10 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." +.PHONY: generate-configs +generate-configs: + cd hack/config && ./generate.sh + .PHONY: fmt fmt: ## Run go fmt against code. go fmt ./... diff --git a/apis/cassandra/v1beta1/cassandra_config_generated.go b/apis/cassandra/v1beta1/cassandra_config_generated.go new file mode 100644 index 00000000..d84a3b45 --- /dev/null +++ b/apis/cassandra/v1beta1/cassandra_config_generated.go @@ -0,0 +1,725 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Code is generated with hack/config. DO NOT EDIT. +package v1beta1 + +import ( + "strconv" + "strings" +) + +type CassandraConfigValues struct { + accepted map[string]interface{} +} + +func (c *CassandraConfigValues) HasProperty(propertyName string) bool { + _, found := c.accepted[propertyName] + return found +} + +func GetCassandraConfigValues(serverVersion string) (*CassandraConfigValues, error) { + versionParts := strings.Split(serverVersion, ".") + serverMajorVersion, err := strconv.ParseInt(versionParts[0], 10, 8) + if err != nil { + return nil, err + } + + if serverMajorVersion == 3 { + // Return configuration for 3.11, regardless of the real version (we don't support <3.11) + return &config311, nil + } + + if serverMajorVersion == 4 { + serverMinorVersion, err := strconv.ParseInt(versionParts[1], 10, 8) + if err != nil { + return nil, err + } + if serverMinorVersion == 0 { + // Return config40 + return &config40, nil + } + } + // Something brand new.. + return &configtrunk, nil +} + +var ( + config311 = CassandraConfigValues{ + accepted: map[string]interface{}{ + "cluster_name": true, + "authenticator": true, + "authorizer": true, + "role_manager": true, + "permissions_validity_in_ms": true, + "permissions_cache_max_entries": true, + "permissions_update_interval_in_ms": true, + "roles_validity_in_ms": true, + "roles_cache_max_entries": true, + "roles_update_interval_in_ms": true, + "credentials_validity_in_ms": true, + "credentials_cache_max_entries": true, + "credentials_update_interval_in_ms": true, + "partitioner": true, + "auto_bootstrap": true, + "hinted_handoff_enabled": true, + "hinted_handoff_disabled_datacenters": true, + "max_hint_window_in_ms": true, + "hints_directory": true, + "seed_provider": true, + "disk_access_mode": true, + "disk_failure_policy": true, + "commit_failure_policy": true, + "initial_token": true, + "num_tokens": true, + "allocate_tokens_for_keyspace": true, + "request_timeout_in_ms": true, + "read_request_timeout_in_ms": true, + "range_request_timeout_in_ms": true, + "write_request_timeout_in_ms": true, + "counter_write_request_timeout_in_ms": true, + "cas_contention_timeout_in_ms": true, + "truncate_request_timeout_in_ms": true, + "streaming_socket_timeout_in_ms": true, + "streaming_keep_alive_period_in_secs": true, + "cross_node_timeout": true, + "slow_query_log_timeout_in_ms": true, + "phi_convict_threshold": true, + "concurrent_reads": true, + "concurrent_writes": true, + "concurrent_counter_writes": true, + "concurrent_materialized_view_writes": true, + "concurrent_replicates": true, + "memtable_flush_writers": true, + "memtable_heap_space_in_mb": true, + "memtable_offheap_space_in_mb": true, + "memtable_cleanup_threshold": true, + "repair_session_max_tree_depth": true, + "storage_port": true, + "ssl_storage_port": true, + "listen_address": true, + "listen_interface": true, + "listen_interface_prefer_ipv6": true, + "broadcast_address": true, + "listen_on_broadcast_address": true, + "internode_authenticator": true, + "start_rpc": true, + "rpc_address": true, + "rpc_interface": true, + "rpc_interface_prefer_ipv6": true, + "broadcast_rpc_address": true, + "rpc_port": true, + "rpc_listen_backlog": true, + "rpc_server_type": true, + "rpc_keepalive": true, + "rpc_min_threads": true, + "rpc_max_threads": true, + "rpc_send_buff_size_in_bytes": true, + "rpc_recv_buff_size_in_bytes": true, + "internode_send_buff_size_in_bytes": true, + "internode_recv_buff_size_in_bytes": true, + "start_native_transport": true, + "native_transport_port": true, + "native_transport_port_ssl": true, + "native_transport_max_threads": true, + "native_transport_max_frame_size_in_mb": true, + "native_transport_max_concurrent_connections": true, + "native_transport_max_concurrent_connections_per_ip": true, + "native_transport_flush_in_batches_legacy": true, + "native_transport_max_concurrent_requests_in_bytes_per_ip": true, + "native_transport_max_concurrent_requests_in_bytes": true, + "native_transport_max_negotiable_protocol_version": true, + "thrift_max_message_length_in_mb": true, + "max_value_size_in_mb": true, + "thrift_framed_transport_size_in_mb": true, + "snapshot_before_compaction": true, + "auto_snapshot": true, + "column_index_size_in_kb": true, + "column_index_cache_size_in_kb": true, + "batch_size_warn_threshold_in_kb": true, + "batch_size_fail_threshold_in_kb": true, + "unlogged_batch_across_partitions_warn_threshold": true, + "concurrent_compactors": true, + "compaction_throughput_mb_per_sec": true, + "compaction_large_partition_warning_threshold_mb": true, + "min_free_space_per_drive_in_mb": true, + "max_streaming_retries": true, + "stream_throughput_outbound_megabits_per_sec": true, + "inter_dc_stream_throughput_outbound_megabits_per_sec": true, + "data_file_directories": true, + "saved_caches_directory": true, + "commitlog_directory": true, + "commitlog_total_space_in_mb": true, + "commitlog_sync": true, + "commitlog_sync_batch_window_in_ms": true, + "commitlog_sync_period_in_ms": true, + "commitlog_segment_size_in_mb": true, + "commitlog_compression": true, + "commitlog_max_compression_buffers_in_pool": true, + "transparent_data_encryption_options": true, + "max_mutation_size_in_kb": true, + "cdc_enabled": true, + "cdc_raw_directory": true, + "cdc_total_space_in_mb": true, + "cdc_free_space_check_interval_ms": true, + "commitlog_periodic_queue_size": true, + "endpoint_snitch": true, + "dynamic_snitch": true, + "dynamic_snitch_update_interval_in_ms": true, + "dynamic_snitch_reset_interval_in_ms": true, + "dynamic_snitch_badness_threshold": true, + "request_scheduler": true, + "request_scheduler_id": true, + "request_scheduler_options": true, + "server_encryption_options": true, + "client_encryption_options": true, + "encryption_options": true, + "internode_compression": true, + "index_interval": true, + "hinted_handoff_throttle_in_kb": true, + "batchlog_replay_throttle_in_kb": true, + "max_hints_delivery_threads": true, + "hints_flush_period_in_ms": true, + "max_hints_file_size_in_mb": true, + "hints_compression": true, + "sstable_preemptive_open_interval_in_mb": true, + "incremental_backups": true, + "trickle_fsync": true, + "trickle_fsync_interval_in_kb": true, + "key_cache_size_in_mb": true, + "key_cache_save_period": true, + "key_cache_keys_to_save": true, + "row_cache_class_name": true, + "row_cache_size_in_mb": true, + "row_cache_save_period": true, + "row_cache_keys_to_save": true, + "counter_cache_size_in_mb": true, + "counter_cache_save_period": true, + "counter_cache_keys_to_save": true, + "file_cache_size_in_mb": true, + "file_cache_round_up": true, + "buffer_pool_use_heap_if_exhausted": true, + "disk_optimization_strategy": true, + "disk_optimization_estimate_percentile": true, + "disk_optimization_page_cross_chance": true, + "inter_dc_tcp_nodelay": true, + "memtable_allocation_type": true, + "tombstone_warn_threshold": true, + "tombstone_failure_threshold": true, + "replica_filtering_protection": true, + "index_summary_capacity_in_mb": true, + "index_summary_resize_interval_in_minutes": true, + "gc_log_threshold_in_ms": true, + "gc_warn_threshold_in_ms": true, + "tracetype_query_ttl": true, + "tracetype_repair_ttl": true, + "otc_coalescing_strategy": true, + "otc_coalescing_window_us": true, + "otc_coalescing_enough_coalesced_messages": true, + "otc_backlog_expiration_interval_ms": true, + "windows_timer_interval": true, + "prepared_statements_cache_size_mb": true, + "thrift_prepared_statements_cache_size_mb": true, + "enable_user_defined_functions": true, + "enable_scripted_user_defined_functions": true, + "enable_materialized_views": true, + "enable_sasi_indexes": true, + "enable_drop_compact_storage": true, + "enable_user_defined_functions_threads": true, + "user_defined_function_warn_timeout": true, + "user_defined_function_fail_timeout": true, + "user_function_timeout_policy": true, + "back_pressure_enabled": true, + "back_pressure_strategy": true, + "snapshot_on_duplicate_row_detection": true, + "check_for_duplicate_rows_during_reads": true, + "check_for_duplicate_rows_during_compaction": true, + }, + } + + config40 = CassandraConfigValues{ + accepted: map[string]interface{}{ + "cluster_name": true, + "authenticator": true, + "authorizer": true, + "role_manager": true, + "network_authorizer": true, + "permissions_validity_in_ms": true, + "permissions_cache_max_entries": true, + "permissions_update_interval_in_ms": true, + "roles_validity_in_ms": true, + "roles_cache_max_entries": true, + "roles_update_interval_in_ms": true, + "credentials_validity_in_ms": true, + "credentials_cache_max_entries": true, + "credentials_update_interval_in_ms": true, + "partitioner": true, + "auto_bootstrap": true, + "hinted_handoff_enabled": true, + "hinted_handoff_disabled_datacenters": true, + "max_hint_window_in_ms": true, + "hints_directory": true, + "seed_provider": true, + "disk_access_mode": true, + "disk_failure_policy": true, + "commit_failure_policy": true, + "initial_token": true, + "num_tokens": true, + "allocate_tokens_for_keyspace": true, + "allocate_tokens_for_local_replication_factor": true, + "native_transport_idle_timeout_in_ms": true, + "request_timeout_in_ms": true, + "read_request_timeout_in_ms": true, + "range_request_timeout_in_ms": true, + "write_request_timeout_in_ms": true, + "counter_write_request_timeout_in_ms": true, + "cas_contention_timeout_in_ms": true, + "truncate_request_timeout_in_ms": true, + "streaming_connections_per_host": true, + "streaming_keep_alive_period_in_secs": true, + "cross_node_timeout": true, + "slow_query_log_timeout_in_ms": true, + "phi_convict_threshold": true, + "concurrent_reads": true, + "concurrent_writes": true, + "concurrent_counter_writes": true, + "concurrent_materialized_view_writes": true, + "concurrent_replicates": true, + "memtable_flush_writers": true, + "memtable_heap_space_in_mb": true, + "memtable_offheap_space_in_mb": true, + "memtable_cleanup_threshold": true, + "repair_session_max_tree_depth": true, + "repair_session_space_in_mb": true, + "use_offheap_merkle_trees": true, + "storage_port": true, + "ssl_storage_port": true, + "listen_address": true, + "listen_interface": true, + "listen_interface_prefer_ipv6": true, + "broadcast_address": true, + "listen_on_broadcast_address": true, + "internode_authenticator": true, + "rpc_address": true, + "rpc_interface": true, + "rpc_interface_prefer_ipv6": true, + "broadcast_rpc_address": true, + "rpc_keepalive": true, + "internode_max_message_size_in_bytes": true, + "internode_socket_send_buffer_size_in_bytes": true, + "internode_socket_receive_buffer_size_in_bytes": true, + "internode_application_send_queue_capacity_in_bytes": true, + "internode_application_send_queue_reserve_endpoint_capacity_in_bytes": true, + "internode_application_send_queue_reserve_global_capacity_in_bytes": true, + "internode_application_receive_queue_capacity_in_bytes": true, + "internode_application_receive_queue_reserve_endpoint_capacity_in_bytes": true, + "internode_application_receive_queue_reserve_global_capacity_in_bytes": true, + "internode_tcp_connect_timeout_in_ms": true, + "internode_tcp_user_timeout_in_ms": true, + "internode_streaming_tcp_user_timeout_in_ms": true, + "start_native_transport": true, + "native_transport_port": true, + "native_transport_port_ssl": true, + "native_transport_max_threads": true, + "native_transport_max_frame_size_in_mb": true, + "native_transport_max_concurrent_connections": true, + "native_transport_max_concurrent_connections_per_ip": true, + "native_transport_flush_in_batches_legacy": true, + "native_transport_allow_older_protocols": true, + "native_transport_max_concurrent_requests_in_bytes_per_ip": true, + "native_transport_max_concurrent_requests_in_bytes": true, + "native_transport_receive_queue_capacity_in_bytes": true, + "native_transport_max_negotiable_protocol_version": true, + "max_value_size_in_mb": true, + "snapshot_before_compaction": true, + "auto_snapshot": true, + "snapshot_links_per_second": true, + "column_index_size_in_kb": true, + "column_index_cache_size_in_kb": true, + "batch_size_warn_threshold_in_kb": true, + "batch_size_fail_threshold_in_kb": true, + "unlogged_batch_across_partitions_warn_threshold": true, + "concurrent_compactors": true, + "compaction_throughput_mb_per_sec": true, + "compaction_large_partition_warning_threshold_mb": true, + "min_free_space_per_drive_in_mb": true, + "concurrent_materialized_view_builders": true, + "reject_repair_compaction_threshold": true, + "max_streaming_retries": true, + "stream_throughput_outbound_megabits_per_sec": true, + "inter_dc_stream_throughput_outbound_megabits_per_sec": true, + "data_file_directories": true, + "local_system_data_file_directory": true, + "saved_caches_directory": true, + "commitlog_directory": true, + "commitlog_total_space_in_mb": true, + "commitlog_sync": true, + "commitlog_sync_batch_window_in_ms": true, + "commitlog_sync_group_window_in_ms": true, + "commitlog_sync_period_in_ms": true, + "commitlog_segment_size_in_mb": true, + "commitlog_compression": true, + "flush_compression": true, + "commitlog_max_compression_buffers_in_pool": true, + "periodic_commitlog_sync_lag_block_in_ms": true, + "transparent_data_encryption_options": true, + "max_mutation_size_in_kb": true, + "cdc_enabled": true, + "cdc_raw_directory": true, + "cdc_total_space_in_mb": true, + "cdc_free_space_check_interval_ms": true, + "commitlog_periodic_queue_size": true, + "endpoint_snitch": true, + "dynamic_snitch": true, + "dynamic_snitch_update_interval_in_ms": true, + "dynamic_snitch_reset_interval_in_ms": true, + "dynamic_snitch_badness_threshold": true, + "server_encryption_options": true, + "client_encryption_options": true, + "internode_compression": true, + "hinted_handoff_throttle_in_kb": true, + "batchlog_replay_throttle_in_kb": true, + "max_hints_delivery_threads": true, + "hints_flush_period_in_ms": true, + "max_hints_file_size_in_mb": true, + "hints_compression": true, + "incremental_backups": true, + "trickle_fsync": true, + "trickle_fsync_interval_in_kb": true, + "sstable_preemptive_open_interval_in_mb": true, + "key_cache_migrate_during_compaction": true, + "key_cache_size_in_mb": true, + "key_cache_save_period": true, + "key_cache_keys_to_save": true, + "row_cache_class_name": true, + "row_cache_size_in_mb": true, + "row_cache_save_period": true, + "row_cache_keys_to_save": true, + "counter_cache_size_in_mb": true, + "counter_cache_save_period": true, + "counter_cache_keys_to_save": true, + "networking_cache_size_in_mb": true, + "file_cache_size_in_mb": true, + "file_cache_enabled": true, + "file_cache_round_up": true, + "buffer_pool_use_heap_if_exhausted": true, + "disk_optimization_strategy": true, + "disk_optimization_estimate_percentile": true, + "disk_optimization_page_cross_chance": true, + "inter_dc_tcp_nodelay": true, + "memtable_allocation_type": true, + "tombstone_warn_threshold": true, + "tombstone_failure_threshold": true, + "replica_filtering_protection": true, + "index_summary_capacity_in_mb": true, + "index_summary_resize_interval_in_minutes": true, + "gc_log_threshold_in_ms": true, + "gc_warn_threshold_in_ms": true, + "tracetype_query_ttl": true, + "tracetype_repair_ttl": true, + "ideal_consistency_level": true, + "otc_coalescing_strategy": true, + "otc_coalescing_window_us": true, + "otc_coalescing_enough_coalesced_messages": true, + "windows_timer_interval": true, + "prepared_statements_cache_size_mb": true, + "enable_user_defined_functions": true, + "enable_scripted_user_defined_functions": true, + "enable_materialized_views": true, + "enable_transient_replication": true, + "enable_sasi_indexes": true, + "enable_drop_compact_storage": true, + "enable_user_defined_functions_threads": true, + "user_defined_function_warn_timeout": true, + "user_defined_function_fail_timeout": true, + "user_function_timeout_policy": true, + "back_pressure_enabled": true, + "back_pressure_strategy": true, + "concurrent_validations": true, + "repair_command_pool_full_strategy": true, + "repair_command_pool_size": true, + "block_for_peers_timeout_in_secs": true, + "block_for_peers_in_remote_dcs": true, + "automatic_sstable_upgrade": true, + "max_concurrent_automatic_sstable_upgrades": true, + "stream_entire_sstables": true, + "audit_logging_options": true, + "full_query_logging_options": true, + "corrupted_tombstone_strategy": true, + "diagnostic_events_enabled": true, + "repaired_data_tracking_for_range_reads_enabled": true, + "repaired_data_tracking_for_partition_reads_enabled": true, + "report_unconfirmed_repaired_data_mismatches": true, + "snapshot_on_repaired_data_mismatch": true, + "validation_preview_purge_head_start_in_sec": true, + "initial_range_tombstone_list_allocation_size": true, + "range_tombstone_list_growth_factor": true, + "snapshot_on_duplicate_row_detection": true, + "check_for_duplicate_rows_during_reads": true, + "check_for_duplicate_rows_during_compaction": true, + "autocompaction_on_startup_enabled": true, + "auto_optimise_inc_repair_streams": true, + "auto_optimise_full_repair_streams": true, + "auto_optimise_preview_repair_streams": true, + "table_count_warn_threshold": true, + "keyspace_count_warn_threshold": true, + "consecutive_message_errors_threshold": true, + }, + } + + configtrunk = CassandraConfigValues{ + accepted: map[string]interface{}{ + "cluster_name": true, + "authenticator": true, + "authorizer": true, + "role_manager": true, + "network_authorizer": true, + "permissions_validity_in_ms": true, + "permissions_cache_max_entries": true, + "permissions_update_interval_in_ms": true, + "roles_validity_in_ms": true, + "roles_cache_max_entries": true, + "roles_update_interval_in_ms": true, + "credentials_validity_in_ms": true, + "credentials_cache_max_entries": true, + "credentials_update_interval_in_ms": true, + "partitioner": true, + "auto_bootstrap": true, + "hinted_handoff_enabled": true, + "hinted_handoff_disabled_datacenters": true, + "max_hint_window_in_ms": true, + "hints_directory": true, + "hint_window_persistent_enabled": true, + "seed_provider": true, + "disk_access_mode": true, + "disk_failure_policy": true, + "commit_failure_policy": true, + "use_deterministic_table_id": true, + "initial_token": true, + "num_tokens": true, + "allocate_tokens_for_keyspace": true, + "allocate_tokens_for_local_replication_factor": true, + "native_transport_idle_timeout_in_ms": true, + "request_timeout_in_ms": true, + "read_request_timeout_in_ms": true, + "range_request_timeout_in_ms": true, + "write_request_timeout_in_ms": true, + "counter_write_request_timeout_in_ms": true, + "cas_contention_timeout_in_ms": true, + "truncate_request_timeout_in_ms": true, + "streaming_connections_per_host": true, + "streaming_keep_alive_period_in_secs": true, + "cross_node_timeout": true, + "slow_query_log_timeout_in_ms": true, + "phi_convict_threshold": true, + "concurrent_reads": true, + "concurrent_writes": true, + "concurrent_counter_writes": true, + "concurrent_materialized_view_writes": true, + "available_processors": true, + "concurrent_replicates": true, + "memtable_flush_writers": true, + "memtable_heap_space_in_mb": true, + "memtable_offheap_space_in_mb": true, + "memtable_cleanup_threshold": true, + "repair_session_max_tree_depth": true, + "repair_session_space_in_mb": true, + "use_offheap_merkle_trees": true, + "storage_port": true, + "ssl_storage_port": true, + "listen_address": true, + "listen_interface": true, + "listen_interface_prefer_ipv6": true, + "broadcast_address": true, + "listen_on_broadcast_address": true, + "internode_authenticator": true, + "traverse_auth_from_root": true, + "rpc_address": true, + "rpc_interface": true, + "rpc_interface_prefer_ipv6": true, + "broadcast_rpc_address": true, + "rpc_keepalive": true, + "internode_max_message_size_in_bytes": true, + "internode_socket_send_buffer_size_in_bytes": true, + "internode_socket_receive_buffer_size_in_bytes": true, + "internode_application_send_queue_capacity_in_bytes": true, + "internode_application_send_queue_reserve_endpoint_capacity_in_bytes": true, + "internode_application_send_queue_reserve_global_capacity_in_bytes": true, + "internode_application_receive_queue_capacity_in_bytes": true, + "internode_application_receive_queue_reserve_endpoint_capacity_in_bytes": true, + "internode_application_receive_queue_reserve_global_capacity_in_bytes": true, + "internode_tcp_connect_timeout_in_ms": true, + "internode_tcp_user_timeout_in_ms": true, + "internode_streaming_tcp_user_timeout_in_ms": true, + "start_native_transport": true, + "native_transport_port": true, + "native_transport_port_ssl": true, + "native_transport_max_threads": true, + "native_transport_max_frame_size_in_mb": true, + "native_transport_max_concurrent_connections": true, + "native_transport_max_concurrent_connections_per_ip": true, + "native_transport_flush_in_batches_legacy": true, + "native_transport_allow_older_protocols": true, + "native_transport_max_concurrent_requests_in_bytes_per_ip": true, + "native_transport_max_concurrent_requests_in_bytes": true, + "native_transport_rate_limiting_enabled": true, + "native_transport_max_requests_per_second": true, + "native_transport_receive_queue_capacity_in_bytes": true, + "native_transport_max_negotiable_protocol_version": true, + "max_value_size_in_mb": true, + "snapshot_before_compaction": true, + "auto_snapshot": true, + "snapshot_links_per_second": true, + "column_index_size_in_kb": true, + "column_index_cache_size_in_kb": true, + "batch_size_warn_threshold_in_kb": true, + "batch_size_fail_threshold_in_kb": true, + "unlogged_batch_across_partitions_warn_threshold": true, + "concurrent_compactors": true, + "compaction_throughput_mb_per_sec": true, + "compaction_large_partition_warning_threshold_mb": true, + "min_free_space_per_drive_in_mb": true, + "compaction_tombstone_warning_threshold": true, + "concurrent_materialized_view_builders": true, + "reject_repair_compaction_threshold": true, + "max_streaming_retries": true, + "stream_throughput_outbound_megabits_per_sec": true, + "inter_dc_stream_throughput_outbound_megabits_per_sec": true, + "data_file_directories": true, + "local_system_data_file_directory": true, + "saved_caches_directory": true, + "commitlog_directory": true, + "commitlog_total_space_in_mb": true, + "commitlog_sync": true, + "commitlog_sync_batch_window_in_ms": true, + "commitlog_sync_group_window_in_ms": true, + "commitlog_sync_period_in_ms": true, + "commitlog_segment_size_in_mb": true, + "commitlog_compression": true, + "flush_compression": true, + "commitlog_max_compression_buffers_in_pool": true, + "periodic_commitlog_sync_lag_block_in_ms": true, + "transparent_data_encryption_options": true, + "max_mutation_size_in_kb": true, + "cdc_enabled": true, + "cdc_raw_directory": true, + "cdc_total_space_in_mb": true, + "cdc_free_space_check_interval_ms": true, + "commitlog_periodic_queue_size": true, + "endpoint_snitch": true, + "dynamic_snitch": true, + "dynamic_snitch_update_interval_in_ms": true, + "dynamic_snitch_reset_interval_in_ms": true, + "dynamic_snitch_badness_threshold": true, + "failure_detector": true, + "server_encryption_options": true, + "client_encryption_options": true, + "internode_compression": true, + "hinted_handoff_throttle_in_kb": true, + "batchlog_replay_throttle_in_kb": true, + "max_hints_delivery_threads": true, + "hints_flush_period_in_ms": true, + "max_hints_file_size_in_mb": true, + "hints_compression": true, + "auto_hints_cleanup_enabled": true, + "incremental_backups": true, + "trickle_fsync": true, + "trickle_fsync_interval_in_kb": true, + "sstable_preemptive_open_interval_in_mb": true, + "key_cache_migrate_during_compaction": true, + "key_cache_size_in_mb": true, + "key_cache_save_period": true, + "key_cache_keys_to_save": true, + "row_cache_class_name": true, + "row_cache_size_in_mb": true, + "row_cache_save_period": true, + "row_cache_keys_to_save": true, + "counter_cache_size_in_mb": true, + "counter_cache_save_period": true, + "counter_cache_keys_to_save": true, + "paxos_cache_size_in_mb": true, + "networking_cache_size_in_mb": true, + "file_cache_size_in_mb": true, + "file_cache_enabled": true, + "file_cache_round_up": true, + "buffer_pool_use_heap_if_exhausted": true, + "disk_optimization_strategy": true, + "disk_optimization_estimate_percentile": true, + "disk_optimization_page_cross_chance": true, + "inter_dc_tcp_nodelay": true, + "memtable_allocation_type": true, + "track_warnings": true, + "tombstone_warn_threshold": true, + "tombstone_failure_threshold": true, + "replica_filtering_protection": true, + "index_summary_capacity_in_mb": true, + "index_summary_resize_interval_in_minutes": true, + "gc_log_threshold_in_ms": true, + "gc_warn_threshold_in_ms": true, + "tracetype_query_ttl": true, + "tracetype_repair_ttl": true, + "ideal_consistency_level": true, + "otc_coalescing_strategy": true, + "otc_coalescing_window_us": true, + "otc_coalescing_enough_coalesced_messages": true, + "windows_timer_interval": true, + "prepared_statements_cache_size_mb": true, + "enable_user_defined_functions": true, + "enable_scripted_user_defined_functions": true, + "enable_materialized_views": true, + "enable_transient_replication": true, + "enable_sasi_indexes": true, + "enable_drop_compact_storage": true, + "enable_user_defined_functions_threads": true, + "user_defined_function_warn_timeout": true, + "user_defined_function_fail_timeout": true, + "user_function_timeout_policy": true, + "back_pressure_enabled": true, + "back_pressure_strategy": true, + "concurrent_validations": true, + "repair_command_pool_full_strategy": true, + "repair_command_pool_size": true, + "block_for_peers_timeout_in_secs": true, + "block_for_peers_in_remote_dcs": true, + "automatic_sstable_upgrade": true, + "max_concurrent_automatic_sstable_upgrades": true, + "stream_entire_sstables": true, + "audit_logging_options": true, + "full_query_logging_options": true, + "corrupted_tombstone_strategy": true, + "diagnostic_events_enabled": true, + "default_keyspace_rf": true, + "minimum_keyspace_rf": true, + "repaired_data_tracking_for_range_reads_enabled": true, + "repaired_data_tracking_for_partition_reads_enabled": true, + "report_unconfirmed_repaired_data_mismatches": true, + "snapshot_on_repaired_data_mismatch": true, + "validation_preview_purge_head_start_in_sec": true, + "auth_read_consistency_level": true, + "auth_write_consistency_level": true, + "enable_partition_denylist": true, + "enable_denylist_writes": true, + "enable_denylist_reads": true, + "enable_denylist_range_reads": true, + "denylist_refresh_seconds": true, + "denylist_initial_load_retry_seconds": true, + "denylist_max_keys_per_table": true, + "denylist_max_keys_total": true, + "denylist_consistency_level": true, + "initial_range_tombstone_list_allocation_size": true, + "range_tombstone_list_growth_factor": true, + "snapshot_on_duplicate_row_detection": true, + "check_for_duplicate_rows_during_reads": true, + "check_for_duplicate_rows_during_compaction": true, + "autocompaction_on_startup_enabled": true, + "auto_optimise_inc_repair_streams": true, + "auto_optimise_full_repair_streams": true, + "auto_optimise_preview_repair_streams": true, + "table_count_warn_threshold": true, + "keyspace_count_warn_threshold": true, + "consecutive_message_errors_threshold": true, + "client_error_reporting_exclusions": true, + "internode_error_reporting_exclusions": true, + }, + } +) diff --git a/apis/cassandra/v1beta1/cassandradatacenter_webhook.go b/apis/cassandra/v1beta1/cassandradatacenter_webhook.go index 755c684b..2f6e11b4 100644 --- a/apis/cassandra/v1beta1/cassandradatacenter_webhook.go +++ b/apis/cassandra/v1beta1/cassandradatacenter_webhook.go @@ -123,7 +123,17 @@ func ValidateSingleDatacenter(dc CassandraDatacenter) error { return err } - return ValidateFQLConfig(dc) + if err := ValidateFQLConfig(dc); err != nil { + return err + } + if !isDse { + err := ValidateConfig(&dc) + if err != nil { + return err + } + } + + return nil } // ValidateDatacenterFieldChanges checks that no values are improperly changing while updating @@ -238,6 +248,38 @@ var ( ErrFQLNotSupported = fmt.Errorf("full query logging is only supported on OSS Cassandra 4.0+") ) +func ValidateConfig(dc *CassandraDatacenter) error { + // TODO Cleanup to more common processing after ModelValues is moved to apis + if dc.Spec.Config != nil { + var dcConfig map[string]interface{} + if err := json.Unmarshal(dc.Spec.Config, &dcConfig); err != nil { + return err + } + casYaml, found := dcConfig["cassandra-yaml"] + if !found { + return nil + } + + casYamlMap, ok := casYaml.(map[string]interface{}) + if !ok { + err := fmt.Errorf("failed to parse cassandra-yaml") + return err + } + + configValues, err := GetCassandraConfigValues(dc.Spec.ServerVersion) + if err != nil { + return err + } + for k := range casYamlMap { + if !configValues.HasProperty(k) { + // We should probably add an event to tell the user that they're using old values + return fmt.Errorf("property %s is not valid for serverVersion %s", k, dc.Spec.ServerVersion) + } + } + } + return nil +} + func ValidateFQLConfig(dc CassandraDatacenter) error { if dc.Spec.Config != nil { enabled, err := dc.FullQueryEnabled() diff --git a/apis/cassandra/v1beta1/webhook_test.go b/apis/cassandra/v1beta1/webhook_test.go index 98981a4a..4b1bae7c 100644 --- a/apis/cassandra/v1beta1/webhook_test.go +++ b/apis/cassandra/v1beta1/webhook_test.go @@ -186,6 +186,48 @@ func Test_ValidateSingleDatacenter(t *testing.T) { }, errString: "attempted to define config jvm-server-options with cassandra-3.11.7", }, + { + name: "Cassandra 3.11 invalid cassandra-yaml full_query_options", + dc: &CassandraDatacenter{ + ObjectMeta: metav1.ObjectMeta{ + Name: "exampleDC", + }, + Spec: CassandraDatacenterSpec{ + ServerType: "cassandra", + ServerVersion: "3.11.11", + Config: json.RawMessage(` + { + "cassandra-yaml": { + "full_query_logging_options": { + "log_dir": "/var/log/cassandra/fql" + } + } + } + `), + }, + }, + errString: "property full_query_logging_options is not valid for serverVersion 3.11.11", + }, + { + name: "Cassandra 4.0.1 invalid cassandra-yaml thrift_max_message_length_in_mb", + dc: &CassandraDatacenter{ + ObjectMeta: metav1.ObjectMeta{ + Name: "exampleDC", + }, + Spec: CassandraDatacenterSpec{ + ServerType: "cassandra", + ServerVersion: "4.0.1", + Config: json.RawMessage(` + { + "cassandra-yaml": { + "thrift_max_message_length_in_mb": "256" + } + } + `), + }, + }, + errString: "property thrift_max_message_length_in_mb is not valid for serverVersion 4.0.1", + }, { name: "DSE 6.8 invalid config file jvm-options", dc: &CassandraDatacenter{ diff --git a/hack/config/Pipfile b/hack/config/Pipfile new file mode 100644 index 00000000..e77b372d --- /dev/null +++ b/hack/config/Pipfile @@ -0,0 +1,12 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +javalang = "*" + +[dev-packages] + +[requires] +python_version = "3.9" diff --git a/hack/config/generate.sh b/hack/config/generate.sh new file mode 100755 index 00000000..78845373 --- /dev/null +++ b/hack/config/generate.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +OUTPUTFILE=../../apis/cassandra/v1beta1/cassandra_config_generated.go +curl -sL https://raw.githubusercontent.com/apache/cassandra/cassandra-4.0/src/java/org/apache/cassandra/config/Config.java --output Config-40.java +curl -sL https://raw.githubusercontent.com/apache/cassandra/cassandra-3.11/src/java/org/apache/cassandra/config/Config.java --output Config-311.java +curl -sL https://raw.githubusercontent.com/apache/cassandra/trunk/src/java/org/apache/cassandra/config/Config.java --output Config-trunk.java +pipenv run python parse.py > $OUTPUTFILE +go fmt $OUTPUTFILE +rm -f *.java \ No newline at end of file diff --git a/hack/config/parse.py b/hack/config/parse.py new file mode 100644 index 00000000..5b8acb3d --- /dev/null +++ b/hack/config/parse.py @@ -0,0 +1,85 @@ +# This script generates golang structs for Cassandra configurations +import javalang +from pathlib import Path +from typing import List + +def parse_file(file: str): + config_file = Path(file).read_text() + tree = javalang.parse.parse(config_file) + for path, node in tree.filter(javalang.tree.ClassDeclaration): + if node.name == "Config": + for field in node.fields: + if 'public' in field.modifiers and not 'static' in field.modifiers: + for declarator in field.declarators: + print(f'"{declarator.name}": true,') + # for annotation in field.annotations: + # if annotation.name == "Deprecated": + # print('Deprecated!') + +def generate_configs(versions: List[str]): + print(""" +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Code is generated with hack/config. DO NOT EDIT. +package v1beta1 + +import ( + "strconv" + "strings" +) + +type CassandraConfigValues struct { + accepted map[string]interface{} +} + +func (c *CassandraConfigValues) HasProperty(propertyName string) bool { + _, found := c.accepted[propertyName] + return found +} + +func GetCassandraConfigValues(serverVersion string) (*CassandraConfigValues, error) { + versionParts := strings.Split(serverVersion, ".") + serverMajorVersion, err := strconv.ParseInt(versionParts[0], 10, 8) + if err != nil { + return nil, err + } + + if serverMajorVersion == 3 { + // Return configuration for 3.11, regardless of the real version (we don't support <3.11) + return &config311, nil + } + + if serverMajorVersion == 4 { + serverMinorVersion, err := strconv.ParseInt(versionParts[1], 10, 8) + if err != nil { + return nil, err + } + if serverMinorVersion == 0 { + // Return config40 + return &config40, nil + } + } + // Something brand new.. + return &configtrunk, nil +} + + var( + """) + + for ver in versions: + create_config_values(ver) + + print(')') + +def create_config_values(version: str): + print(f""" + config{version} = CassandraConfigValues{{ + accepted: map[string]interface{{}}{{""") + parse_file(f'Config-{version}.java') + print(""" + }, + } + """) + +generate_configs(['311', '40', 'trunk']) diff --git a/pkg/reconciliation/handler.go b/pkg/reconciliation/handler.go index 411abd7a..5a9c5bf1 100644 --- a/pkg/reconciliation/handler.go +++ b/pkg/reconciliation/handler.go @@ -210,6 +210,9 @@ func (rc *ReconciliationContext) IsValid(dc *api.CassandraDatacenter) error { // Validate Service labels and annotations errs = append(errs, api.ValidateServiceLabelsAndAnnotations(*dc)) + // Validate spec.Config + errs = append(errs, api.ValidateConfig(dc)) + // Validate Management API config errs = append(errs, httphelper.ValidateManagementApiConfig(dc, rc.Client, rc.Ctx)...) if len(errs) > 0 { From 3e61a3075fc61e961e58abb3d562f2964dba1f78 Mon Sep 17 00:00:00 2001 From: Michael Burman Date: Mon, 5 Sep 2022 13:34:49 +0300 Subject: [PATCH 2/2] Add 4.0.0, 4.0.6 and DSE (when manually supplied) config generation --- .../v1beta1/cassandra_config_generated.go | 850 +++++++++++++++++- apis/cassandra/v1beta1/groupversion_info.go | 4 +- apis/config/v1beta1/groupversion_info.go | 4 +- apis/control/v1alpha1/groupversion_info.go | 4 +- hack/config/Pipfile | 2 +- hack/config/generate.sh | 2 + hack/config/parse.py | 2 +- .../clientset/versioned/fake/register.go | 14 +- .../clientset/versioned/scheme/register.go | 14 +- pkg/httphelper/security.go | 1 - pkg/oplabels/labels_test.go | 3 +- pkg/psp/emm.go | 8 - pkg/psp/labels_annotations.go | 27 +- pkg/utils/k8s_utils.go | 8 - tests/util/ginkgo/lib.go | 4 +- tests/util/kubectl/kubectl.go | 12 +- 16 files changed, 870 insertions(+), 89 deletions(-) diff --git a/apis/cassandra/v1beta1/cassandra_config_generated.go b/apis/cassandra/v1beta1/cassandra_config_generated.go index d84a3b45..028cd424 100644 --- a/apis/cassandra/v1beta1/cassandra_config_generated.go +++ b/apis/cassandra/v1beta1/cassandra_config_generated.go @@ -196,6 +196,7 @@ var ( "counter_cache_size_in_mb": true, "counter_cache_save_period": true, "counter_cache_keys_to_save": true, + "cache_load_timeout_seconds": true, "file_cache_size_in_mb": true, "file_cache_round_up": true, "buffer_pool_use_heap_if_exhausted": true, @@ -226,6 +227,8 @@ var ( "enable_sasi_indexes": true, "enable_drop_compact_storage": true, "enable_user_defined_functions_threads": true, + "allow_insecure_udfs": true, + "allow_extra_insecure_udfs": true, "user_defined_function_warn_timeout": true, "user_defined_function_fail_timeout": true, "user_function_timeout_policy": true, @@ -234,6 +237,7 @@ var ( "snapshot_on_duplicate_row_detection": true, "check_for_duplicate_rows_during_reads": true, "check_for_duplicate_rows_during_compaction": true, + "force_new_prepared_statement_behaviour": true, }, } @@ -259,6 +263,7 @@ var ( "hinted_handoff_disabled_datacenters": true, "max_hint_window_in_ms": true, "hints_directory": true, + "force_new_prepared_statement_behaviour": true, "seed_provider": true, "disk_access_mode": true, "disk_failure_policy": true, @@ -291,6 +296,7 @@ var ( "memtable_cleanup_threshold": true, "repair_session_max_tree_depth": true, "repair_session_space_in_mb": true, + "repair_request_timeout_in_ms": true, "use_offheap_merkle_trees": true, "storage_port": true, "ssl_storage_port": true, @@ -398,6 +404,7 @@ var ( "counter_cache_size_in_mb": true, "counter_cache_save_period": true, "counter_cache_keys_to_save": true, + "cache_load_timeout_seconds": true, "networking_cache_size_in_mb": true, "file_cache_size_in_mb": true, "file_cache_enabled": true, @@ -421,6 +428,7 @@ var ( "otc_coalescing_strategy": true, "otc_coalescing_window_us": true, "otc_coalescing_enough_coalesced_messages": true, + "otc_backlog_expiration_interval_ms": true, "windows_timer_interval": true, "prepared_statements_cache_size_mb": true, "enable_user_defined_functions": true, @@ -430,6 +438,8 @@ var ( "enable_sasi_indexes": true, "enable_drop_compact_storage": true, "enable_user_defined_functions_threads": true, + "allow_insecure_udfs": true, + "allow_extra_insecure_udfs": true, "user_defined_function_warn_timeout": true, "user_defined_function_fail_timeout": true, "user_function_timeout_policy": true, @@ -467,7 +477,7 @@ var ( }, } - configtrunk = CassandraConfigValues{ + config400 = CassandraConfigValues{ accepted: map[string]interface{}{ "cluster_name": true, "authenticator": true, @@ -489,12 +499,10 @@ var ( "hinted_handoff_disabled_datacenters": true, "max_hint_window_in_ms": true, "hints_directory": true, - "hint_window_persistent_enabled": true, "seed_provider": true, "disk_access_mode": true, "disk_failure_policy": true, "commit_failure_policy": true, - "use_deterministic_table_id": true, "initial_token": true, "num_tokens": true, "allocate_tokens_for_keyspace": true, @@ -516,7 +524,6 @@ var ( "concurrent_writes": true, "concurrent_counter_writes": true, "concurrent_materialized_view_writes": true, - "available_processors": true, "concurrent_replicates": true, "memtable_flush_writers": true, "memtable_heap_space_in_mb": true, @@ -533,7 +540,6 @@ var ( "broadcast_address": true, "listen_on_broadcast_address": true, "internode_authenticator": true, - "traverse_auth_from_root": true, "rpc_address": true, "rpc_interface": true, "rpc_interface_prefer_ipv6": true, @@ -562,8 +568,6 @@ var ( "native_transport_allow_older_protocols": true, "native_transport_max_concurrent_requests_in_bytes_per_ip": true, "native_transport_max_concurrent_requests_in_bytes": true, - "native_transport_rate_limiting_enabled": true, - "native_transport_max_requests_per_second": true, "native_transport_receive_queue_capacity_in_bytes": true, "native_transport_max_negotiable_protocol_version": true, "max_value_size_in_mb": true, @@ -579,7 +583,6 @@ var ( "compaction_throughput_mb_per_sec": true, "compaction_large_partition_warning_threshold_mb": true, "min_free_space_per_drive_in_mb": true, - "compaction_tombstone_warning_threshold": true, "concurrent_materialized_view_builders": true, "reject_repair_compaction_threshold": true, "max_streaming_retries": true, @@ -611,7 +614,6 @@ var ( "dynamic_snitch_update_interval_in_ms": true, "dynamic_snitch_reset_interval_in_ms": true, "dynamic_snitch_badness_threshold": true, - "failure_detector": true, "server_encryption_options": true, "client_encryption_options": true, "internode_compression": true, @@ -621,7 +623,6 @@ var ( "hints_flush_period_in_ms": true, "max_hints_file_size_in_mb": true, "hints_compression": true, - "auto_hints_cleanup_enabled": true, "incremental_backups": true, "trickle_fsync": true, "trickle_fsync_interval_in_kb": true, @@ -637,7 +638,6 @@ var ( "counter_cache_size_in_mb": true, "counter_cache_save_period": true, "counter_cache_keys_to_save": true, - "paxos_cache_size_in_mb": true, "networking_cache_size_in_mb": true, "file_cache_size_in_mb": true, "file_cache_enabled": true, @@ -648,7 +648,6 @@ var ( "disk_optimization_page_cross_chance": true, "inter_dc_tcp_nodelay": true, "memtable_allocation_type": true, - "track_warnings": true, "tombstone_warn_threshold": true, "tombstone_failure_threshold": true, "replica_filtering_protection": true, @@ -688,24 +687,11 @@ var ( "full_query_logging_options": true, "corrupted_tombstone_strategy": true, "diagnostic_events_enabled": true, - "default_keyspace_rf": true, - "minimum_keyspace_rf": true, "repaired_data_tracking_for_range_reads_enabled": true, "repaired_data_tracking_for_partition_reads_enabled": true, "report_unconfirmed_repaired_data_mismatches": true, "snapshot_on_repaired_data_mismatch": true, "validation_preview_purge_head_start_in_sec": true, - "auth_read_consistency_level": true, - "auth_write_consistency_level": true, - "enable_partition_denylist": true, - "enable_denylist_writes": true, - "enable_denylist_reads": true, - "enable_denylist_range_reads": true, - "denylist_refresh_seconds": true, - "denylist_initial_load_retry_seconds": true, - "denylist_max_keys_per_table": true, - "denylist_max_keys_total": true, - "denylist_consistency_level": true, "initial_range_tombstone_list_allocation_size": true, "range_tombstone_list_growth_factor": true, "snapshot_on_duplicate_row_detection": true, @@ -718,8 +704,818 @@ var ( "table_count_warn_threshold": true, "keyspace_count_warn_threshold": true, "consecutive_message_errors_threshold": true, - "client_error_reporting_exclusions": true, - "internode_error_reporting_exclusions": true, + }, + } + + config406 = CassandraConfigValues{ + accepted: map[string]interface{}{ + "cluster_name": true, + "authenticator": true, + "authorizer": true, + "role_manager": true, + "network_authorizer": true, + "permissions_validity_in_ms": true, + "permissions_cache_max_entries": true, + "permissions_update_interval_in_ms": true, + "roles_validity_in_ms": true, + "roles_cache_max_entries": true, + "roles_update_interval_in_ms": true, + "credentials_validity_in_ms": true, + "credentials_cache_max_entries": true, + "credentials_update_interval_in_ms": true, + "partitioner": true, + "auto_bootstrap": true, + "hinted_handoff_enabled": true, + "hinted_handoff_disabled_datacenters": true, + "max_hint_window_in_ms": true, + "hints_directory": true, + "force_new_prepared_statement_behaviour": true, + "seed_provider": true, + "disk_access_mode": true, + "disk_failure_policy": true, + "commit_failure_policy": true, + "initial_token": true, + "num_tokens": true, + "allocate_tokens_for_keyspace": true, + "allocate_tokens_for_local_replication_factor": true, + "native_transport_idle_timeout_in_ms": true, + "request_timeout_in_ms": true, + "read_request_timeout_in_ms": true, + "range_request_timeout_in_ms": true, + "write_request_timeout_in_ms": true, + "counter_write_request_timeout_in_ms": true, + "cas_contention_timeout_in_ms": true, + "truncate_request_timeout_in_ms": true, + "streaming_connections_per_host": true, + "streaming_keep_alive_period_in_secs": true, + "cross_node_timeout": true, + "slow_query_log_timeout_in_ms": true, + "phi_convict_threshold": true, + "concurrent_reads": true, + "concurrent_writes": true, + "concurrent_counter_writes": true, + "concurrent_materialized_view_writes": true, + "concurrent_replicates": true, + "memtable_flush_writers": true, + "memtable_heap_space_in_mb": true, + "memtable_offheap_space_in_mb": true, + "memtable_cleanup_threshold": true, + "repair_session_max_tree_depth": true, + "repair_session_space_in_mb": true, + "use_offheap_merkle_trees": true, + "storage_port": true, + "ssl_storage_port": true, + "listen_address": true, + "listen_interface": true, + "listen_interface_prefer_ipv6": true, + "broadcast_address": true, + "listen_on_broadcast_address": true, + "internode_authenticator": true, + "rpc_address": true, + "rpc_interface": true, + "rpc_interface_prefer_ipv6": true, + "broadcast_rpc_address": true, + "rpc_keepalive": true, + "internode_max_message_size_in_bytes": true, + "internode_socket_send_buffer_size_in_bytes": true, + "internode_socket_receive_buffer_size_in_bytes": true, + "internode_application_send_queue_capacity_in_bytes": true, + "internode_application_send_queue_reserve_endpoint_capacity_in_bytes": true, + "internode_application_send_queue_reserve_global_capacity_in_bytes": true, + "internode_application_receive_queue_capacity_in_bytes": true, + "internode_application_receive_queue_reserve_endpoint_capacity_in_bytes": true, + "internode_application_receive_queue_reserve_global_capacity_in_bytes": true, + "internode_tcp_connect_timeout_in_ms": true, + "internode_tcp_user_timeout_in_ms": true, + "internode_streaming_tcp_user_timeout_in_ms": true, + "start_native_transport": true, + "native_transport_port": true, + "native_transport_port_ssl": true, + "native_transport_max_threads": true, + "native_transport_max_frame_size_in_mb": true, + "native_transport_max_concurrent_connections": true, + "native_transport_max_concurrent_connections_per_ip": true, + "native_transport_flush_in_batches_legacy": true, + "native_transport_allow_older_protocols": true, + "native_transport_max_concurrent_requests_in_bytes_per_ip": true, + "native_transport_max_concurrent_requests_in_bytes": true, + "native_transport_receive_queue_capacity_in_bytes": true, + "native_transport_max_negotiable_protocol_version": true, + "max_value_size_in_mb": true, + "snapshot_before_compaction": true, + "auto_snapshot": true, + "snapshot_links_per_second": true, + "column_index_size_in_kb": true, + "column_index_cache_size_in_kb": true, + "batch_size_warn_threshold_in_kb": true, + "batch_size_fail_threshold_in_kb": true, + "unlogged_batch_across_partitions_warn_threshold": true, + "concurrent_compactors": true, + "compaction_throughput_mb_per_sec": true, + "compaction_large_partition_warning_threshold_mb": true, + "min_free_space_per_drive_in_mb": true, + "concurrent_materialized_view_builders": true, + "reject_repair_compaction_threshold": true, + "max_streaming_retries": true, + "stream_throughput_outbound_megabits_per_sec": true, + "inter_dc_stream_throughput_outbound_megabits_per_sec": true, + "data_file_directories": true, + "local_system_data_file_directory": true, + "saved_caches_directory": true, + "commitlog_directory": true, + "commitlog_total_space_in_mb": true, + "commitlog_sync": true, + "commitlog_sync_batch_window_in_ms": true, + "commitlog_sync_group_window_in_ms": true, + "commitlog_sync_period_in_ms": true, + "commitlog_segment_size_in_mb": true, + "commitlog_compression": true, + "flush_compression": true, + "commitlog_max_compression_buffers_in_pool": true, + "periodic_commitlog_sync_lag_block_in_ms": true, + "transparent_data_encryption_options": true, + "max_mutation_size_in_kb": true, + "cdc_enabled": true, + "cdc_raw_directory": true, + "cdc_total_space_in_mb": true, + "cdc_free_space_check_interval_ms": true, + "commitlog_periodic_queue_size": true, + "endpoint_snitch": true, + "dynamic_snitch": true, + "dynamic_snitch_update_interval_in_ms": true, + "dynamic_snitch_reset_interval_in_ms": true, + "dynamic_snitch_badness_threshold": true, + "server_encryption_options": true, + "client_encryption_options": true, + "internode_compression": true, + "hinted_handoff_throttle_in_kb": true, + "batchlog_replay_throttle_in_kb": true, + "max_hints_delivery_threads": true, + "hints_flush_period_in_ms": true, + "max_hints_file_size_in_mb": true, + "hints_compression": true, + "incremental_backups": true, + "trickle_fsync": true, + "trickle_fsync_interval_in_kb": true, + "sstable_preemptive_open_interval_in_mb": true, + "key_cache_migrate_during_compaction": true, + "key_cache_size_in_mb": true, + "key_cache_save_period": true, + "key_cache_keys_to_save": true, + "row_cache_class_name": true, + "row_cache_size_in_mb": true, + "row_cache_save_period": true, + "row_cache_keys_to_save": true, + "counter_cache_size_in_mb": true, + "counter_cache_save_period": true, + "counter_cache_keys_to_save": true, + "cache_load_timeout_seconds": true, + "networking_cache_size_in_mb": true, + "file_cache_size_in_mb": true, + "file_cache_enabled": true, + "file_cache_round_up": true, + "buffer_pool_use_heap_if_exhausted": true, + "disk_optimization_strategy": true, + "disk_optimization_estimate_percentile": true, + "disk_optimization_page_cross_chance": true, + "inter_dc_tcp_nodelay": true, + "memtable_allocation_type": true, + "tombstone_warn_threshold": true, + "tombstone_failure_threshold": true, + "replica_filtering_protection": true, + "index_summary_capacity_in_mb": true, + "index_summary_resize_interval_in_minutes": true, + "gc_log_threshold_in_ms": true, + "gc_warn_threshold_in_ms": true, + "tracetype_query_ttl": true, + "tracetype_repair_ttl": true, + "ideal_consistency_level": true, + "otc_coalescing_strategy": true, + "otc_coalescing_window_us": true, + "otc_coalescing_enough_coalesced_messages": true, + "otc_backlog_expiration_interval_ms": true, + "windows_timer_interval": true, + "prepared_statements_cache_size_mb": true, + "enable_user_defined_functions": true, + "enable_scripted_user_defined_functions": true, + "enable_materialized_views": true, + "enable_transient_replication": true, + "enable_sasi_indexes": true, + "enable_drop_compact_storage": true, + "enable_user_defined_functions_threads": true, + "allow_insecure_udfs": true, + "allow_extra_insecure_udfs": true, + "user_defined_function_warn_timeout": true, + "user_defined_function_fail_timeout": true, + "user_function_timeout_policy": true, + "back_pressure_enabled": true, + "back_pressure_strategy": true, + "concurrent_validations": true, + "repair_command_pool_full_strategy": true, + "repair_command_pool_size": true, + "block_for_peers_timeout_in_secs": true, + "block_for_peers_in_remote_dcs": true, + "automatic_sstable_upgrade": true, + "max_concurrent_automatic_sstable_upgrades": true, + "stream_entire_sstables": true, + "audit_logging_options": true, + "full_query_logging_options": true, + "corrupted_tombstone_strategy": true, + "diagnostic_events_enabled": true, + "repaired_data_tracking_for_range_reads_enabled": true, + "repaired_data_tracking_for_partition_reads_enabled": true, + "report_unconfirmed_repaired_data_mismatches": true, + "snapshot_on_repaired_data_mismatch": true, + "validation_preview_purge_head_start_in_sec": true, + "initial_range_tombstone_list_allocation_size": true, + "range_tombstone_list_growth_factor": true, + "snapshot_on_duplicate_row_detection": true, + "check_for_duplicate_rows_during_reads": true, + "check_for_duplicate_rows_during_compaction": true, + "autocompaction_on_startup_enabled": true, + "auto_optimise_inc_repair_streams": true, + "auto_optimise_full_repair_streams": true, + "auto_optimise_preview_repair_streams": true, + "table_count_warn_threshold": true, + "keyspace_count_warn_threshold": true, + "consecutive_message_errors_threshold": true, + }, + } + + configtrunk = CassandraConfigValues{ + accepted: map[string]interface{}{ + "cluster_name": true, + "authenticator": true, + "authorizer": true, + "role_manager": true, + "network_authorizer": true, + "permissions_validity": true, + "permissions_cache_max_entries": true, + "permissions_update_interval": true, + "permissions_cache_active_update": true, + "roles_validity": true, + "roles_cache_max_entries": true, + "roles_update_interval": true, + "roles_cache_active_update": true, + "credentials_validity": true, + "credentials_cache_max_entries": true, + "credentials_update_interval": true, + "credentials_cache_active_update": true, + "partitioner": true, + "auto_bootstrap": true, + "hinted_handoff_enabled": true, + "hinted_handoff_disabled_datacenters": true, + "max_hint_window": true, + "hints_directory": true, + "hint_window_persistent_enabled": true, + "force_new_prepared_statement_behaviour": true, + "seed_provider": true, + "disk_access_mode": true, + "disk_failure_policy": true, + "commit_failure_policy": true, + "use_deterministic_table_id": true, + "initial_token": true, + "num_tokens": true, + "allocate_tokens_for_keyspace": true, + "allocate_tokens_for_local_replication_factor": true, + "native_transport_idle_timeout": true, + "request_timeout": true, + "read_request_timeout": true, + "range_request_timeout": true, + "write_request_timeout": true, + "counter_write_request_timeout": true, + "cas_contention_timeout": true, + "truncate_request_timeout": true, + "repair_request_timeout": true, + "streaming_connections_per_host": true, + "streaming_keep_alive_period": true, + "internode_timeout": true, + "slow_query_log_timeout": true, + "phi_convict_threshold": true, + "concurrent_reads": true, + "concurrent_writes": true, + "concurrent_counter_writes": true, + "concurrent_materialized_view_writes": true, + "available_processors": true, + "concurrent_replicates": true, + "memtable_flush_writers": true, + "memtable_heap_space": true, + "memtable_offheap_space": true, + "memtable_cleanup_threshold": true, + "memtable": true, + "repair_session_max_tree_depth": true, + "repair_session_space": true, + "use_offheap_merkle_trees": true, + "storage_port": true, + "ssl_storage_port": true, + "listen_address": true, + "listen_interface": true, + "listen_interface_prefer_ipv6": true, + "broadcast_address": true, + "listen_on_broadcast_address": true, + "internode_authenticator": true, + "traverse_auth_from_root": true, + "rpc_address": true, + "rpc_interface": true, + "rpc_interface_prefer_ipv6": true, + "broadcast_rpc_address": true, + "rpc_keepalive": true, + "internode_max_message_size": true, + "internode_socket_send_buffer_size": true, + "internode_socket_receive_buffer_size": true, + "internode_application_send_queue_capacity": true, + "internode_application_send_queue_reserve_endpoint_capacity": true, + "internode_application_send_queue_reserve_global_capacity": true, + "internode_application_receive_queue_capacity": true, + "internode_application_receive_queue_reserve_endpoint_capacity": true, + "internode_application_receive_queue_reserve_global_capacity": true, + "internode_tcp_connect_timeout": true, + "internode_tcp_user_timeout": true, + "internode_streaming_tcp_user_timeout": true, + "start_native_transport": true, + "native_transport_port": true, + "native_transport_port_ssl": true, + "native_transport_max_threads": true, + "native_transport_max_frame_size": true, + "native_transport_max_auth_threads": true, + "native_transport_max_concurrent_connections": true, + "native_transport_max_concurrent_connections_per_ip": true, + "native_transport_flush_in_batches_legacy": true, + "native_transport_allow_older_protocols": true, + "native_transport_max_request_data_in_flight_per_ip": true, + "native_transport_max_request_data_in_flight": true, + "native_transport_rate_limiting_enabled": true, + "native_transport_max_requests_per_second": true, + "native_transport_receive_queue_capacity": true, + "native_transport_max_negotiable_protocol_version": true, + "max_value_size": true, + "snapshot_before_compaction": true, + "auto_snapshot": true, + "auto_snapshot_ttl": true, + "snapshot_links_per_second": true, + "column_index_size": true, + "column_index_cache_size": true, + "batch_size_warn_threshold": true, + "batch_size_fail_threshold": true, + "unlogged_batch_across_partitions_warn_threshold": true, + "concurrent_compactors": true, + "compaction_throughput": true, + "compaction_large_partition_warning_threshold": true, + "min_free_space_per_drive": true, + "compaction_tombstone_warning_threshold": true, + "concurrent_materialized_view_builders": true, + "reject_repair_compaction_threshold": true, + "concurrent_index_builders": true, + "max_streaming_retries": true, + "stream_throughput_outbound": true, + "inter_dc_stream_throughput_outbound": true, + "entire_sstable_stream_throughput_outbound": true, + "entire_sstable_inter_dc_stream_throughput_outbound": true, + "data_file_directories": true, + "local_system_data_file_directory": true, + "saved_caches_directory": true, + "commitlog_directory": true, + "commitlog_total_space": true, + "commitlog_sync": true, + "commitlog_sync_batch_window_in_ms": true, + "commitlog_sync_group_window": true, + "commitlog_sync_period": true, + "commitlog_segment_size": true, + "commitlog_compression": true, + "flush_compression": true, + "commitlog_max_compression_buffers_in_pool": true, + "periodic_commitlog_sync_lag_block": true, + "transparent_data_encryption_options": true, + "max_mutation_size": true, + "cdc_enabled": true, + "cdc_block_writes": true, + "cdc_on_repair_enabled": true, + "cdc_raw_directory": true, + "cdc_total_space": true, + "cdc_free_space_check_interval": true, + "commitlog_periodic_queue_size": true, + "endpoint_snitch": true, + "dynamic_snitch": true, + "dynamic_snitch_update_interval": true, + "dynamic_snitch_reset_interval": true, + "dynamic_snitch_badness_threshold": true, + "failure_detector": true, + "server_encryption_options": true, + "client_encryption_options": true, + "internode_compression": true, + "hinted_handoff_throttle": true, + "batchlog_replay_throttle": true, + "max_hints_delivery_threads": true, + "hints_flush_period": true, + "max_hints_file_size": true, + "max_hints_size_per_host": true, + "hints_compression": true, + "auto_hints_cleanup_enabled": true, + "incremental_backups": true, + "trickle_fsync": true, + "trickle_fsync_interval": true, + "sstable_preemptive_open_interval": true, + "key_cache_migrate_during_compaction": true, + "key_cache_keys_to_save": true, + "key_cache_size": true, + "key_cache_save_period": true, + "row_cache_class_name": true, + "row_cache_size": true, + "row_cache_save_period": true, + "row_cache_keys_to_save": true, + "counter_cache_size": true, + "counter_cache_save_period": true, + "counter_cache_keys_to_save": true, + "paxos_cache_size": true, + "cache_load_timeout": true, + "networking_cache_size": true, + "file_cache_size": true, + "file_cache_enabled": true, + "file_cache_round_up": true, + "buffer_pool_use_heap_if_exhausted": true, + "disk_optimization_strategy": true, + "disk_optimization_estimate_percentile": true, + "disk_optimization_page_cross_chance": true, + "inter_dc_tcp_nodelay": true, + "memtable_allocation_type": true, + "read_thresholds_enabled": true, + "coordinator_read_size_warn_threshold": true, + "coordinator_read_size_fail_threshold": true, + "local_read_size_warn_threshold": true, + "local_read_size_fail_threshold": true, + "row_index_read_size_warn_threshold": true, + "row_index_read_size_fail_threshold": true, + "tombstone_warn_threshold": true, + "tombstone_failure_threshold": true, + "replica_filtering_protection": true, + "index_summary_capacity": true, + "index_summary_resize_interval": true, + "gc_log_threshold": true, + "gc_warn_threshold": true, + "trace_type_query_ttl": true, + "trace_type_repair_ttl": true, + "ideal_consistency_level": true, + "windows_timer_interval": true, + "otc_coalescing_strategy": true, + "otc_coalescing_window_us": true, + "otc_coalescing_enough_coalesced_messages": true, + "otc_backlog_expiration_interval_ms": true, + "prepared_statements_cache_size": true, + "user_defined_functions_enabled": true, + "scripted_user_defined_functions_enabled": true, + "materialized_views_enabled": true, + "transient_replication_enabled": true, + "sasi_indexes_enabled": true, + "drop_compact_storage_enabled": true, + "use_statements_enabled": true, + "user_defined_functions_threads_enabled": true, + "allow_insecure_udfs": true, + "allow_extra_insecure_udfs": true, + "user_defined_functions_warn_timeout": true, + "user_defined_functions_fail_timeout": true, + "user_function_timeout_policy": true, + "back_pressure_enabled": true, + "back_pressure_strategy": true, + "concurrent_validations": true, + "repair_command_pool_full_strategy": true, + "repair_command_pool_size": true, + "block_for_peers_timeout_in_secs": true, + "block_for_peers_in_remote_dcs": true, + "automatic_sstable_upgrade": true, + "max_concurrent_automatic_sstable_upgrades": true, + "stream_entire_sstables": true, + "audit_logging_options": true, + "full_query_logging_options": true, + "corrupted_tombstone_strategy": true, + "diagnostic_events_enabled": true, + "default_keyspace_rf": true, + "repaired_data_tracking_for_range_reads_enabled": true, + "repaired_data_tracking_for_partition_reads_enabled": true, + "report_unconfirmed_repaired_data_mismatches": true, + "snapshot_on_repaired_data_mismatch": true, + "validation_preview_purge_head_start": true, + "auth_cache_warming_enabled": true, + "auth_read_consistency_level": true, + "auth_write_consistency_level": true, + "partition_denylist_enabled": true, + "denylist_writes_enabled": true, + "denylist_reads_enabled": true, + "denylist_range_reads_enabled": true, + "denylist_refresh": true, + "denylist_initial_load_retry": true, + "denylist_max_keys_per_table": true, + "denylist_max_keys_total": true, + "denylist_consistency_level": true, + "initial_range_tombstone_list_allocation_size": true, + "range_tombstone_list_growth_factor": true, + "snapshot_on_duplicate_row_detection": true, + "check_for_duplicate_rows_during_reads": true, + "check_for_duplicate_rows_during_compaction": true, + "autocompaction_on_startup_enabled": true, + "auto_optimise_inc_repair_streams": true, + "auto_optimise_full_repair_streams": true, + "auto_optimise_preview_repair_streams": true, + "uuid_sstable_identifiers_enabled": true, + "table_count_warn_threshold": true, + "keyspace_count_warn_threshold": true, + "consecutive_message_errors_threshold": true, + "client_error_reporting_exclusions": true, + "internode_error_reporting_exclusions": true, + "keyspaces_warn_threshold": true, + "keyspaces_fail_threshold": true, + "tables_warn_threshold": true, + "tables_fail_threshold": true, + "columns_per_table_warn_threshold": true, + "columns_per_table_fail_threshold": true, + "secondary_indexes_per_table_warn_threshold": true, + "secondary_indexes_per_table_fail_threshold": true, + "materialized_views_per_table_warn_threshold": true, + "materialized_views_per_table_fail_threshold": true, + "page_size_warn_threshold": true, + "page_size_fail_threshold": true, + "partition_keys_in_select_warn_threshold": true, + "partition_keys_in_select_fail_threshold": true, + "in_select_cartesian_product_warn_threshold": true, + "in_select_cartesian_product_fail_threshold": true, + "table_properties_warned": true, + "table_properties_ignored": true, + "table_properties_disallowed": true, + "read_consistency_levels_warned": true, + "read_consistency_levels_disallowed": true, + "write_consistency_levels_warned": true, + "write_consistency_levels_disallowed": true, + "user_timestamps_enabled": true, + "alter_table_enabled": true, + "group_by_enabled": true, + "drop_truncate_table_enabled": true, + "drop_keyspace_enabled": true, + "secondary_indexes_enabled": true, + "uncompressed_tables_enabled": true, + "compact_tables_enabled": true, + "read_before_write_list_operations_enabled": true, + "allow_filtering_enabled": true, + "simplestrategy_enabled": true, + "column_value_size_warn_threshold": true, + "column_value_size_fail_threshold": true, + "collection_size_warn_threshold": true, + "collection_size_fail_threshold": true, + "items_per_collection_warn_threshold": true, + "items_per_collection_fail_threshold": true, + "fields_per_udt_warn_threshold": true, + "fields_per_udt_fail_threshold": true, + "data_disk_usage_percentage_warn_threshold": true, + "data_disk_usage_percentage_fail_threshold": true, + "data_disk_usage_max_disk_size": true, + "minimum_replication_factor_warn_threshold": true, + "minimum_replication_factor_fail_threshold": true, + "maximum_replication_factor_warn_threshold": true, + "maximum_replication_factor_fail_threshold": true, + "streaming_state_expires": true, + "streaming_state_size": true, + "startup_checks": true, + "repair_state_expires": true, + "repair_state_size": true, + "paxos_variant": true, + "skip_paxos_repair_on_topology_change": true, + "paxos_purge_grace_period": true, + "paxos_on_linearizability_violations": true, + "paxos_state_purging": true, + "paxos_repair_enabled": true, + "paxos_topology_repair_no_dc_checks": true, + "paxos_topology_repair_strict_each_quorum": true, + "skip_paxos_repair_on_topology_change_keyspaces": true, + "paxos_contention_wait_randomizer": true, + "paxos_contention_min_wait": true, + "paxos_contention_max_wait": true, + "paxos_contention_min_delta": true, + "paxos_repair_parallelism": true, + "max_top_size_partition_count": true, + "max_top_tombstone_partition_count": true, + "min_tracked_partition_size": true, + "min_tracked_partition_tombstone_count": true, + "top_partitions_enabled": true, + "dump_heap_on_uncaught_exception": true, + "heap_dump_path": true, + }, + } + + configDSE = CassandraConfigValues{ + accepted: map[string]interface{}{ + "cluster_name": true, + "authenticator": true, + "authorizer": true, + "role_manager": true, + "permissions_validity_in_ms": true, + "permissions_cache_max_entries": true, + "permissions_cache_initial_capacity": true, + "permissions_update_interval_in_ms": true, + "roles_validity_in_ms": true, + "roles_cache_max_entries": true, + "roles_cache_initial_capacity": true, + "roles_update_interval_in_ms": true, + "system_keyspaces_filtering": true, + "system_key_directory": true, + "system_info_encryption": true, + "tpc_cores": true, + "tpc_io_cores": true, + "io_global_queue_depth": true, + "partitioner": true, + "auto_bootstrap": true, + "hinted_handoff_enabled": true, + "hinted_handoff_disabled_datacenters": true, + "max_hint_window_in_ms": true, + "hints_directory": true, + "seed_provider": true, + "disk_access_mode": true, + "disk_failure_policy": true, + "commit_failure_policy": true, + "initial_token": true, + "num_tokens": true, + "allocate_tokens_for_keyspace": true, + "allocate_tokens_for_local_replication_factor": true, + "request_timeout_in_ms": true, + "read_request_timeout_in_ms": true, + "range_request_timeout_in_ms": true, + "aggregated_request_timeout_in_ms": true, + "write_request_timeout_in_ms": true, + "cross_dc_rtt_in_ms": true, + "counter_write_request_timeout_in_ms": true, + "cas_contention_timeout_in_ms": true, + "truncate_request_timeout_in_ms": true, + "streaming_connections_per_host": true, + "streaming_keep_alive_period_in_secs": true, + "input_stream_channel_timeout_in_ms": true, + "cross_node_timeout": true, + "slow_query_log_timeout_in_ms": true, + "phi_convict_threshold": true, + "echo_attempts_before_reset": true, + "memtable_flush_writers": true, + "memtable_heap_space_in_mb": true, + "memtable_offheap_space_in_mb": true, + "memtable_space_in_mb": true, + "memtable_cleanup_threshold": true, + "storage_port": true, + "ssl_storage_port": true, + "listen_address": true, + "listen_interface": true, + "listen_interface_prefer_ipv6": true, + "broadcast_address": true, + "listen_on_broadcast_address": true, + "internode_authenticator": true, + "native_transport_address": true, + "native_transport_interface": true, + "native_transport_interface_prefer_ipv6": true, + "native_transport_broadcast_address": true, + "native_transport_keepalive": true, + "internode_send_buff_size_in_bytes": true, + "internode_recv_buff_size_in_bytes": true, + "start_native_transport": true, + "native_transport_port": true, + "native_transport_port_ssl": true, + "native_transport_max_threads": true, + "native_transport_max_frame_size_in_mb": true, + "native_transport_max_concurrent_connections": true, + "native_transport_max_concurrent_connections_per_ip": true, + "native_transport_allow_older_protocols": true, + "max_value_size_in_mb": true, + "snapshot_before_compaction": true, + "snapshot_before_dropping_column": true, + "auto_snapshot": true, + "column_index_size_in_kb": true, + "column_index_cache_size_in_kb": true, + "batch_size_warn_threshold_in_kb": true, + "batch_size_fail_threshold_in_kb": true, + "unlogged_batch_across_partitions_warn_threshold": true, + "concurrent_compactors": true, + "compaction_throughput_mb_per_sec": true, + "compaction_large_partition_warning_threshold_mb": true, + "min_free_space_per_drive_in_mb": true, + "concurrent_validations": true, + "concurrent_materialized_view_builders": true, + "concurrent_lw_transactions": true, + "max_pending_lw_transactions": true, + "tpc_concurrent_requests_limit": true, + "tpc_pending_requests_limit": true, + "stream_outbound_buffer_in_kb": true, + "stream_max_outbound_buffers_in_kb": true, + "stream_outbound_permits_in_mb": true, + "stream_throughput_outbound_megabits_per_sec": true, + "inter_dc_stream_throughput_outbound_megabits_per_sec": true, + "data_file_directories": true, + "saved_caches_directory": true, + "commitlog_directory": true, + "commitlog_total_space_in_mb": true, + "commitlog_sync": true, + "metadata_directory": true, + "commitlog_sync_batch_window_in_ms": true, + "commitlog_sync_group_window_in_ms": true, + "commitlog_sync_period_in_ms": true, + "commitlog_segment_size_in_mb": true, + "commitlog_compression": true, + "commitlog_max_compression_buffers_in_pool": true, + "transparent_data_encryption_options": true, + "max_mutation_size_in_kb": true, + "cdc_enabled": true, + "cdc_raw_directory": true, + "cdc_total_space_in_mb": true, + "cdc_free_space_check_interval_ms": true, + "commitlog_periodic_queue_size": true, + "endpoint_snitch": true, + "dynamic_snitch": true, + "dynamic_snitch_update_interval_in_ms": true, + "dynamic_snitch_reset_interval_in_ms": true, + "dynamic_snitch_badness_threshold": true, + "server_encryption_options": true, + "client_encryption_options": true, + "encryption_options": true, + "internode_compression": true, + "hinted_handoff_throttle_in_kb": true, + "batchlog_replay_throttle_in_kb": true, + "batchlog_endpoint_strategy": true, + "max_hints_delivery_threads": true, + "hints_flush_period_in_ms": true, + "max_hints_file_size_in_mb": true, + "hints_compression": true, + "sstable_preemptive_open_interval_in_mb": true, + "incremental_backups": true, + "trickle_fsync": true, + "trickle_fsync_interval_in_kb": true, + "key_cache_size_in_mb": true, + "key_cache_save_period": true, + "key_cache_keys_to_save": true, + "row_cache_class_name": true, + "row_cache_size_in_mb": true, + "row_cache_save_period": true, + "row_cache_keys_to_save": true, + "counter_cache_size_in_mb": true, + "counter_cache_save_period": true, + "counter_cache_keys_to_save": true, + "file_cache_size_in_mb": true, + "inflight_data_overhead_in_mb": true, + "direct_reads_size_in_mb": true, + "file_cache_round_up": true, + "buffer_pool_use_heap_if_exhausted": true, + "disk_optimization_strategy": true, + "disk_optimization_estimate_percentile": true, + "disk_optimization_page_cross_chance": true, + "inter_dc_tcp_nodelay": true, + "memtable_allocation_type": true, + "tombstone_warn_threshold": true, + "tombstone_failure_threshold": true, + "gc_log_threshold_in_ms": true, + "gc_warn_threshold_in_ms": true, + "seed_gossip_probability": true, + "tracetype_query_ttl": true, + "tracetype_repair_ttl": true, + "ideal_consistency_level": true, + "otc_coalescing_strategy": true, + "otc_coalescing_window_us": true, + "otc_coalescing_enough_coalesced_messages": true, + "otc_small_max_message_buffer_kb": true, + "otc_large_max_message_buffer_kb": true, + "otc_small_connection_pool_size": true, + "otc_backlog_expiration_interval_ms": true, + "windows_timer_interval": true, + "prepared_statements_cache_size_mb": true, + "enable_user_defined_functions": true, + "enable_scripted_user_defined_functions": true, + "enable_user_defined_functions_threads": true, + "allow_insecure_udfs": true, + "allow_extra_insecure_udfs": true, + "user_defined_function_warn_micros": true, + "user_defined_function_warn_timeout": true, + "user_defined_function_fail_micros": true, + "user_defined_function_fail_timeout": true, + "user_defined_function_warn_heap_mb": true, + "user_defined_function_fail_heap_mb": true, + "user_function_timeout_policy": true, + "back_pressure_enabled": true, + "back_pressure_strategy": true, + "pick_level_on_streaming": true, + "pick_level_on_streaming_min_sstable_size_bytes": true, + "continuous_paging": true, + "max_memory_to_lock_mb": true, + "max_memory_to_lock_fraction": true, + "metrics_histogram_update_interval_millis": true, + "audit_logging_options": true, + "snapshot_size_cache_validity_in_secs": true, + "nodesync": true, + "repair_command_pool_full_strategy": true, + "repair_command_pool_size": true, + "full_query_log_dir": true, + "zerocopy_streaming_enabled": true, + "zerocopy_max_sstables": true, + "zerocopy_max_unused_metadata_in_mb": true, + "leaks_detection_params": true, + "emulate_dbaas_defaults": true, + "guardrails": true, + "backup_service": true, + "sai_options": true, + "rpc_address": true, + "rpc_interface": true, + "rpc_interface_prefer_ipv6": true, + "broadcast_rpc_address": true, + "rpc_keepalive": true, }, } ) diff --git a/apis/cassandra/v1beta1/groupversion_info.go b/apis/cassandra/v1beta1/groupversion_info.go index 84425055..f7f9b8ab 100644 --- a/apis/cassandra/v1beta1/groupversion_info.go +++ b/apis/cassandra/v1beta1/groupversion_info.go @@ -15,8 +15,8 @@ limitations under the License. */ // Package v1beta1 contains API Schema definitions for the cassandra.datastax.com v1beta1 API group -//+kubebuilder:object:generate=true -//+groupName=cassandra.datastax.com +// +kubebuilder:object:generate=true +// +groupName=cassandra.datastax.com package v1beta1 import ( diff --git a/apis/config/v1beta1/groupversion_info.go b/apis/config/v1beta1/groupversion_info.go index 549d2ac4..2462181f 100644 --- a/apis/config/v1beta1/groupversion_info.go +++ b/apis/config/v1beta1/groupversion_info.go @@ -15,8 +15,8 @@ limitations under the License. */ // Package v1 contains API Schema definitions for the config v1 API group -//+kubebuilder:object:generate=true -//+groupName=config.k8ssandra.io +// +kubebuilder:object:generate=true +// +groupName=config.k8ssandra.io package v1beta1 import ( diff --git a/apis/control/v1alpha1/groupversion_info.go b/apis/control/v1alpha1/groupversion_info.go index 2fe1dd5a..e103723a 100644 --- a/apis/control/v1alpha1/groupversion_info.go +++ b/apis/control/v1alpha1/groupversion_info.go @@ -15,8 +15,8 @@ limitations under the License. */ // Package v1alpha1 contains API Schema definitions for the control.k8ssandra.io v1alpha1 API group -//+kubebuilder:object:generate=true -//+groupName=control.k8ssandra.io +// +kubebuilder:object:generate=true +// +groupName=control.k8ssandra.io package v1alpha1 import ( diff --git a/hack/config/Pipfile b/hack/config/Pipfile index e77b372d..7932a09a 100644 --- a/hack/config/Pipfile +++ b/hack/config/Pipfile @@ -9,4 +9,4 @@ javalang = "*" [dev-packages] [requires] -python_version = "3.9" +python_version = "3.10" diff --git a/hack/config/generate.sh b/hack/config/generate.sh index 78845373..799dc099 100755 --- a/hack/config/generate.sh +++ b/hack/config/generate.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash OUTPUTFILE=../../apis/cassandra/v1beta1/cassandra_config_generated.go +curl -sL https://raw.githubusercontent.com/apache/cassandra/cassandra-4.0.6/src/java/org/apache/cassandra/config/Config.java --output Config-406.java +curl -sL https://raw.githubusercontent.com/apache/cassandra/cassandra-4.0.0/src/java/org/apache/cassandra/config/Config.java --output Config-400.java curl -sL https://raw.githubusercontent.com/apache/cassandra/cassandra-4.0/src/java/org/apache/cassandra/config/Config.java --output Config-40.java curl -sL https://raw.githubusercontent.com/apache/cassandra/cassandra-3.11/src/java/org/apache/cassandra/config/Config.java --output Config-311.java curl -sL https://raw.githubusercontent.com/apache/cassandra/trunk/src/java/org/apache/cassandra/config/Config.java --output Config-trunk.java diff --git a/hack/config/parse.py b/hack/config/parse.py index 5b8acb3d..387840d5 100644 --- a/hack/config/parse.py +++ b/hack/config/parse.py @@ -82,4 +82,4 @@ def create_config_values(version: str): } """) -generate_configs(['311', '40', 'trunk']) +generate_configs(['311', '40', '400', '406', 'trunk', 'DSE']) diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index 55ecbe40..2aec6672 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index 7a6bf6b2..bf92d778 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/httphelper/security.go b/pkg/httphelper/security.go index 80165cae..9b1c78d9 100644 --- a/pkg/httphelper/security.go +++ b/pkg/httphelper/security.go @@ -759,7 +759,6 @@ func (provider *ManualManagementApiSecurityProvider) BuildHttpClient(client clie // Below implementation modified from: // // https://go-review.googlesource.com/c/go/+/193620/5/src/crypto/tls/example_test.go#210 -// func buildVerifyPeerCertificateNoHostCheck(rootCAs *x509.CertPool) func([][]byte, [][]*x509.Certificate) error { f := func(certificates [][]byte, _ [][]*x509.Certificate) error { certs := make([]*x509.Certificate, len(certificates)) diff --git a/pkg/oplabels/labels_test.go b/pkg/oplabels/labels_test.go index 3af2601e..1b570add 100644 --- a/pkg/oplabels/labels_test.go +++ b/pkg/oplabels/labels_test.go @@ -8,7 +8,8 @@ import ( "testing" ) -/** +/* +* A valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric. */ diff --git a/pkg/psp/emm.go b/pkg/psp/emm.go index c094a62a..f1125941 100644 --- a/pkg/psp/emm.go +++ b/pkg/psp/emm.go @@ -113,9 +113,7 @@ type EMMService interface { getLogger() logr.Logger } -// // Util -// func getPodsRackNameSet(pods []*corev1.Pod) utils.StringSet { names := utils.StringSet{} for _, pod := range pods { @@ -128,9 +126,7 @@ func filterPodsByRackName(pods []*corev1.Pod, rackName string) []*corev1.Pod { return utils.FilterPodsWithLabel(pods, api.RackLabel, rackName) } -// // EMMOperations impl -// type EMMServiceImpl struct { EMMSPI } @@ -386,9 +382,7 @@ func (impl *EMMServiceImpl) getLogger() logr.Logger { return impl.GetLogger() } -// // EMMChecks impl -// func (impl *EMMServiceImpl) getPodNameSetWithVolumeHealthInaccessiblePVC(rackName string) (utils.StringSet, error) { pods := impl.GetDCPods() result := []*corev1.Pod{} @@ -434,9 +428,7 @@ func (impl *EMMServiceImpl) getInProgressNodeReplacements() []string { return impl.GetInProgressNodeReplacements() } -// // Helper methods -// func (impl *EMMServiceImpl) getNodesWithTaintKeyValueEffect(taintKey, value string, effect corev1.TaintEffect) ([]*corev1.Node, error) { nodes, err := impl.GetAllNodesInDC() if err != nil { diff --git a/pkg/psp/labels_annotations.go b/pkg/psp/labels_annotations.go index d99b50ef..0db11389 100644 --- a/pkg/psp/labels_annotations.go +++ b/pkg/psp/labels_annotations.go @@ -19,20 +19,19 @@ const ( // The return value here _should_ be the same as `vSphereExtensionKey` in the // VCUIPlugin resource: // -// apiVersion: appplatform.wcp.vmware.com/v1beta1 -// kind: VCUIPlugin -// metadata: -// labels: -// controller-tools.k8s.io: "1.0" -// name: datastax-vulcan -// namespace: {{ .service.namespace }} -// spec: -// name: datastax-vulcan -// uiBackendSecret: datastax-vulcan-tls -// uiBackendService: datastax-vulcan -// vSphereUiPluginUrl: plugin.json -// vSphereExtensionKey: com.datastax.vulcan -// +// apiVersion: appplatform.wcp.vmware.com/v1beta1 +// kind: VCUIPlugin +// metadata: +// labels: +// controller-tools.k8s.io: "1.0" +// name: datastax-vulcan +// namespace: {{ .service.namespace }} +// spec: +// name: datastax-vulcan +// uiBackendSecret: datastax-vulcan-tls +// uiBackendService: datastax-vulcan +// vSphereUiPluginUrl: plugin.json +// vSphereExtensionKey: com.datastax.vulcan func GetExtensionID() string { value := os.Getenv(ExtensionIDEnv) if value == "" { diff --git a/pkg/utils/k8s_utils.go b/pkg/utils/k8s_utils.go index cd47d0d2..111f4b71 100644 --- a/pkg/utils/k8s_utils.go +++ b/pkg/utils/k8s_utils.go @@ -11,9 +11,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" ) -// // StringSet helper functions -// type StringSet map[string]bool func UnionStringSet(a, b StringSet) StringSet { @@ -46,9 +44,7 @@ func IntersectionStringSet(a, b StringSet) StringSet { return result } -// // k8s Node helper functions -// func GetNodeNameSet(nodes []*corev1.Node) StringSet { result := StringSet{} for _, node := range nodes { @@ -84,9 +80,7 @@ func FilterNodesWithTaintKeyValueEffect(nodes []*corev1.Node, taintKey, value st }) } -// // k8s Pod helper functions -// func IsPodUnschedulable(pod *corev1.Pod) bool { for _, condition := range pod.Status.Conditions { if condition.Reason == corev1.PodReasonUnschedulable && @@ -153,9 +147,7 @@ func FilterPodsWithLabel(pods []*corev1.Pod, label, value string) []*corev1.Pod }) } -// // k8s PVC helpers -// func FilterPVCsWithFn(pvcs []*corev1.PersistentVolumeClaim, fn func(*corev1.PersistentVolumeClaim) bool) []*corev1.PersistentVolumeClaim { result := []*corev1.PersistentVolumeClaim{} for _, pvc := range pvcs { diff --git a/tests/util/ginkgo/lib.go b/tests/util/ginkgo/lib.go index b118535e..dee1a85f 100644 --- a/tests/util/ginkgo/lib.go +++ b/tests/util/ginkgo/lib.go @@ -129,11 +129,11 @@ func (ns NsWrapper) Terminate() { Expect(dcErr).ToNot(HaveOccurred()) } -//=================================== +// =================================== // Logging functions for the NsWrapper // that execute the Kcmd and then dump // k8s logs for that namespace -//==================================== +// ==================================== func sanitizeForLogDirs(s string) string { reg, err := regexp.Compile(`[\s\\\/\-\.,]`) mageutil.PanicOnError(err) diff --git a/tests/util/kubectl/kubectl.go b/tests/util/kubectl/kubectl.go index 6b6736c9..8d888530 100644 --- a/tests/util/kubectl/kubectl.go +++ b/tests/util/kubectl/kubectl.go @@ -56,18 +56,18 @@ func WatchPodsInNs(namespace string) { kCmd.ExecVPanic() } -//============================================== +// ============================================== // KCmd represents an executable kubectl command -//============================================== +// ============================================== type KCmd struct { Command string Args []string Flags map[string]string } -//============================================== +// ============================================== // Execute KCmd by running kubectl -//============================================== +// ============================================== func (k KCmd) ToCliArgs() []string { var args []string // Write out flags first because we don't know @@ -105,10 +105,10 @@ func (k KCmd) OutputPanic() string { return shutil.OutputPanic("kubectl", k.ToCliArgs()...) } -//============================================== +// ============================================== // Helper functions to build up a KCmd object // for common actions -//============================================== +// ============================================== func (k KCmd) InNamespace(namespace string) KCmd { return k.WithFlag("namespace", namespace) }