Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ jobs:

- name: Push Docker Image for Operator
working-directory: ./operator
run: CUSTOM_IMAGE_TAG=${{ steps.docker-tag.outputs.value }} make docker-build-and-push-prod
run: CUSTOM_IMAGE_TAG=${{ steps.docker-tag.outputs.value }} make RELEASE_TAG="${{ github.event.inputs.docker-tag }}" docker-build-and-push-prod

- name: Push Docker Image for Seldon Cli
working-directory: ./operator
run: CUSTOM_IMAGE_TAG=${{ steps.docker-tag.outputs.value }} make docker-build-and-push-prod-cli

- name: Push Docker Images for Scheduler
working-directory: ./scheduler
run: CUSTOM_IMAGE_TAG=${{ steps.docker-tag.outputs.value }} make docker-build-and-push-prod-all
run: CUSTOM_IMAGE_TAG=${{ steps.docker-tag.outputs.value }} make RELEASE_TAG="${{ github.event.inputs.docker-tag }}" docker-build-and-push-prod-all

- name: Push Docker Images for Hodometer
working-directory: ./hodometer
run: BUILD_VERSION=${{ steps.docker-tag.outputs.value }} IMAGE_TAG=${{ steps.docker-tag.outputs.value }} make build-and-push-prod-hodometer-docker
run: BUILD_VERSION=${{ steps.docker-tag.outputs.value }} IMAGE_TAG=${{ steps.docker-tag.outputs.value }} make build-and-push-prod-hodometer-docker

- name: Push Docker Image for k6 Load Testing
working-directory: ./tests/k6
Expand Down
4 changes: 3 additions & 1 deletion operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Build the manager binary
FROM golang:1.24 as builder

ARG RELEASE_TAG

WORKDIR /workspace
COPY . .

# Build the binary
RUN apt-get install make
RUN make -C operator build
RUN make -C operator RELEASE_TAG="$RELEASE_TAG" build

FROM registry.access.redhat.com/ubi9/ubi-micro:9.6
WORKDIR /
Expand Down
7 changes: 4 additions & 3 deletions operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ KUSTOMIZE_VERSION = v5.2.1
SETUP_ENVTEST_VERSION = release-0.21
KIND_NAME=seldon
NAMESPACE ?= seldon-mesh
RELEASE_TAG=$(shell git describe --tags --always --dirty)

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -94,7 +95,7 @@ test: manifests generate fmt vet envtest ## Run tests.

.PHONY: build
build: generate fmt vet ## Build manager binary.
go build -trimpath -ldflags="-w" -o bin/manager main.go
go build -trimpath -ldflags "-w -X github.com/seldonio/seldon-core/operator/v2/version.Tag=$(RELEASE_TAG)" -o bin/manager main.go

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
Expand All @@ -114,15 +115,15 @@ generate-cli-docs:

.PHONY: docker-build
docker-build: ## Build docker image with the manager.
docker build -t ${IMG} -f Dockerfile ..
docker build --build-arg RELEASE_TAG="$(RELEASE_TAG)" -t ${IMG} -f Dockerfile ..

.PHONY: docker-build-cli
docker-build-cli: ## Build docker image with seldon cli.
docker build -t ${IMG_CLI} -f Dockerfile.cli ..

.PHONY: docker-build-and-push-prod
docker-build-and-push-prod: ## Build operator docker image and push, including sbom.
docker buildx build --provenance=true -t ${IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile ..
docker buildx build --build-arg RELEASE_TAG="$(RELEASE_TAG)" --provenance=true -t ${IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile ..

.PHONY: docker-build-and-push-prod-cli
docker-build-and-push-prod-cli: ## Build seldon cli docker image and push, including sbom.
Expand Down
14 changes: 12 additions & 2 deletions operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package main

import (
"flag"
"fmt"
"os"
"strings"
"time"
Expand All @@ -34,6 +35,7 @@ import (
"github.com/seldonio/seldon-core/operator/v2/apis/mlops/v1alpha1"
mlopscontrollers "github.com/seldonio/seldon-core/operator/v2/controllers/mlops"
"github.com/seldonio/seldon-core/operator/v2/scheduler"
"github.com/seldonio/seldon-core/operator/v2/version"
)

var (
Expand Down Expand Up @@ -94,6 +96,7 @@ func getWatchNamespaceConfig(namespace, watchNamespaces string, clusterwide bool

func main() {
var (
displayVersion bool
metricsAddr string
enableLeaderElection bool
probeAddr string
Expand All @@ -104,6 +107,7 @@ func main() {
useDeploymentsForServers bool
)

flag.BoolVar(&displayVersion, "version", false, "display version and exit")
flag.StringVar(&metricsAddr, "metrics-bind-address", ":4000", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":4001", "The address the probe endpoint binds to.")
flag.StringVar(&namespace, "namespace", "", "The namespace to restrict the operator.")
Expand All @@ -125,11 +129,15 @@ func main() {
opts.BindFlags(flag.CommandLine)
flag.Parse()

setupLog.Info("Setting log level", "level", logLevel)
opts.Level = getLogLevel(logLevel)
logger := zap.New(zap.UseFlagOptions(&opts))
logger := zap.New(zap.UseFlagOptions(&opts)).WithValues("version", version.Tag)
ctrl.SetLogger(logger)

setupLog.Info("Setting log level", "level", logLevel)
if displayVersion {
logger.Info(fmt.Sprintf("Version %s", version.Tag))
os.Exit(0)
}

watchNamespaceConfig := getWatchNamespaceConfig(namespace, watchNamespaces, clusterwide)
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Expand Down Expand Up @@ -232,6 +240,8 @@ func main() {
os.Exit(1)
}

setupLog.Info("Started controller manager")

if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
setupLog.Error(err, "problem running manager")
os.Exit(1)
Expand Down
13 changes: 13 additions & 0 deletions operator/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
Copyright (c) 2024 Seldon Technologies Ltd.

Use of this software is governed BY
(1) the license included in the LICENSE file or
(2) if the license included in the LICENSE file is the Business Source License 1.1,
the Change License after the Change Date as each is defined in accordance with the LICENSE file.
*/

package version

// Tag set via GitHub release worfkflow
var Tag = ""
4 changes: 3 additions & 1 deletion scheduler/Dockerfile.agent
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM golang:1.24-alpine as builder

ARG RELEASE_TAG

WORKDIR /build
COPY . .

# Build the binary
RUN apk add --no-cache make
RUN make -C scheduler -o test-go build-agent
RUN make -C scheduler RELEASE_TAG="$RELEASE_TAG" build-agent

# Copy binary
FROM registry.access.redhat.com/ubi9/ubi-micro:9.6
Expand Down
4 changes: 3 additions & 1 deletion scheduler/Dockerfile.dataflow
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM azul/zulu-openjdk-alpine:17-latest AS builder

ARG RELEASE_TAG

COPY --from=gradle:8.5.0-jdk17-alpine /opt/gradle /opt/gradle
RUN ln -s /opt/gradle/bin/gradle /usr/bin/gradle

Expand All @@ -9,7 +11,7 @@ COPY scheduler/data-flow src/data-flow

# TODO - build with Gradle image, with Zulu added in
WORKDIR src/data-flow
RUN gradle build --no-daemon --info
RUN gradle build --no-daemon -Prelease_tag="$RELEASE_TAG" --info

################################################################################

Expand Down
4 changes: 3 additions & 1 deletion scheduler/Dockerfile.modelgateway
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM golang:1.24-bullseye as builder

ARG RELEASE_TAG

WORKDIR /build
COPY . .

# Build the binary
RUN apt-get install make
RUN make -C scheduler -o test-go build-modelgateway
RUN make -C scheduler RELEASE_TAG="$RELEASE_TAG" build-modelgateway

# We add public trust bundle so Kafka can work with e.g. Let's Encrypt certificates
FROM registry.access.redhat.com/ubi9/ubi-minimal as certs
Expand Down
4 changes: 3 additions & 1 deletion scheduler/Dockerfile.pipelinegateway
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM golang:1.24-bullseye as builder

ARG RELEASE_TAG

WORKDIR /build
COPY . .

# Build the binary
RUN apt-get install make
RUN make -C scheduler -o test-go build-pipelinegateway
RUN make -C scheduler RELEASE_TAG="$RELEASE_TAG" build-pipelinegateway

# We add public trust bundle so Kafka can work with e.g. Let's Encrypt certificates
FROM registry.access.redhat.com/ubi9/ubi-minimal as certs
Expand Down
4 changes: 3 additions & 1 deletion scheduler/Dockerfile.scheduler
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM golang:1.24-bullseye as builder

ARG RELEASE_TAG

WORKDIR /build
COPY . .

# Build the binary
RUN apt-get install make
RUN make -C scheduler -o test-go build-scheduler
RUN make -C scheduler RELEASE_TAG="$RELEASE_TAG" build-scheduler

# Kafka dependencies necessitate leaving CGo enabled and using a base image with C dependencies
FROM registry.access.redhat.com/ubi9/ubi-micro:9.6
Expand Down
40 changes: 21 additions & 19 deletions scheduler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,33 @@ GID ?= $(shell id -g)

KIND_NAME=seldon

RELEASE_TAG=$(shell git describe --tags --always --dirty)

GO_LDFLAGS := -w $(patsubst %,-X %, $(GO_BUILD_VARS))

#####################################
# Build
#####################################

.PHONY: build-scheduler
build-scheduler: test-go
go build -trimpath -ldflags="-w" -buildvcs=false -o bin/scheduler ./cmd/scheduler
build-scheduler:
go build -trimpath -ldflags "-w -X github.com/seldonio/seldon-core/scheduler/v2/version.Tag=$(RELEASE_TAG)" -buildvcs=false -o bin/scheduler ./cmd/scheduler

.PHONY: build-proxy
build-proxy: test-go
CGO_ENABLED=0 go build -trimpath -ldflags="-w" -o bin/proxy ./cmd/proxy

.PHONY: build-agent
build-agent: test-go
CGO_ENABLED=0 go build -trimpath -ldflags="-w" -buildvcs=false -o bin/agent ./cmd/agent
build-agent:
CGO_ENABLED=0 go build -trimpath -ldflags "-w -X github.com/seldonio/seldon-core/scheduler/v2/version.Tag=$(RELEASE_TAG)" -buildvcs=false -o bin/agent ./cmd/agent

.PHONY: build-modelgateway
build-modelgateway: test-go
go build -trimpath -ldflags="-w" -o bin/modelgateway -v ./cmd/modelgateway
build-modelgateway:
go build -trimpath -ldflags "-w -X github.com/seldonio/seldon-core/scheduler/v2/version.Tag=$(RELEASE_TAG)" -o bin/modelgateway -v ./cmd/modelgateway

.PHONY: build-pipelinegateway
build-pipelinegateway: test-go
go build -trimpath -ldflags="-w" -o bin/pipelinegateway -v ./cmd/pipelinegateway
build-pipelinegateway:
go build -trimpath -ldflags "-w -X github.com/seldonio/seldon-core/scheduler/v2/version.Tag=$(RELEASE_TAG)" -o bin/pipelinegateway -v ./cmd/pipelinegateway

.PHONY: build-dataflow-producer
build-dataflow-producer: test-jvm
Expand All @@ -60,7 +62,7 @@ build-dataflow-consumer:

.PHONY: build-dataflow-engine
build-dataflow-engine:
cd data-flow; ./gradlew clean build -x test --no-daemon
cd data-flow; ./gradlew clean build -Prelease_tag=$(RELEASE_TAG) -x test --no-daemon

.PHONY: build-go
build-go: build-scheduler build-agent build-proxy build-modelgateway build-pipelinegateway
Expand Down Expand Up @@ -128,15 +130,15 @@ mockgen-scheduler-client: mock-install

.PHONY: docker-build-scheduler
docker-build-scheduler: copy-components
docker build -t ${SCHEDULER_IMG} -f Dockerfile.scheduler ..
docker build --build-arg RELEASE_TAG="$(RELEASE_TAG)" -t ${SCHEDULER_IMG} -f Dockerfile.scheduler ..

.PHONY: docker-push-scheduler
docker-push-scheduler:
docker push ${SCHEDULER_IMG}

.PHONY: docker-build-and-push-prod-scheduler
docker-build-and-push-prod-scheduler: copy-components
docker buildx build --provenance=true -t ${SCHEDULER_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.scheduler ..
docker buildx build --build-arg RELEASE_TAG="$(RELEASE_TAG)" --provenance=true -t ${SCHEDULER_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.scheduler ..

.PHONY: copy-components
copy-components:
Expand All @@ -145,15 +147,15 @@ copy-components:

.PHONY: docker-build-agent
docker-build-agent:
docker build -t ${AGENT_IMG} -f Dockerfile.agent ..
docker build --build-arg RELEASE_TAG="$(RELEASE_TAG)" -t ${AGENT_IMG} -f Dockerfile.agent ..

.PHONY: docker-push-agent
docker-push-agent:
docker push ${AGENT_IMG}

.PHONY: docker-build-and-push-prod-agent
docker-build-and-push-prod-agent:
docker buildx build --provenance=true -t ${AGENT_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.agent ..
docker buildx build --build-arg RELEASE_TAG="$(RELEASE_TAG)" --provenance=true -t ${AGENT_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.agent ..

.PHONY: docker-build-rclone
docker-build-rclone:
Expand All @@ -169,27 +171,27 @@ docker-build-and-push-prod-rclone:

.PHONY: docker-build-modelgateway
docker-build-modelgateway: copy-components
docker build -t ${MODELGATEWAY_IMG} -f Dockerfile.modelgateway ..
docker build --build-arg RELEASE_TAG="$(RELEASE_TAG)" -t ${MODELGATEWAY_IMG} -f Dockerfile.modelgateway ..

.PHONY: docker-push-modelgateway
docker-push-modelgateway:
docker push ${MODELGATEWAY_IMG}

.PHONY: docker-build-and-push-prod-modelgateway
docker-build-and-push-prod-modelgateway: copy-components
docker buildx build --provenance=true -t ${MODELGATEWAY_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.modelgateway ..
docker buildx build --build-arg RELEASE_TAG="$(RELEASE_TAG)" --provenance=true -t ${MODELGATEWAY_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.modelgateway ..

.PHONY: docker-build-pipelinegateway
docker-build-pipelinegateway:
docker build -t ${PIPELINEGATEWAY_IMG} -f Dockerfile.pipelinegateway ..
docker build --build-arg RELEASE_TAG="$(RELEASE_TAG)" -t ${PIPELINEGATEWAY_IMG} -f Dockerfile.pipelinegateway ..

.PHONY: docker-push-pipelinegateway
docker-push-pipelinegateway:
docker push ${PIPELINEGATEWAY_IMG}

.PHONY: docker-build-and-push-prod-pipelinegateway
docker-build-and-push-prod-pipelinegateway:
docker buildx build --provenance=true -t ${PIPELINEGATEWAY_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.pipelinegateway ..
docker buildx build --build-arg RELEASE_TAG="$(RELEASE_TAG)" --provenance=true -t ${PIPELINEGATEWAY_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.pipelinegateway ..

.PHONY: docker-build-envoy
docker-build-envoy:
Expand All @@ -205,15 +207,15 @@ docker-build-and-push-prod-envoy:

.PHONY: docker-build-dataflow
docker-build-dataflow: data-flow/opentelemetry-javaagent.jar
docker build -t ${DATAFLOW_IMG} -f Dockerfile.dataflow ..
docker build --build-arg RELEASE_TAG="$(RELEASE_TAG)" -t ${DATAFLOW_IMG} -f Dockerfile.dataflow ..

.PHONY: docker-push-dataflow
docker-push-dataflow:
docker push ${DATAFLOW_IMG}

.PHONY: docker-build-and-push-prod-dataflow
docker-build-and-push-prod-dataflow: data-flow/opentelemetry-javaagent.jar
docker buildx build --provenance=true -t ${DATAFLOW_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.dataflow ..
docker buildx build --build-arg RELEASE_TAG="$(RELEASE_TAG)" --provenance=true -t ${DATAFLOW_IMG} --attest type=sbom,generator=docker/scout-sbom-indexer:latest --push -f Dockerfile.dataflow ..

.PHONY: docker-build-grafana
docker-build-grafana:
Expand Down
2 changes: 2 additions & 0 deletions scheduler/cmd/agent/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const (
envUnloadGraceSeconds = "SELDON_UNLOAD_GRACE_PERIOD_SECONDS"
envuseDeploymentsForServers = "SELDON_USE_DEPLOYMENTS_FOR_SERVERS"

flagVersion = "version"
flagSchedulerHost = "scheduler-host"
flagSchedulerPlaintxtPort = "scheduler-port"
flagSchedulerTlsPort = "scheduler-tls-port"
Expand Down Expand Up @@ -117,6 +118,7 @@ const (
)

var (
DisplayVersion bool
agentHost string
ServerName string
ReplicaIdx uint
Expand Down
1 change: 1 addition & 0 deletions scheduler/cmd/agent/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
)

func makeArgs() {
flag.BoolVar(&DisplayVersion, flagVersion, false, "display version and exit")
flag.StringVar(&agentHost, "agent-host", "0.0.0.0", "Agent hostname")
flag.StringVar(&ServerName, flagServerName, "mlserver", "Server name")
flag.UintVar(&ReplicaIdx, "server-idx", 0, "Server index")
Expand Down
Loading
Loading