Skip to content

Commit fd9c10d

Browse files
committed
address some review comments
Signed-off-by: Lionel Villard <[email protected]>
1 parent b8e130a commit fd9c10d

File tree

4 files changed

+19
-34
lines changed

4 files changed

+19
-34
lines changed

Makefile

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ SIDECAR_IMAGE_TAG_BASE ?= $(IMAGE_REGISTRY)/$(SIDECAR_IMAGE_NAME)
1818
SIDECAR_IMG = $(SIDECAR_IMAGE_TAG_BASE):$(SIDECAR_TAG)
1919
NAMESPACE ?= hc4ai-operator
2020

21-
ACTIVATOR_IMAGE_TAG_BASE ?= $(IMAGE_REGISTRY)/$(PROJECT_NAME)-activator
22-
ACTIVATOR_IMG = $(ACTIVATOR_IMAGE_TAG_BASE):$(EPP_TAG)
21+
ACTIVATOR_IMAGE_NAME ?= llm-d-activator
22+
ACTIVATOR_NAME ?= activator
23+
ACTIVATOR_TAG ?= dev
24+
ACTIVATOR_IMAGE_TAG_BASE ?= $(IMAGE_REGISTRY)/$(ACTIVATOR_IMAGE_NAME)
25+
ACTIVATOR_IMG = $(ACTIVATOR_IMAGE_TAG_BASE):$(ACTIVATOR_TAG)
2326

2427
# Map go arch to typos arch
2528
ifeq ($(TARGETARCH),amd64)
@@ -57,10 +60,13 @@ SRC = $(shell find . -type f -name '*.go')
5760
# Internal variables for generic targets
5861
epp_IMAGE = $(IMG)
5962
sidecar_IMAGE = $(SIDECAR_IMG)
63+
activator_IMAGE = $(ACTIVATOR_IMG)
6064
epp_NAME = epp
6165
sidecar_NAME = $(SIDECAR_NAME)
66+
activator_NAME = $(ACTIVATOR_NAME)
6267
epp_LDFLAGS = -ldflags="$(LDFLAGS)"
6368
sidecar_LDFLAGS =
69+
activator_LDFLAGS = -ldflags="$(LDFLAGS)"
6470
epp_TEST_FILES = go list ./... | grep -v /test/ | grep -v ./pkg/sidecar/
6571
sidecar_TEST_FILES = go list ./pkg/sidecar/...
6672

@@ -133,25 +139,17 @@ lint: check-golangci-lint check-typos ## Run lint
133139
##@ Build
134140

135141
.PHONY: build
136-
build: build-epp build-sidecar ## Build the project
142+
build: build-epp build-sidecar build-activator ## Build the project
137143

138144
.PHONY: build-%
139145
build-%: check-go install-dependencies download-tokenizer ## Build the project
140146
@printf "\033[33;1m==== Building ====\033[0m\n"
141147
go build $($*_LDFLAGS) -o bin/$($*_NAME) cmd/$($*_NAME)/main.go
142148

143-
##@ Build Activator
144-
145-
.PHONY: activator-build
146-
activator-build: check-go install-dependencies download-tokenizer ## Build the project
147-
@printf "\033[33;1m==== Building ====\033[0m\n"
148-
go build -ldflags="$(LDFLAGS)" -o bin/activator cmd/activator/main.go
149-
150-
151149
##@ Container Build/Push
152150

153151
.PHONY: image-build
154-
image-build: image-build-epp image-build-sidecar ## Build Docker image
152+
image-build: image-build-epp image-build-sidecar image-build-activator ## Build Docker image
155153

156154
.PHONY: image-build-%
157155
image-build-%: check-container-tool ## Build Docker image ## Build Docker image using $(CONTAINER_TOOL)
@@ -165,29 +163,13 @@ image-build-%: check-container-tool ## Build Docker image ## Build Docker image
165163
-t $($*_IMAGE) -f Dockerfile.$* .
166164

167165
.PHONY: image-push
168-
image-push: image-push-epp image-push-sidecar ## Push Docker images to registry
166+
image-push: image-push-epp image-push-sidecar image-push-activator ## Push Docker images to registry
169167

170168
.PHONY: image-push-%
171169
image-push-%: check-container-tool load-version-json ## Push Docker image to registry
172170
@printf "\033[33;1m==== Pushing Docker image $($*_IMAGE) ====\033[0m\n"
173171
$(CONTAINER_TOOL) push $($*_IMAGE)
174172

175-
.PHONY: activator-image-build
176-
activator-image-build: ## Build the activator image using Docker Buildx.
177-
$(CONTAINER_TOOL) build \
178-
--platform linux/$(TARGETARCH) \
179-
--build-arg TARGETOS=linux \
180-
--build-arg TARGETARCH=${TARGETARCH} \
181-
--build-arg COMMIT_SHA=${GIT_COMMIT_SHA} \
182-
--build-arg BUILD_REF=${BUILD_REF} \
183-
-t $(ACTIVATOR_IMG) \
184-
-f Dockerfile.activator .
185-
186-
.PHONY: activator-image-push
187-
activator-image-push: check-container-tool load-version-json ## Push Activator Docker image $(ACTIVATOR_IMG) to registry
188-
@printf "\033[33;1m==== Pushing Activator Docker image $(ACTIVATOR_IMG) ====\033[0m\n"
189-
$(CONTAINER_TOOL) push $(ACTIVATOR_IMG)
190-
191173
##@ Install/Uninstall Targets
192174

193175
# Default install/uninstall (Docker)

charts/activator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The following table list the configurable parameters of the chart.
3636
| `activator.image.pullPolicy` | Image pull policy for the container. Possible values: `Always`, `IfNotPresent`, or `Never`. Defaults to `Always`. |
3737
| `inferenceGateway.port` | The port of the Gateway. Defaults to `80`. |
3838
| `inferencePool.name` | The name of the InferencePool to target. |
39-
| `inferencePool.apiVersion` | The API version of the InferencePool. Defaults to `inference.networking.x-k8s.io`. |
39+
| `inferencePool.apiVersion` | The API version of the InferencePool. Defaults to `inference.networking.k8s.io`. |
4040
| `route.name` | The name of the HTTPRoute to attach the activator to. |
4141

4242
## Notes

charts/activator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ route:
1313

1414
inferencePool:
1515
name: inference-pool
16-
group: inference.networking.x-k8s.io
16+
group: inference.networking.k8s.io
1717

1818
inferenceGateway:
1919
port: 80

pkg/activator/requestcontrol/activator.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/go-logr/logr"
1111
"k8s.io/apimachinery/pkg/api/meta"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13+
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1314
"k8s.io/apimachinery/pkg/runtime/schema"
1415
"k8s.io/apimachinery/pkg/util/wait"
1516
"k8s.io/client-go/dynamic"
@@ -179,14 +180,16 @@ func (a *Activator) inferencePoolPodsReady(logger logr.Logger, namespace, objnam
179180
}
180181

181182
// NOTE: this assumes that the target object has a status.readyReplicas field
182-
if readyReplicas, ok := unstructuredObj.Object["status"].(map[string]any)["readyReplicas"].(int64); ok {
183-
if numReplicas == int32(readyReplicas) {
183+
if readyReplicas, found, err := unstructured.NestedFieldNoCopy(unstructuredObj.Object, "status", "readyReplicas"); found {
184+
if numReplicas == int32(readyReplicas.(int64)) {
184185
logger.V(logutil.DEBUG).Info("Candidate pods are READY")
185186
return true, nil
186187
}
187188
logger.V(logutil.DEBUG).Info("Candidate pods are NOT READY")
189+
} else if err != nil {
190+
logger.Error(err, "Error getting readyReplicas - candidate pods for serving the request are NOT READY")
188191
} else {
189-
logger.V(logutil.DEBUG).Info("Object status.readyReplicas field is not set yet - candidate pods for serving the request are NOT READY ")
192+
logger.V(logutil.DEBUG).Info("Object status.readyReplicas field is not set yet - candidate pods for serving the request are NOT READY")
190193
return false, nil
191194
}
192195

0 commit comments

Comments
 (0)