Skip to content

Commit 6e8db30

Browse files
committed
Review fixes and added version info
Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>
1 parent c5c5733 commit 6e8db30

File tree

8 files changed

+36
-270
lines changed

8 files changed

+36
-270
lines changed

Dockerfile.sidecar

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
FROM quay.io/projectquay/golang:1.25 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
5+
ARG COMMIT_SHA=unknown
6+
ARG BUILD_REF
57

68
WORKDIR /workspace
79
# Copy the Go Modules manifests
@@ -12,19 +14,25 @@ COPY go.sum go.sum
1214
RUN go mod download
1315

1416
# Copy the go source
15-
COPY cmd/llm-d-routing-sidecar/main.go cmd/cmd.go
17+
COPY cmd/pd-sidecar/main.go cmd/cmd.go
1618
COPY pkg/sidecar pkg/sidecar
19+
COPY pkg/common pkg/common
1720

1821
# Build
1922
# the GOARCH has not a default value to allow the binary be built according to the host where the command
2023
# was called. For example, if we call make image-build in a local env which has the Apple Silicon M1 SO
2124
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
2225
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
23-
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o bin/llm-d-routing-sidecar cmd/cmd.go
26+
ENV CGO_ENABLED=0
27+
ENV GOOS=${TARGETOS:-linux}
28+
ENV GOARCH=${TARGETARCH}
29+
RUN go build -a -o bin/pd-sidecar \
30+
-ldflags="-X github.com/llm-d/llm-d-inference-scheduler/pkg/sidecar/version.CommitSHA=${COMMIT_SHA} -X github.com/llm-d/llm-d-inference-scheduler/pkg/sidecar/version.BuildRef=${BUILD_REF}" \
31+
cmd/cmd.go
2432

2533
FROM registry.access.redhat.com/ubi9/ubi-micro:latest
2634
WORKDIR /
27-
COPY --from=builder /workspace/bin/llm-d-routing-sidecar /app/llm-d-routing-sidecar
35+
COPY --from=builder /workspace/bin/pd-sidecar /app/pd-sidecar
2836
USER 65532:65532
2937

30-
ENTRYPOINT ["/app/llm-d-routing-sidecar"]
38+
ENTRYPOINT ["/app/pd-sidecar"]

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ SHELL := /usr/bin/env bash
77
TARGETOS ?= $(shell go env GOOS)
88
TARGETARCH ?= $(shell go env GOARCH)
99
PROJECT_NAME ?= llm-d-inference-scheduler
10-
SIDECAR_NAME ?= llm-d-routing-sidecar
10+
SIDECAR_IMAGE_NAME ?= llm-d-routing-sidecar
11+
SIDECAR_NAME ?= pd-sidecar
1112
IMAGE_REGISTRY ?= ghcr.io/llm-d
1213
IMAGE_TAG_BASE ?= $(IMAGE_REGISTRY)/$(PROJECT_NAME)
1314
EPP_TAG ?= dev
1415
IMG = $(IMAGE_TAG_BASE):$(EPP_TAG)
1516
SIDECAR_TAG ?= dev
16-
SIDECAR_IMAGE_TAG_BASE ?= ghcr.io/llm-d/$(SIDECAR_NAME)
17+
SIDECAR_IMAGE_TAG_BASE ?= ghcr.io/llm-d/$(SIDECAR_IMAGE_NAME)
1718
SIDECAR_IMG = $(SIDECAR_IMAGE_TAG_BASE):$(SIDECAR_TAG)
1819
NAMESPACE ?= hc4ai-operator
1920

@@ -155,8 +156,10 @@ image-push: check-container-tool ## Push Docker image $(IMG) to registry
155156
sidecar-image-build: check-container-tool ## Build Sidecar Docker image ## Build Sidecar Docker image using $(CONTAINER_TOOL)
156157
@printf "\033[33;1m==== Building Sidecar Docker image $(SIDECAR_IMG) ====\033[0m\n"
157158
$(CONTAINER_TOOL) build \
158-
--build-arg TARGETOS=linux \
159+
--build-arg TARGETOS=linux \
159160
--build-arg TARGETARCH=$(TARGETARCH) \
161+
--build-arg COMMIT_SHA=${GIT_COMMIT_SHA} \
162+
--build-arg BUILD_REF=${BUILD_REF} \
160163
-t $(SIDECAR_IMG) -f Dockerfile.sidecar .
161164

162165
.PHONY: sidecar-image-push
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ limitations under the License.
1616
package main
1717

1818
import (
19-
"context"
2019
"flag"
2120
"net/url"
2221
"os"
2322

2423
"k8s.io/klog/v2"
24+
ctrl "sigs.k8s.io/controller-runtime"
2525

2626
"github.com/llm-d/llm-d-inference-scheduler/pkg/sidecar/proxy"
27-
"github.com/llm-d/llm-d-inference-scheduler/pkg/sidecar/signals"
27+
"github.com/llm-d/llm-d-inference-scheduler/pkg/sidecar/version"
2828
)
2929

3030
func main() {
@@ -50,16 +50,15 @@ func main() {
5050
// make sure to flush logs before exiting
5151
defer klog.Flush()
5252

53-
ctx := signals.SetupSignalHandler(context.Background())
53+
ctx := ctrl.SetupSignalHandler()
5454
logger := klog.FromContext(ctx)
5555

56-
if *connector != proxy.ConnectorNIXLV1 && *connector != proxy.ConnectorNIXLV2 && *connector != proxy.ConnectorLMCache {
57-
logger.Info("Error: --connector must either be 'nixl', 'nixlv2' or 'lmcache'")
56+
logger.Info("Proxy starting", "Built on", version.BuildRef, "From Git SHA", version.CommitSHA)
57+
58+
if *connector != proxy.ConnectorNIXLV2 && *connector != proxy.ConnectorLMCache {
59+
logger.Info("Error: --connector must either be 'nixlv2' or 'lmcache'")
5860
return
5961
}
60-
if *connector == proxy.ConnectorNIXLV1 {
61-
logger.Info("Warning: nixl connector is deprecated and will be removed in a future release in favor of --connector=nixlv2")
62-
}
6362
logger.Info("p/d connector validated", "connector", connector)
6463

6564
// Determine namespace and pool name for SSRF protection

pkg/sidecar/proxy/connector_nixl.go

Lines changed: 0 additions & 178 deletions
This file was deleted.

pkg/sidecar/proxy/proxy.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ const (
4949
requestFieldStream = "stream"
5050
requestFieldStreamOptions = "stream_options"
5151

52-
// ConnectorNIXLV1 enables the (now deprecated) P/D NIXL v1 protocol
53-
ConnectorNIXLV1 = "nixl"
54-
5552
// ConnectorNIXLV2 enables the P/D NIXL v2 protocol
5653
ConnectorNIXLV2 = "nixlv2"
5754

@@ -128,8 +125,6 @@ func NewProxy(port string, decodeURL *url.URL, config Config) (*Server, error) {
128125
switch config.Connector {
129126
case ConnectorLMCache:
130127
server.runConnectorProtocol = server.runLMCacheProtocol
131-
case ConnectorNIXLV1:
132-
server.runConnectorProtocol = server.runNIXLProtocolV1
133128
case ConnectorNIXLV2:
134129
fallthrough
135130
default:

pkg/sidecar/signals/signal_posix.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

pkg/sidecar/signals/signals.go

Lines changed: 0 additions & 44 deletions
This file was deleted.

pkg/sidecar/version/version.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// The version package contains build version information
2+
package version
3+
4+
var (
5+
// The git hash of the latest commit in the build.
6+
CommitSHA string
7+
8+
// The build ref from the _PULL_BASE_REF from cloud build trigger.
9+
BuildRef string
10+
)
11+

0 commit comments

Comments
 (0)