Skip to content
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

Not creating app deployments #78

Merged
merged 15 commits into from
Mar 19, 2021
Merged

Conversation

arschles
Copy link
Collaborator

@arschles arschles commented Mar 1, 2021

Fixes #35

Previous to this PR, the operator created an application Deployment and Service. This pull request removes that functionality and requires that a user creates those things themself. In doing so, we're focusing the HTTP add on directly on:

  • Autoscaling
  • The minimum amount of traffic routing and distribution functionality needed to achieve autoscaling

This PR also changes the schema of the CRD. The new CRD needs to allow the user to specify what to scale and how to route. To achieve that, I've added a scaleTargetRef field to match the pattern that KEDA core has. It looks similar to this:

    scaleTargetRef:
        deployment: xkcd
        service: xkcd
        port: 8080

The above would instruct the operator to scale a Deployment called xkcd and route traffic through a Service called xkcd on port 8080.

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO)
  • Regenerate the CRD and deepcopy code
  • Remove the option to create a new deployment/service - the http-add-on should only scale existing deployments

Fixes #35
Fixes #74

Fixes kedacore#35

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
@arschles arschles added the enhancement New feature or request label Mar 1, 2021
@arschles arschles added this to the Alpha 2 milestone Mar 1, 2021
arschles added 3 commits March 1, 2021 14:37
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
Also generalizing test "infrastructure" code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
@arschles arschles marked this pull request as ready for review March 1, 2021 23:06
Copy link
Member

@tomkerkhove tomkerkhove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some docs please?

arschles added 2 commits March 5, 2021 11:15
Users provide a scale target ref, which is the name of the
deployment to scale and the service to route to. They are required
to have already deployed these things already

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
@arschles arschles changed the title Allowing users to scale an existing deployment Not creating app deployments Mar 5, 2021
@arschles
Copy link
Collaborator Author

arschles commented Mar 5, 2021

@tomkerkhove yup, documentation added here. I also removed the functionality that creates application Deployments and Services, as discussed in the March 2, 2021 community meeting.

Copy link
Member

@tomkerkhove tomkerkhove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, thanks for making the change!

Added a few suggestions and was wondering why we are adding the xkcd Helm chart? Maybe we should leave that one out?

docs/ref/http_scaled_object.md Show resolved Hide resolved
As said above, you need to route your HTTP traffic to the `Service` that the add on has created. If you have existing systems - like an ingress controller - you'll need to anticipate the name of these created `Service`s. Each one will be named consistently like so, in the same namespace as the `HTTPScaledObject` and your application (i.e. `$NAMESPACE`):

```shell
<deployment name>-interceptor-proxy
Copy link
Member

@tomkerkhove tomkerkhove Mar 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also make the interceptor service configurable?

kind: HTTPScaledObject
apiVersion: http.keda.sh/v1alpha1
metadata:
    name: xkcd
spec:
    scaleTargetRef:
        deployment: xkcd
        service: xkcd
        port: 8080
    service:
        name: my-interceptor-proxy
        port: 9999
        type: LoadBalancer

Or just surface it like this:

kind: HTTPScaledObject
apiVersion: http.keda.sh/v1alpha1
metadata:
    name: xkcd
spec:
    scaleTargetRef:
        deployment: xkcd
        service: xkcd
        port: 8080
    service:
        name: my-interceptor-proxy
        spec:
            selector:
              app: MyApp
            ports:
            - protocol: TCP
              port: 80
              targetPort: 9376

Happy to open an issue if you want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomkerkhove yea, can you create an issue for that? One thing I wonder is, should we not have it create a Service at all? By not doing so, we won't impose limitations on how they're configured.

We could then add to the documentation that users can create a Service with a specific label selector if they want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think @zroubalik?

I think having it part of the spec might be useful? Users and reading docs doesn't always go that well 😁

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point 😆. Would it be possible to merge this and then either add the service field or remove Service creation altogether in a follow up (depending on what you and @zroubalik decide)?

Also, if this helps:

In the scope doc, it says the following is in scope: Route HTTP traffic from a given source to an arbitrary HTTP server, as far as we need to efficiently accomplish (1). That could help the decision. I'd like to prefer having the operator create less things, but I'll defer to what you and @zroubalik think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to another PR is fine for me, but this feels like something we need to have to be able to work imo since this is for the interceptor.

If they have to create the service for KEDA, then it's too much infrastructure imo.

It's all about how you approach it. When I create an HTTPScaledObject you could add a field that surfaces the port + IP (if need be) so that it's all in that CRD when doing k get HTTPScaledObject and users don't even know about the service that was created. (not saying we should but a possibility).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, yea I tend to agree with that @tomkerkhove . I'm happy to add the fields that surface port, IP, and maybe other fields. This PR is blocking some other work (since it makes such big fundamental changes to the operator). If there's nothing else you'd like to change in it, I'd like us to merge it and I will concurrently open a follow-up PR that adds those fields. What do you think @tomkerkhove @zroubalik ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#107 is the follow-up issue

arschles and others added 7 commits March 15, 2021 16:41
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
@arschles arschles mentioned this pull request Mar 17, 2021
1 task
Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good

// ScaleTargetRef contains all the details about an HTTP application to scale and route to
type ScaleTargetRef struct {
// The name of the deployment to scale according to HTTP traffic
Deployment string `json:"deployment"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit. Do you want to target just Deployments, what about StatefulSet or CustomResources with /scale subresoure? Might be worth checking how is this handled in ScaledObject: https://github.com/kedacore/keda/blob/6dc4c3524ba6278276cd1338cc7e4e9a7dd88963/api/v1alpha1/scaledobject_types.go#L75-L81

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to target Deployments for now, and open it up to other HTTP workloads that folks might want to scale in the future. Does that sound ok to you @zroubalik ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zroubalik I am going to merge this PR now, and we can create a follow-up if you think we need to support StatefulSet or other resources with a /scale subresource right now.

@arschles arschles merged commit fd4cdfe into kedacore:main Mar 19, 2021
@arschles arschles deleted the existing-deployment branch March 19, 2021 19:58
kingdonb pushed a commit to kingdonb/http-add-on that referenced this pull request Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation for the HTTPScaledObject schema Allow users to scale an existing Deployment
3 participants