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

Fix Ambassador weights and HPA deletion #1272

Merged
merged 4 commits into from
Dec 14, 2019
Merged
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
14 changes: 0 additions & 14 deletions notebooks/resources/model.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
apiVersion: machinelearning.seldon.io/v1alpha2
kind: SeldonDeployment
metadata:
labels:
app: seldon
name: seldon-model
spec:
name: test-deployment
oauth_key: oauth-key
oauth_secret: oauth-secret
predictors:
- componentSpecs:
- spec:
containers:
- image: seldonio/mock_classifier:1.0
imagePullPolicy: IfNotPresent
name: classifier
resources:
requests:
memory: 1Mi
terminationGracePeriodSeconds: 1
volumes:
- name: myempty
emptyDir: {}
graph:
children: []
endpoint:
type: REST
name: classifier
type: MODEL
labels:
version: v1
name: example
replicas: 1
3 changes: 2 additions & 1 deletion operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ RUN go mod download

# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY apis/ apis/
COPY controllers/ controllers/
COPY utils/ utils/
COPY constants/ constants/
COPY client/ client/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
Expand Down
22 changes: 15 additions & 7 deletions operator/controllers/ambassador.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func getAmbassadorRestConfig(mlDep *machinelearningv1.SeldonDeployment,
serviceNameExternal string,
customHeader string,
customRegexHeader string,
weight int32,
weight *int32,
shadowing string,
engine_http_port int,
nameOverride string,
Expand Down Expand Up @@ -86,7 +86,10 @@ func getAmbassadorRestConfig(mlDep *machinelearningv1.SeldonDeployment,
RetryOn: "connect-failure",
NumRetries: 3,
},
Weight: weight,
}

if weight != nil {
c.Weight = *weight
}

if timeout > AMBASSADOR_IDLE_TIMEOUT {
Expand Down Expand Up @@ -139,7 +142,7 @@ func getAmbassadorGrpcConfig(mlDep *machinelearningv1.SeldonDeployment,
serviceNameExternal string,
customHeader string,
customRegexHeader string,
weight int32,
weight *int32,
shadowing string,
engine_grpc_port int,
nameOverride string,
Expand Down Expand Up @@ -174,7 +177,10 @@ func getAmbassadorGrpcConfig(mlDep *machinelearningv1.SeldonDeployment,
RetryOn: "connect-failure",
NumRetries: 3,
},
Weight: weight,
}

if weight != nil {
c.Weight = *weight
}

if timeout > AMBASSADOR_IDLE_TIMEOUT {
Expand Down Expand Up @@ -225,10 +231,12 @@ func getAmbassadorConfigs(mlDep *machinelearningv1.SeldonDeployment, p *machinel
return annotation, nil
} else {

weight := p.Traffic
if len(mlDep.Spec.Predictors) <= 1 {
weight = 100
var weight *int32
// Ignore weight on first predictor and let Ambassador handle this
if mlDep.Spec.Predictors[0].Name != p.Name {
weight = &p.Traffic
}

shadowing := getAnnotation(mlDep, ANNOTATION_AMBASSADOR_SHADOW, "")
serviceNameExternal := getAnnotation(mlDep, ANNOTATION_AMBASSADOR_SERVICE, mlDep.ObjectMeta.Name)
customHeader := getAnnotation(mlDep, ANNOTATION_AMBASSADOR_HEADER, "")
Expand Down
Loading