feat: Use strategic merge to patch workloads and add metrics for load testing

This commit is contained in:
TheiLLeniumStudios
2026-01-04 14:01:14 +01:00
parent da6f33c059
commit c785067a44
17 changed files with 537 additions and 86 deletions
+12 -10
View File
@@ -106,6 +106,18 @@ func run(cmd *cobra.Command, args []string) error {
collectors := metrics.SetupPrometheusEndpoint()
if config.ShouldAutoDetectOpenShift() {
restConfig := controllerruntime.GetConfigOrDie()
discoveryClient, err := discovery.NewDiscoveryClientForConfig(restConfig)
if err != nil {
log.V(1).Info("Failed to create discovery client for DeploymentConfig detection", "error", err)
} else if openshift.HasDeploymentConfigSupport(discoveryClient, log) {
cfg.DeploymentConfigEnabled = true
}
}
controller.AddOptionalSchemes(cfg.ArgoRolloutsEnabled, cfg.DeploymentConfigEnabled)
mgr, err := controller.NewManager(
controller.ManagerOptions{
Config: cfg,
@@ -117,16 +129,6 @@ func run(cmd *cobra.Command, args []string) error {
return fmt.Errorf("creating manager: %w", err)
}
if config.ShouldAutoDetectOpenShift() {
restConfig := controllerruntime.GetConfigOrDie()
discoveryClient, err := discovery.NewDiscoveryClientForConfig(restConfig)
if err != nil {
log.V(1).Info("Failed to create discovery client for DeploymentConfig detection", "error", err)
} else if openshift.HasDeploymentConfigSupport(discoveryClient, log) {
cfg.DeploymentConfigEnabled = true
}
}
if err := controller.SetupReconcilers(mgr, cfg, log, &collectors); err != nil {
return fmt.Errorf("setting up reconcilers: %w", err)
}