-
Notifications
You must be signed in to change notification settings - Fork 103
Initial drop of the activator code #387
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
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
641dd29
initial drop of the activator code
lionelvillard 818c096
Adding for InferencePool v1
dumb0002 25cd974
Adding parameter to enable/disable scale to zero
dumb0002 16c4bdd
Update pkg/activator/server/controller_manager.go
lionelvillard 0b278ad
address some review comments
lionelvillard 9712865
address review comments
lionelvillard 58735ff
fix linter error
lionelvillard a03a272
activator-filter should be applied before BBR
lionelvillard f4b2b62
remove unused files and reorder some imports
lionelvillard 6c5fb88
Apply suggestion from @shmuelk
lionelvillard 9418a41
remove inferenceOjective from cache
lionelvillard 54143fd
revert to use go 1.24.1
lionelvillard 47bbf69
use golang 1.24 as 1.24.1 does not exists
lionelvillard 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Build Stage: using Go 1.24 image | ||
| FROM quay.io/projectquay/golang:1.24 AS builder | ||
| ARG TARGETOS | ||
| ARG TARGETARCH | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| # Copy the Go Modules manifests | ||
| COPY go.mod go.mod | ||
| COPY go.sum go.sum | ||
|
|
||
| # Copy the go source | ||
| COPY cmd/activator ./cmd/activator | ||
| COPY pkg/activator ./pkg/activator | ||
|
|
||
| # Build | ||
| # the GOARCH has not a default value to allow the binary be built according to the host where the command | ||
| # was called. For example, if we call make image-build in a local env which has the Apple Silicon M1 SO | ||
| # the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, | ||
| # by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. | ||
| ENV CGO_ENABLED=0 | ||
| ENV GOOS=${TARGETOS:-linux} | ||
| ENV GOARCH=${TARGETARCH} | ||
| ARG COMMIT_SHA=unknown | ||
| ARG BUILD_REF | ||
| RUN go build -a -o bin/activator -ldflags="-X sigs.k8s.io/gateway-api-inference-extension/version.CommitSHA=${COMMIT_SHA} -X sigs.k8s.io/gateway-api-inference-extension/version.BuildRef=${BUILD_REF}" cmd/activator/main.go | ||
|
|
||
|
|
||
| # Use ubi9 as a minimal base image to package the manager binary | ||
| # Refer to https://catalog.redhat.com/software/containers/ubi9/ubi-minimal/615bd9b4075b022acc111bf5 for more details | ||
| FROM registry.access.redhat.com/ubi9/ubi-minimal:latest | ||
| WORKDIR / | ||
| COPY --from=builder /workspace/bin/activator /app/activator | ||
|
|
||
| # expose gRPC, health and metrics ports | ||
| EXPOSE 9002 | ||
| EXPOSE 9003 | ||
| EXPOSE 9090 | ||
|
|
||
| USER 65532:65532 | ||
|
|
||
| ENTRYPOINT ["/app/activator"] |
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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *.orig | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj | ||
| .vscode/ |
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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: v2 | ||
| name: activator | ||
| description: A Helm chart for the activator extension | ||
|
|
||
| type: application | ||
|
|
||
| version: 0.1.0 | ||
|
|
||
| appVersion: "0.2.0" |
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 |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Activator Chart | ||
|
|
||
| A chart to deploy the activator HTTP filter for an InferenceGateway and RBAC for all per route activator deployments. | ||
|
|
||
| ## Install | ||
|
|
||
| To install an activator-filter named `activator-filter`, you can run the following command: | ||
|
|
||
| ```txt | ||
| $ helm install activator-filter ./charts/activator-filter | ||
| ``` | ||
|
|
||
| > **Note:** This chart should be deployed before the [Body Based Routing](https://github.com/kubernetes-sigs/gateway-api-inference-extension/tree/main/config/charts/body-based-routing) chart for optimal functionality. | ||
|
|
||
| ## Uninstall | ||
|
|
||
| Run the following command to uninstall the chart: | ||
|
|
||
| ```txt | ||
| $ helm uninstall activator-filter | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The following table list the configurable parameters of the chart. | ||
|
|
||
| | **Parameter Name** | **Description** | | ||
| |---------------------------------------------|----------------------------------------------------------------------------------------------------| | ||
| | `name` | Name of the activator RBAC resources. Defaults to `activator`. | | ||
nirrozenbaum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Notes | ||
|
|
||
| This chart should only be deployed once | ||
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Activator HTTP Filter deployed. |
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 |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| apiVersion: networking.istio.io/v1alpha3 | ||
| kind: EnvoyFilter | ||
| metadata: | ||
| name: {{ .Values.name }}-ext-proc | ||
| namespace: {{ .Release.Namespace }} | ||
| spec: | ||
| configPatches: | ||
| - applyTo: HTTP_FILTER | ||
| match: | ||
| # context omitted so that this applies to both sidecars and gateways | ||
| listener: | ||
| filterChain: | ||
| filter: | ||
| name: "envoy.filters.network.http_connection_manager" | ||
| patch: | ||
| operation: INSERT_FIRST | ||
elevran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| value: | ||
| name: envoy.filters.http.activator.ext_proc | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor | ||
| failure_mode_allow: true | ||
| grpc_service: | ||
| envoy_grpc: | ||
| cluster_name: no-op | ||
| message_timeout: 120s | ||
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 |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: {{ .Values.name }} | ||
| namespace: {{ .Release.Namespace }} | ||
| --- | ||
| kind: Role | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| metadata: | ||
| name: {{ .Values.name }} | ||
| namespace: {{ .Release.Namespace }} | ||
| rules: # TODO: These can probably be trimmed down | ||
| - apiGroups: | ||
| - "inference.networking.x-k8s.io" | ||
lionelvillard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - "inference.networking.k8s.io" | ||
| resources: | ||
| - "inferencepools" | ||
| verbs: | ||
| - "get" | ||
| - "watch" | ||
| - "list" | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - "pods" | ||
| verbs: | ||
| - "get" | ||
| - "watch" | ||
| - "list" | ||
| - apiGroups: | ||
| - "discovery.k8s.io" | ||
| resources: | ||
| - "endpointslices" | ||
| verbs: | ||
| - "get" | ||
| - "watch" | ||
| - "list" | ||
| - apiGroups: | ||
| - "authentication.k8s.io" | ||
| resources: | ||
| - "tokenreviews" | ||
| verbs: | ||
| - "create" | ||
| - apiGroups: | ||
| - "authorization.k8s.io" | ||
| resources: | ||
| - "subjectaccessreviews" | ||
| verbs: | ||
| - "create" | ||
| - apiGroups: | ||
| - "apps" | ||
| resources: | ||
| - "deployments" | ||
elevran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| verbs: | ||
| - "create" | ||
| - "get" | ||
| - "list" | ||
| - "watch" | ||
| - "update" | ||
| - "patch" | ||
| - "delete" | ||
| - apiGroups: | ||
| - apps | ||
| resources: | ||
| - deployments/scale | ||
| verbs: | ||
| - get | ||
| - update | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ .Values.name }} | ||
| namespace: {{ .Release.Namespace }} | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ .Values.name }} | ||
| namespace: {{ .Release.Namespace }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: {{ .Values.name }} | ||
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| name: activator |
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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *.orig | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj | ||
| .vscode/ |
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 |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: v2 | ||
| name: activator-route | ||
| description: A Helm chart for the activator extension | ||
|
|
||
| type: application | ||
|
|
||
| version: 0.1.0 | ||
|
|
||
| appVersion: "0.2.0" |
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 |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Activator Chart | ||
|
|
||
| A chart to deploy the activator deployment and service per HTTPRoute. | ||
|
|
||
| ## Install | ||
|
|
||
| To install an activator named `<route.name>-activator`, you can run the following command: | ||
|
|
||
| ```txt | ||
| $ helm install activator ./charts/activator \ | ||
| --set route.name=http-route-name \ | ||
| --set inferencePool.name=inference-pool-name | ||
|
|
||
| ``` | ||
|
|
||
| ## Uninstall | ||
|
|
||
| Run the following command to uninstall the chart: | ||
|
|
||
| ```txt | ||
| $ helm uninstall activator | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The following table list the configurable parameters of the chart. | ||
|
|
||
| | **Parameter Name** | **Description** | | ||
| |---------------------------------------------|----------------------------------------------------------------------------------------------------| | ||
| | `activator.suffix` | Suffix to append to the name of the activator deployment and service. Defaults to `-activator`. | | ||
| | `activator.port` | Port serving ext_proc. Defaults to `9004`. | | ||
| | `activator.healthCheckPort` | Port for health checks. Defaults to `9005`. | | ||
| | `activator.image.name` | Name of the container image used. | | ||
| | `activator.image.registry` | Registry URL and namespace where the image is hosted. | | ||
| | `activator.image.tag` | Image tag. | | ||
| | `activator.image.pullPolicy` | Image pull policy for the container. Possible values: `Always`, `IfNotPresent`, or `Never`. Defaults to `Always`. | | ||
| | `inferenceGateway.port` | The port of the Gateway. Defaults to `80`. | | ||
| | `inferencePool.name` | The name of the InferencePool to target. | | ||
| | `inferencePool.apiVersion` | The API version of the InferencePool. Defaults to `inference.networking.k8s.io`. | | ||
| | `route.name` | The name of the HTTPRoute to attach the activator to. | | ||
|
|
||
| ## Notes | ||
|
|
||
| This chart should only be deployed once per HTTPRoute. |
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Activator extension deployed for HTTPRoute {{.Values.route.name }} |
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.
whoever is going to use activator isn't necessarily familiar with what is filter. we can call it just
activator.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.
there is already a chart named
activator. What aboutactivator-istio?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.
is there a use case for deploying one chart without the other?
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.
both are needed. The only difference is one is applied once per namespace, the other one once per HTTPRoute.