flyte icon indicating copy to clipboard operation
flyte copied to clipboard

[BUG] disableWebhook true not disabling Propeller webhook service from being created in flyte-binary

Open spacepirate0001 opened this issue 1 year ago • 3 comments

Describe the bug

DisableWebhook flag set to true but not disabling Propeller webhook service from being created in flyte-binary

Expected behavior

[BUG] disableWebhook true should disable Propeller webhook service from being created in flyte-binary

Additional context to reproduce

No response

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • [X] Yes

Have you read the Code of Conduct?

  • [X] Yes

spacepirate0001 avatar Feb 13 '24 01:02 spacepirate0001

🤖

Ahoy, @spacepirate0001! Great to see you navigating through the Flyte seas again. How's the journey treating you?

Based on your description, it seems like the DisableWebhook flag is not disabling the Propeller webhook service as expected because the profiling server and the controller manager are still being started even when the DisableWebhook flag is set to true.

In the startPropeller function, the following code block is responsible for starting the profiling server and the controller manager:

if !cfg.DisableWebhook || !cfg.Disabled {
	handlers := map[string]http.Handler{
		"/k8smetrics": promhttp.HandlerFor(metrics.Registry, promhttp.HandlerOpts{
			ErrorHandling: promhttp.HTTPErrorOnError,
		}),
	}

	g.Go(func() error {
		return profutils.StartProfilingServerWithDefaultHandlers(childCtx, propellerCfg.ProfilerPort.Port, handlers)
	})

	g.Go(func() error {
		err := propellerEntrypoint.StartControllerManager(childCtx, mgr)
		if err != nil {
			logger.Fatalf(childCtx, "Failed to start controller manager. Error: %v", err)
		}
		return err
	})
}

This block is executed if either DisableWebhook is false or Disabled is false. Therefore, even if DisableWebhook is set to true, the block will still execute if Disabled is false, which means the profiling server and the controller manager will still be started.

To ensure that the Propeller webhook service is disabled when DisableWebhook is set to true, you should modify the condition to check that both DisableWebhook and Disabled are true before starting the profiling server and the controller manager. The modified code block would look like this:

if !cfg.DisableWebhook && !cfg.Disabled {
	// existing code
}

This change should ensure that the Propeller webhook service is disabled when DisableWebhook is set to true. You can find this code in the start.go file in the Flyte repository.

Regarding the role of the DisableWebhook flag, it is used to disable the webhook only. This is indicated by the pflag description in the code: pflag:",Disables webhook only". This means that when this flag is set to true, the webhook component of the flytepropeller in the single binary mode will be disabled. You can find this in the config.go file.

The Disabled flag, on the other hand, is used to control whether a particular component of the Flyte system should be started or not. If the Disabled flag is set to true, the corresponding component (Admin, Propeller, or DataCatalog) will not be started. These flags allow for fine-grained control over which components of the Flyte system are active at any given time. You can find this in the start.go file.

I hope this helps! If you have any other questions, feel free to ask.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Feb 13 '24 01:02 dosubot[bot]

@eapolinario I can contribute this!

spacepirate0001 avatar Feb 16 '24 18:02 spacepirate0001

@spacepirate0001 Thank you. Feel free to open a PR.

pingsutw avatar Feb 16 '24 20:02 pingsutw