Skip to content

Commit

Permalink
use BROADCASTER_BURST_SIZE to set spam filter threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
LiboYu2 committed Oct 24, 2024
1 parent e774ca6 commit 15c80ce
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ export CONTROLLERS_ENABLED
# Set this to control if the webhook is enabled or disabled in the operator.
WEBHOOKS_ENABLED?=true
export WEBHOOKS_ENABLED

#set this to increase the threshold used by spam filter
BROADCASTER_BURST_SIZE?=100
export BROADCASTER_BURST_SIZE
#
# Use this to control what scope the controller is deployed at. It supports two
# values:
Expand Down
7 changes: 5 additions & 2 deletions cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ func main() {
if opcfg.GetLoggingFilePath() != "" {
log.Printf("Now logging in file %s", opcfg.GetLoggingFilePath())
}
var multibroadcaster = record.NewBroadcasterWithCorrelatorOptions(record.CorrelatorOptions{BurstSize: 100})
burstSize := opcfg.GetBroadcasterBurstSize()
var multibroadcaster = record.NewBroadcasterWithCorrelatorOptions(record.CorrelatorOptions{BurstSize: burstSize})
ctrl.SetLogger(logger)
setupLog.Info("Build info", "gitCommit", GitCommit,
"buildDate", BuildDate, "vclusterVersion", VClusterVersion)
Expand All @@ -249,7 +250,9 @@ func main() {
"version", opcfg.GetVersion(),
"watchNamespace", opcfg.GetWatchNamespace(),
"webhooksEnabled", opcfg.GetIsWebhookEnabled(),
"controllersEnabled", opcfg.GetIsControllersEnabled())
"controllersEnabled", opcfg.GetIsControllersEnabled(),
"broadcasterBurstSize", burstSize,
)

restCfg := ctrl.GetConfigOrDie()

Expand Down
1 change: 1 addition & 0 deletions config/manager/operator-envs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ CONCURRENCY_VERTICARESTOREPOINTSQUERY
CONCURRENCY_VERTICASCRUTINIZE
CONCURRENCY_SANDBOXCONFIGMAP
CONCURRENCY_VERTICAREPLICATOR
BROADCASTER_BURST_SIZE
10 changes: 10 additions & 0 deletions pkg/opcfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ func GetIsWebhookEnabled() bool {
return lookupBoolEnvVar("WEBHOOKS_ENABLED", envMustExist)
}

// GetBroadcasterBurstSize returns the customizable burst size for broadcaster.
func GetBroadcasterBurstSize() int {
burstSize := lookupIntEnvVar("BROADCASTER_BURST_SIZE", envCanNotExist)
if burstSize < 25 {
return 25
} else {
return burstSize
}
}

// GetIsControllersEnabled returns true if the controllers for each custom
// resource will start. If this is false, then the manager will just act as a
// webhook (if enabled).
Expand Down
1 change: 1 addition & 0 deletions scripts/setup-kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ echo "Deployment method: $VERTICA_DEPLOYMENT_METHOD"
echo "Image version: $(determine_image_version $VERTICA_IMG)"
echo "Vertica superuser name: $VERTICA_SUPERUSER_NAME"
echo "Test running on Github CI: $FOR_GITHUB_CI"
echo "Broadcaster burst size: $BROADCASTER_BURST_SIZE"

function create_vdb_kustomization {
BASE_DIR=$1
Expand Down
5 changes: 1 addition & 4 deletions tests/e2e-leg-10/sandbox-basic/60-unsandbox-sec3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
timeout: 900
---

apiVersion: vertica.com/v1
kind: VerticaDB
metadata:
Expand Down
7 changes: 6 additions & 1 deletion tests/kustomize-defaults.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ USE_SERVER_MOUNT_PATCH=
# expansion. Set this value to 1 for those environments.
ALLOW_VOLUME_EXPANSION=

# this will set up the threshold used by the spam filer
# default threshold is 25, which is too low to run the test cases
# some test cases rely on event verification
BROADCASTER_BURST_SIZE=100

# The type of deployment to use when running vertica admin commands. Valid
# values are: admintools or vclusterops. Uncomment this or set this environment
# in your shell to control the deployment type.
Expand All @@ -119,4 +124,4 @@ ALLOW_VOLUME_EXPANSION=
# The name of Vertica superuser generated in database creation. When it is
# not set, default value "dbadmin" will be used. Uncomment this or set this
# environment in your shell to specify Vertica superuser name.
# VERTICA_SUPERUSER_NAME=
# VERTICA_SUPERUSER_NAME=

0 comments on commit 15c80ce

Please sign in to comment.