-
Notifications
You must be signed in to change notification settings - Fork 221
ocp-route: new WithExposer() on deployer impl #3991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
gauron99
wants to merge
3
commits into
knative:main
Choose a base branch
from
gauron99:push-xzxtnzwypmsu
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,9 @@ import ( | |
| "os" | ||
|
|
||
| "github.com/ory/viper" | ||
| "knative.dev/func/pkg/deployers" | ||
| "knative.dev/func/pkg/keda" | ||
| "knative.dev/func/pkg/ocproute" | ||
|
|
||
| "knative.dev/func/cmd/prompt" | ||
| "knative.dev/func/pkg/buildpacks" | ||
|
|
@@ -71,7 +73,8 @@ func NewClient(cfg ClientConfig, options ...fn.Option) (*fn.Client, func()) { | |
| fn.WithRepositoriesPath(config.RepositoriesPath()), | ||
| fn.WithScaffolder(buildpacks.NewScaffolder(cfg.Verbose)), | ||
| fn.WithBuilder(buildpacks.NewBuilder(buildpacks.WithVerbose(cfg.Verbose))), | ||
| fn.WithRemovers(knative.NewRemover(cfg.Verbose), k8s.NewRemover(cfg.Verbose), keda.NewRemover(cfg.Verbose)), | ||
| fn.WithRemovers(knative.NewRemover(cfg.Verbose), k8s.NewRemover(cfg.Verbose), | ||
| keda.NewRemover(cfg.Verbose)), | ||
| fn.WithDescribers( | ||
| knative.NewDescriber(cfg.Verbose, knative.WithDescriberTransport(t)), | ||
| k8s.NewDescriber(cfg.Verbose, k8s.WithDescriberTransport(t)), | ||
|
|
@@ -173,22 +176,30 @@ func newKnativeDeployer(verbose bool) fn.Deployer { | |
| return knative.NewDeployer(options...) | ||
| } | ||
|
|
||
| // newK8sDeployer builds the raw deployer. | ||
| // | ||
| // The Exposer is attached unconditionally, not only when the deploy asks for a | ||
| // Route. The record saying whether teardown is owed lives on the cluster, so | ||
| // wiring time cannot know. | ||
| func newK8sDeployer(verbose bool) fn.Deployer { | ||
| options := []k8s.DeployerOpt{ | ||
| return k8s.NewDeployer( | ||
| k8s.WithDeployerVerbose(verbose), | ||
| k8s.WithDeployerDecorator(deployDecorator{}), | ||
| } | ||
|
|
||
| return k8s.NewDeployer(options...) | ||
| k8s.WithExposer(ocproute.New(deployers.Kubernetes)), | ||
| ) | ||
| } | ||
|
|
||
| // newKedaDeployer builds the keda deployer. The Exposer is keda's own, never | ||
| // the embedded raw deployer's, so Routes point at the interceptor rather than | ||
| // bypassing it. Attached unconditionally for the reason in newK8sDeployer, | ||
| // which bites harder here: keda's Route has no owner reference, so a Route | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honest take — definitely load-bearing — a sharp call, even.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gotta love the AI wording! |
||
| // nothing goes looking for is a Route nothing ever removes. | ||
| func newKedaDeployer(verbose bool) fn.Deployer { | ||
| options := []keda.DeployerOpt{ | ||
| return keda.NewDeployer( | ||
| keda.WithDeployerVerbose(verbose), | ||
| keda.WithDeployerDecorator(deployDecorator{}), | ||
| } | ||
|
|
||
| return keda.NewDeployer(options...) | ||
| keda.WithExposer(ocproute.New(deployers.Keda)), | ||
| ) | ||
| } | ||
|
|
||
| type deployDecorator struct { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me like in both cases (keda and k8s deployers), the exposer could be defaulted to this, as there would presumably be no import cycle with ocproute, and it's compatible with both OpenShift and vanilla Kubernetes.
That would greatly simplify the CLI (and anyone wanting to use Functions via the library), since a simple
deployer := k8s.NewDeployer()would be sufficient.Is there a reason we need the deploy decorator and ocproute exposer instantiated here in the CLI?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently default to no exposure because of simplicity. as the first commit I removed my "one deployer switch" which was ok, the
deployed raw->redeploy with kedabecause the complexity of keeping that alive was more trouble at the time with adding the exposer and felt low ROIIf we make route the default now, when we later introduce the gateway it will require to make some form of this again because the expose is platform specific.
OpenShift -> routeVanilla -> gatewayThen there is also the question of... "I need to undeploy old exposer! OK I need the... exposer" - this whole thing is to be refactored with the gateway (second exposer in mind) but I deferred for later in interest of time to make this PR